@Mapper
public interface UserAuthorityMapper
| 限定符和类型 | 方法和说明 |
|---|---|
int |
deleteUserAuthorityByUserId(Integer userId)
删除用户权限
|
int |
deleteUserRoleByUserId(Integer userId)
给用户删除角色
|
List<Authority> |
finAllAuthority() |
List<Authority> |
findAuthorityAllByUserId(Integer userId)
查询一个用户所有的权限包含角色的权限
|
List<Authority> |
findAuthorityByUserId(Integer userId)
查询一个用户的权限
|
List<Role> |
findRoleByUserId(Integer userId)
查询一个用户所有的角色
|
int |
insertUserAuthorityList(List<Integer> authorityIds,
Integer userId,
java.time.LocalDateTime createTime)
给用户添加权限
|
int |
insertUserRoleList(List<Integer> roleIds,
Integer userId,
java.time.LocalDateTime createTime)
给用户添加角色
|
@Results(id="baseResult",value={@Result(id=true,column="id",property="id",jdbcType=INTEGER),@Result(column="name",property="name",jdbcType=VARCHAR),@Result(column="parent_id",property="parentId",jdbcType=INTEGER),@Result(column="menu_type",property="menuType",jdbcType=VARCHAR),@Result(column="create_time",property="createTime",jdbcType=TIMESTAMP)})
@Select(value="SELECT a.id,a.name,a.value,a.parent_id,a.type,a.path,a.menu_type,a.icon,a.sort FROM oauth_authority a \nJOIN oauth_user_authority_mapping ra ON a.id = ra.authority_id \nWHERE ra.user_id = #{userId}")
List<Authority> findAuthorityByUserId(Integer userId)
@Result(id=true,column="id",property="id",jdbcType=INTEGER) @Result(column="name",property="name",jdbcType=VARCHAR) @Result(column="value",property="value",jdbcType=VARCHAR)
@Select(value="SELECT r.id,r.name,r.value FROM oauth_role r \nJOIN oauth_user_role_mapping ur ON r.id = ur.role_id AND ur.user_id = #{userId}")
List<Role> findRoleByUserId(Integer userId)
@ResultMap(value="baseResult")
@Select(value="SELECT a.id,a.name,a.value,a.parent_id,a.type,a.path,a.menu_type,a.icon,a.sort FROM oauth_authority a \nJOIN oauth_user_authority_mapping ra ON a.id = ra.authority_id \nWHERE ra.user_id = #{userId}\nUNION\nSELECT a.id,a.name,a.value,a.parent_id,a.type,a.path,a.menu_type,a.icon,a.sort FROM oauth_authority a \nJOIN oauth_role_authority_mapping ra ON a.id = ra.authority_id \nJOIN oauth_user_role_mapping ur ON ur.user_id = #{userId}\n")
List<Authority> findAuthorityAllByUserId(Integer userId)
@ResultMap(value="baseResult") @Select(value="SELECT a.id,a.name,a.value,a.parent_id,a.type,a.path,a.menu_type,a.icon,a.sort,a.create_time FROM oauth_authority a WHERE is_deleted = 0") List<Authority> finAllAuthority()
@Insert(value="<script>INSERT INTO oauth_user_authority_mapping (user_id,authority_id,create_time) VALUES <foreach collection=\'ids\' item=\'item\' separator=\',\'>(#{userId},#{item},#{createTime})</foreach></script>")
int insertUserAuthorityList(@Param(value="ids")
List<Integer> authorityIds,
@Param(value="userId")
Integer userId,
@Param(value="createTime")
java.time.LocalDateTime createTime)
@Delete(value="DELETE FROM oauth_user_authority_mapping WHERE user_id =#{userId}")
int deleteUserAuthorityByUserId(Integer userId)
@Insert(value="<script>INSERT INTO oauth_user_role_mapping (user_id,role_id,create_time) VALUES <foreach collection=\'ids\' item=\'item\' separator=\',\'>(#{userId},#{item},#{createTime})</foreach></script>")
int insertUserRoleList(@Param(value="ids")
List<Integer> roleIds,
@Param(value="userId")
Integer userId,
@Param(value="createTime")
java.time.LocalDateTime createTime)
@Delete(value="DELETE FROM oauth_user_role_mapping WHERE user_id =#{userId}")
int deleteUserRoleByUserId(Integer userId)
Copyright © 2021–2022 structure. All rights reserved.