完成 Role 模块的迁移
parent
04feb57ed8
commit
1bfaa2c967
@ -1,44 +0,0 @@
|
|||||||
package com.ruoyi.system.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.domain.SysRoleMenu;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 角色与菜单关联表 数据层
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public interface SysRoleMenuMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询菜单使用数量
|
|
||||||
*
|
|
||||||
* @param menuId 菜单ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int checkMenuExistRole(Long menuId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过角色ID删除角色和菜单关联
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRoleMenuByRoleId(Long roleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除角色菜单关联信息
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteRoleMenu(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增角色菜单信息
|
|
||||||
*
|
|
||||||
* @param roleMenuList 角色菜单列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int batchRoleMenu(List<SysRoleMenu> roleMenuList);
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
package com.ruoyi.system.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户与角色关联表 数据层
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
public interface SysUserRoleMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 通过用户ID删除用户和角色关联
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteUserRoleByUserId(Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除用户和角色关联
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteUserRole(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过角色ID查询角色使用数量
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int countUserRoleByRoleId(Long roleId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增用户角色信息
|
|
||||||
*
|
|
||||||
* @param userRoleList 用户角色列表
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int batchUserRole(List<SysUserRole> userRoleList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除用户和角色关联信息
|
|
||||||
*
|
|
||||||
* @param userRole 用户和角色关联信息
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteUserRoleInfo(SysUserRole userRole);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量取消授权用户角色
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @param userIds 需要删除的用户数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysRoleMenuMapper">
|
|
||||||
|
|
||||||
<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
|
|
||||||
<result property="roleId" column="role_id" />
|
|
||||||
<result property="menuId" column="menu_id" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<select id="checkMenuExistRole" resultType="Integer">
|
|
||||||
select count(1) from sys_role_menu where menu_id = #{menuId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
|
|
||||||
delete from sys_role_menu where role_id=#{roleId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteRoleMenu" parameterType="Long">
|
|
||||||
delete from sys_role_menu where role_id in
|
|
||||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
|
||||||
#{roleId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<insert id="batchRoleMenu">
|
|
||||||
insert into sys_role_menu(role_id, menu_id) values
|
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
|
||||||
(#{item.roleId},#{item.menuId})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysUserRoleMapper">
|
|
||||||
|
|
||||||
<resultMap type="SysUserRole" id="SysUserRoleResult">
|
|
||||||
<result property="userId" column="user_id" />
|
|
||||||
<result property="roleId" column="role_id" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<delete id="deleteUserRoleByUserId" parameterType="Long">
|
|
||||||
delete from sys_user_role where user_id=#{userId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<select id="countUserRoleByRoleId" resultType="Integer">
|
|
||||||
select count(1) from sys_user_role where role_id=#{roleId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<delete id="deleteUserRole" parameterType="Long">
|
|
||||||
delete from sys_user_role where user_id in
|
|
||||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
|
||||||
#{userId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<insert id="batchUserRole">
|
|
||||||
insert into sys_user_role(user_id, role_id) values
|
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
|
||||||
(#{item.userId},#{item.roleId})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
|
|
||||||
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteUserRoleInfos">
|
|
||||||
delete from sys_user_role where role_id=#{roleId} and user_id in
|
|
||||||
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
|
||||||
#{userId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.permission.vo.permission;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ApiModel("赋予角色数据权限 Request VO")
|
||||||
|
@Data
|
||||||
|
public class SysPermissionAssignRoleDataScopeReqVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||||
|
@NotNull(message = "角色编号不能为空")
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 SysDataScopeEnum 枚举类")
|
||||||
|
@NotNull(message = "数据范围不能为空")
|
||||||
|
// TODO 这里要多一个枚举校验
|
||||||
|
private Integer dataScope;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "部门编号列表", example = "1,3,5", notes = "只有范围类型为 DEPT_CUSTOM 时,该字段才需要")
|
||||||
|
private Set<Long> dataScopeDeptIds = Collections.emptySet(); // 兜底
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue