正在显示
6 个修改的文件
包含
51 行增加
和
0 行删除
| @@ -65,6 +65,17 @@ public class RoleController { | @@ -65,6 +65,17 @@ public class RoleController { | ||
| 65 | return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败"); | 65 | return i==1 ? new ResultJson("200","设置权限成功") :new ResultJson("500","设置权限失败"); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | + /** | ||
| 69 | + * 获取角色的的数据权限 | ||
| 70 | + * @return | ||
| 71 | + */ | ||
| 72 | + @LogAnnotation(moduleName = "获取角色的的数据权限",operate = "获取角色的的数据权限") | ||
| 73 | + @PostMapping("/roleDataPermGet") | ||
| 74 | + public ResultJson roleDataPermGet(@RequestBody RoleDataPermission roleDataPermission){ | ||
| 75 | + RoleDataPermission permissions = roleService.getRoleDataPermissoin(roleDataPermission); | ||
| 76 | + return new ResultJson("200","获取权限列表成功",permissions); | ||
| 77 | + } | ||
| 78 | + | ||
| 68 | @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色修改") | 79 | @LogAnnotation(moduleName = "岗位/角色管理",operate = "岗位/角色修改") |
| 69 | @PutMapping("/edit") | 80 | @PutMapping("/edit") |
| 70 | @ResponseBody | 81 | @ResponseBody |
| @@ -15,6 +15,8 @@ public interface RoleDataPermissionDao { | @@ -15,6 +15,8 @@ public interface RoleDataPermissionDao { | ||
| 15 | 15 | ||
| 16 | RoleDataPermission selectByPrimaryKey(Integer id); | 16 | RoleDataPermission selectByPrimaryKey(Integer id); |
| 17 | 17 | ||
| 18 | + RoleDataPermission getRoleDataPerms(Integer id); | ||
| 19 | + | ||
| 18 | int updateByPrimaryKeySelective(RoleDataPermission record); | 20 | int updateByPrimaryKeySelective(RoleDataPermission record); |
| 19 | 21 | ||
| 20 | int updateByPrimaryKey(RoleDataPermission record); | 22 | int updateByPrimaryKey(RoleDataPermission record); |
| @@ -19,5 +19,7 @@ public class RoleDataPermission implements Serializable { | @@ -19,5 +19,7 @@ public class RoleDataPermission implements Serializable { | ||
| 19 | 19 | ||
| 20 | private List<Integer> permissionIds; | 20 | private List<Integer> permissionIds; |
| 21 | 21 | ||
| 22 | + private List<DataPermission> dataPermissions; | ||
| 23 | + | ||
| 22 | private static final long serialVersionUID = 1L; | 24 | private static final long serialVersionUID = 1L; |
| 23 | } | 25 | } |
| @@ -20,6 +20,8 @@ public interface RoleService { | @@ -20,6 +20,8 @@ public interface RoleService { | ||
| 20 | 20 | ||
| 21 | int setRoleDataPermissoin(RoleDataPermission record); | 21 | int setRoleDataPermissoin(RoleDataPermission record); |
| 22 | 22 | ||
| 23 | + RoleDataPermission getRoleDataPermissoin(RoleDataPermission record); | ||
| 24 | + | ||
| 23 | int updateByPrimaryKeySelective(ROLE role); | 25 | int updateByPrimaryKeySelective(ROLE role); |
| 24 | 26 | ||
| 25 | int deleteByPrimaryKey(Integer departmentId); | 27 | int deleteByPrimaryKey(Integer departmentId); |
| @@ -153,6 +153,12 @@ public class RoleServiceImp implements RoleService{ | @@ -153,6 +153,12 @@ public class RoleServiceImp implements RoleService{ | ||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | @Override | 155 | @Override |
| 156 | + public RoleDataPermission getRoleDataPermissoin(RoleDataPermission record) { | ||
| 157 | + RoleDataPermission roleDataPerms = roleDataPermissionDao.getRoleDataPerms(record.getRoleId()); | ||
| 158 | + return roleDataPerms; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + @Override | ||
| 156 | public int updateByPrimaryKeySelective(ROLE company) { | 162 | public int updateByPrimaryKeySelective(ROLE company) { |
| 157 | return roleMapper.updateByPrimaryKeySelective(company); | 163 | return roleMapper.updateByPrimaryKeySelective(company); |
| 158 | } | 164 | } |
| @@ -6,6 +6,12 @@ | @@ -6,6 +6,12 @@ | ||
| 6 | <result column="role_id" jdbcType="INTEGER" property="roleId" /> | 6 | <result column="role_id" jdbcType="INTEGER" property="roleId" /> |
| 7 | <result column="permission_id" jdbcType="INTEGER" property="permissionId" /> | 7 | <result column="permission_id" jdbcType="INTEGER" property="permissionId" /> |
| 8 | </resultMap> | 8 | </resultMap> |
| 9 | + <resultMap id="PermissionResultMap" type="com.tianbo.warehouse.model.RoleDataPermission" extends="BaseResultMap"> | ||
| 10 | + <collection javaType="java.util.ArrayList" ofType="com.tianbo.warehouse.model.DataPermission" property="dataPermissions"> | ||
| 11 | + <result column="data_perm_id" jdbcType="INTEGER" property="data_perm_id" /> | ||
| 12 | + <result column="perm_name" jdbcType="VARCHAR" property="perm_name" /> | ||
| 13 | + </collection> | ||
| 14 | + </resultMap> | ||
| 9 | <sql id="Base_Column_List"> | 15 | <sql id="Base_Column_List"> |
| 10 | id, role_id, permission_id | 16 | id, role_id, permission_id |
| 11 | </sql> | 17 | </sql> |
| @@ -15,6 +21,28 @@ | @@ -15,6 +21,28 @@ | ||
| 15 | from role_data_permission | 21 | from role_data_permission |
| 16 | where id = #{id,jdbcType=INTEGER} | 22 | where id = #{id,jdbcType=INTEGER} |
| 17 | </select> | 23 | </select> |
| 24 | + <select id="getRoleDataPerms" parameterType="java.lang.Integer" resultMap="PermissionResultMap"> | ||
| 25 | + SELECT | ||
| 26 | + t.id, | ||
| 27 | + t.role_id, | ||
| 28 | + t.permission_id, | ||
| 29 | + dp.data_perm_id, | ||
| 30 | + dp.perm_name | ||
| 31 | + FROM | ||
| 32 | + ( | ||
| 33 | + SELECT | ||
| 34 | + id, | ||
| 35 | + role_id, | ||
| 36 | + permission_id | ||
| 37 | + FROM | ||
| 38 | + role_data_permission rdp | ||
| 39 | + WHERE | ||
| 40 | + role_id = #{roleId,jdbcType=INTEGER} | ||
| 41 | + ) t | ||
| 42 | + LEFT JOIN data_permission dp | ||
| 43 | + ON t.permission_id = dp.data_perm_id | ||
| 44 | + ORDER BY dp.perm_keyword,dp.perm_sort | ||
| 45 | + </select> | ||
| 18 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 46 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
| 19 | delete from role_data_permission | 47 | delete from role_data_permission |
| 20 | where id = #{id,jdbcType=INTEGER} | 48 | where id = #{id,jdbcType=INTEGER} |
-
请 注册 或 登录 后发表评论