@Mapper
public interface UserAccountMapper
| 限定符和类型 | 方法和说明 |
|---|---|
int |
insertUserAccount(UserAccount userAccount) |
UserAccount |
selectUserById(Integer id) |
UserAccount |
selectUserByUsername(String username)
根据用户名查询用户账户
|
List<UserAccount> |
selectUserList(String name,
Boolean enable,
Boolean unlock) |
int |
updateUser(UserAccount userAccount) |
@Results(id="userResult",value={@Result(id=true,column="id",property="id",jdbcType=INTEGER),@Result(column="username",property="username",jdbcType=VARCHAR),@Result(column="password",property="password",jdbcType=VARCHAR),@Result(column="is_unexpired",property="unexpired",jdbcType=TINYINT),@Result(column="is_enabled",property="enable",jdbcType=TINYINT),@Result(column="is_unlocked",property="unlocked",jdbcType=TINYINT),@Result(column="is_deleted",property="deleted",jdbcType=TINYINT),@Result(column="nick_name",property="nickName",jdbcType=VARCHAR),@Result(column="head_portrait",property="headPortrait",jdbcType=VARCHAR),@Result(column="create_time",property="createTime",jdbcType=DATE)})
@Select(value="SELECT id,username,nick_name,head_portrait,password,is_unexpired,is_enabled,is_unlocked,is_deleted,create_time FROM oauth_user WHERE username = #{username} AND is_deleted = 0")
UserAccount selectUserByUsername(String username)
@ResultMap(value="userResult")
@Select(value="SELECT id,username,password,nick_name,head_portrait,is_unexpired,is_enabled,is_unlocked,is_deleted,create_time FROM oauth_user WHERE id = #{id} ")
UserAccount selectUserById(Integer id)
@Insert(value="INSERT INTO oauth_user(username,password,nick_name,head_portrait,is_unexpired,is_enabled,is_unlocked,is_deleted,create_time,update_time) VALUES (#{username},#{password},#{nickName},#{headPortrait},#{unexpired},#{enable},#{unlocked},#{deleted},#{createTime},#{updateTime})")
@Options(useGeneratedKeys=true,
keyProperty="id")
int insertUserAccount(UserAccount userAccount)
@Update(value="<script> UPDATE oauth_user <trim prefix=\"set\" suffixOverrides=\",\"><if test=\'password !=null\'> password = #{password},</if><if test=\'unexpired !=null\'> is_unexpired = #{unexpired},</if><if test=\'enable !=null\'> is_enabled = #{enable},</if><if test=\'unlocked !=null\'> is_unlocked = #{unlocked},</if><if test=\'deleted !=null\'> is_deleted = #{deleted},</if><if test=\'nickName !=null\'> nick_name = #{nickName},</if><if test=\'headPortrait !=null\'> head_portrait = #{headPortrait},</if><if test=\'createTime !=null\'> create_time = #{createTime},</if><if test=\'updateTime !=null\'> update_time = #{updateTime},</if></trim>WHERE id = #{id}</script>")
int updateUser(UserAccount userAccount)
@ResultMap(value="userResult")
@Select(value="<script>SELECT id,username,password,nick_name,head_portrait,is_unexpired,is_enabled,is_unlocked,is_deleted,create_time FROM oauth_user<trim prefix=\"WHERE\" suffixOverrides=\"AND\"><if test=\'enable !=null\'> is_enabled = #{enable} AND</if><if test=\'unlock !=null\'> is_unlocked = #{unlock} AND</if><if test=\'name !=null\'> (username like CONCAT(CONCAT(\'%\',\'#{name}\'),\'%\') OR nick_name like CONCAT(CONCAT(\'%\',\'#{name}\'),\'%\') AND </if></trim></script>")
List<UserAccount> selectUserList(@Param(value="name")
String name,
@Param(value="enable")
Boolean enable,
@Param(value="unlock")
Boolean unlock)
Copyright © 2021 structure. All rights reserved.