人员配置机构

This commit is contained in:
root
2021-06-29 16:34:02 +08:00
parent 4533960ef9
commit 39e5e4c4c5
22 changed files with 439 additions and 23 deletions
@@ -4,6 +4,7 @@ package com.adc.da.slrs.sarRole.controller;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.login.util.UserUtils;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarRole.entity.TsRoleMenuVO;
import com.adc.da.slrs.sarRole.service.ITsRoleService;
import com.adc.da.sys.entity.UserEO;
@@ -84,4 +85,11 @@ public class TsRoleController extends BaseController<TsRole> {
TsRole tsRole=tsRoleService.getById(roleId);
return Result.success(tsRole);
}
@ApiOperation("查询角色权限")
@GetMapping("/menu")
public ResponseMessage<List<String>> getMenu(@RequestParam String roleId){
List<String> menuIds=tsRoleService.getMenu(roleId);
return Result.success(menuIds);
}
}
@@ -49,4 +49,7 @@ public interface TsRoleDao extends BaseMapper<TsRole> {
*/
@Delete("delete from ts_role_menu where role_id=#{roleId} and menu_id=#{menuId}")
void delMenu(String roleId, String menuId);
@Select("select menu_id from ts_role_menu where role_id=#{roleId}")
List<String> getMenuIdByRoleId(String roleId);
}
@@ -57,4 +57,11 @@ public interface ITsRoleService extends IService<TsRole> {
* @return ResponseMessage<Object>
*/
ResponseMessage<Object> setMenu(TsRoleMenuVO tsRoleMenuVO);
/**
* 查询角色权限
* @param roleId:角色ID
* @return List<String>
*/
List<String> getMenu(String roleId);
}
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarRole.service.impl;
import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.slrs.sarMenu.dao.SarMenuDao;
import com.adc.da.slrs.sarMenu.entity.SarMenu;
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
import com.adc.da.slrs.sarRole.entity.TsRole;
@@ -158,16 +159,30 @@ public class TsRoleServiceImpl extends ServiceImpl<TsRoleDao, TsRole> implements
Map<String,List<String>> updateMenuIds= ListUtil.difList(tsRoleMenuVO.getMenuIds(),oldMenuIds);
List<String> insertIds=updateMenuIds.get("insert");
List<String> deleteIds=updateMenuIds.get("update");
for(String menuId:insertIds){
tsRoleDao.addMenu(tsRoleMenuVO.getRoleId(),menuId);
if(insertIds!=null&&insertIds.size()>1){
for(String menuId:insertIds){
tsRoleDao.addMenu(tsRoleMenuVO.getRoleId(),menuId);
}
}
for(String menuId:deleteIds){
tsRoleDao.delMenu(tsRoleMenuVO.getRoleId(),menuId);
if(deleteIds!=null&&deleteIds.size()>1){
for(String menuId:deleteIds){
tsRoleDao.delMenu(tsRoleMenuVO.getRoleId(),menuId);
}
}
//修改首页自定义目录
// List<SarMenu> menus=sarMenuService.getMenusByIds(tsRoleMenuVO.getMenuIds());
return Result.success();
}
/**
* 查询角色权限
* @param roleId:角色ID
* @return List<String>
*/
@Override
public List<String> getMenu(String roleId) {
return tsRoleDao.getMenuIdByRoleId(roleId);
}
}