@Mapper
public interface RoleMapper
角色Mapper
| 限定符和类型 | 方法和说明 |
|---|---|
int |
delete(Integer id) |
int |
deleteRoleAuthorityByRoleId(Integer roleId) |
List<Role> |
findRoleList() |
int |
insertRole(Role role) |
int |
insertRoleAuthorityList(List<RoleAuthorityUser> authorityUser) |
Role |
selectById(Integer id) |
int |
updateRole(Role role) |
@Results(id="baseResult",value={@Result(column="is_enabled",property="enable",jdbcType=TINYINT),@Result(column="create_time",property="createTime",jdbcType=TIMESTAMP),@Result(column="update_time",property="createTime",jdbcType=TIMESTAMP)})
@Select(value="SELECT id,name,value,is_enabled,create_time,update_time FROM oauth_role WHERE is_deleted = 0")
List<Role> findRoleList()
@Insert(value="INSERT INTO oauth_role(name,value,is_enabled,create_time,update_time) VALUES (#{name},#{value},#{enable},#{createTime},#{updateTime})")
@Options(useGeneratedKeys=true,
keyProperty="id")
int insertRole(Role role)
@Update(value="<script> UPDATE oauth_role <trim prefix=\"set\" suffixOverrides=\",\"><if test=\'name !=null\'> name = #{name},</if><if test=\'value !=null\'> value = #{value},</if><if test=\'enable !=null\'> is_enabled = #{enable},</if><if test=\'isDelete !=null\'> is_deleted = #{isDelete},</if><if test=\'updateTime !=null\'> update_time = #{updateTime},</if></trim>WHERE id = #{id}</script>")
int updateRole(Role role)
@ResultMap(value="baseResult")
@Select(value="SELECT id,name,value,is_enabled,create_time,update_time FROM oauth_role WHERE id = #{id}")
Role selectById(Integer id)
@Delete(value="DELETE FROM oauth_role WHERE id = #{id}")
int delete(Integer id)
@Insert(value="<script>INSERT INTO oauth_role_authority_mapping (role_id,authority_id,create_time) VALUES <foreach collection=\'list\' item=\"item\" index=\"index\" separator=\',\'>(#{item.roleId},${item.authorityId},#{item.createTime})</foreach></script>")
int insertRoleAuthorityList(@Param(value="list")
List<RoleAuthorityUser> authorityUser)
@Delete(value="DELETE FROM oauth_role_authority_mapping WHERE role_id =#{roleId}")
int deleteRoleAuthorityByRoleId(Integer roleId)
Copyright © 2021–2022 structure. All rights reserved.