Browse Source

重构权限

master
陈裕财 4 years ago
parent
commit
1c26b5054d
  1. 53
      xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java
  2. 1
      xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java
  3. 5
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml
  4. 6
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskMapper.xml

53
xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java

@ -96,6 +96,7 @@ public class XmMenuController {
Map<String,Object> m = new HashMap<>(); Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(xmMenu, "menuIds"); RequestUtils.transformArray(xmMenu, "menuIds");
RequestUtils.transformArray(xmMenu, "tagIdList"); RequestUtils.transformArray(xmMenu, "tagIdList");
RequestUtils.transformArray(xmMenu, "dclasss");
PageUtils.startPage(xmMenu); PageUtils.startPage(xmMenu);
String menuId= (String) xmMenu.get("menuId"); String menuId= (String) xmMenu.get("menuId");
Object menuIds= xmMenu.get("menuIds"); Object menuIds= xmMenu.get("menuIds");
@ -149,6 +150,7 @@ public class XmMenuController {
Map<String,Object> m = new HashMap<>(); Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(xmMenu, "menuIds"); RequestUtils.transformArray(xmMenu, "menuIds");
RequestUtils.transformArray(xmMenu, "tagIdList"); RequestUtils.transformArray(xmMenu, "tagIdList");
RequestUtils.transformArray(xmMenu, "dclasss");
PageUtils.startPage(xmMenu); PageUtils.startPage(xmMenu);
Tips tips=new Tips("查询成功"); Tips tips=new Tips("查询成功");
String menuId= (String) xmMenu.get("menuId"); String menuId= (String) xmMenu.get("menuId");
@ -230,57 +232,6 @@ public class XmMenuController {
return m; return m;
} }
@RequestMapping(value="/listWithPhase",method=RequestMethod.GET)
public Map<String,Object> listWithPhase( @ApiIgnore @RequestParam Map<String,Object> xmMenu){
Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(xmMenu, "menuIds");
RequestUtils.transformArray(xmMenu, "tagIdList");
PageUtils.startPage(xmMenu);
Tips tips=new Tips("查询成功");
String menuId= (String) xmMenu.get("menuId");
Object menuIds= xmMenu.get("menuIds");
String projectId= (String) xmMenu.get("projectId");
String mmUserid= (String) xmMenu.get("mmUserid");
String pmenuId= (String) xmMenu.get("pmenuId");
String productId= (String) xmMenu.get("productId");
String excludeIterationId= (String) xmMenu.get("excludeIterationId");
User user = LoginUtils.getCurrentUserInfo();
xmMenu.put("userid",user.getUserid());
if( !StringUtils.hasText(menuId) && !(StringUtils.hasText(projectId) || StringUtils.hasText(mmUserid)|| StringUtils.hasText(pmenuId)||menuIds!=null
|| StringUtils.hasText(productId) || StringUtils.hasText(excludeIterationId) ) ){
xmMenu.put("compete",user.getUserid());
}
List<Map<String,Object>> xmMenuList = xmMenuService.selectListMapByWhereWithPhase(xmMenu); //列出XmMenu列表
PageUtils.responePage(m, xmMenuList);
if("1".equals(xmMenu.get("withParents")) && !"1".equals(xmMenu.get("isTop"))&& xmMenuList.size()>0){
Set<String> pidPathsSet=new HashSet<>();
Set<String> idSet=new HashSet<>();
for (Map<String, Object> map : xmMenuList) {
String id= (String) map.get("menuId");
idSet.add(id);
String pidPaths= (String) map.get("pidPaths");
pidPaths=PubTool.getPidPaths(pidPaths,id);
if(pidPaths==null || pidPaths.length()<=2){
continue;
}
pidPathsSet.add(pidPaths);
}
if(pidPathsSet!=null && pidPathsSet.size()>0){
List<Map<String,Object>> parentList=xmMenuService.selectListMapByWhereWithPhase(map("pidPathsList",pidPathsSet.stream().collect(Collectors.toList())));
parentList=parentList.stream().filter(i->!idSet.contains(i.get("menuId"))).collect(Collectors.toList());
if(parentList!=null && parentList.size()>0){
xmMenuList.addAll(parentList);
m.put("total", NumberUtil.getInteger(m.get("total"),0)+parentList.size());
}
}
}
m.put("data",xmMenuList);
m.put("tips", tips);
return m;
}
/***/ /***/
@ApiOperation( value = "新增一条项目菜单表信息",notes="addXmMenu,主键如果为空,后台自动生成") @ApiOperation( value = "新增一条项目菜单表信息",notes="addXmMenu,主键如果为空,后台自动生成")
@ApiResponses({ @ApiResponses({

1
xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java

@ -106,6 +106,7 @@ public class XmTaskController {
RequestUtils.transformArray(xmTask, "ids"); RequestUtils.transformArray(xmTask, "ids");
RequestUtils.transformArray(xmTask, "skillIds"); RequestUtils.transformArray(xmTask, "skillIds");
RequestUtils.transformArray(xmTask, "tagIdList"); RequestUtils.transformArray(xmTask, "tagIdList");
RequestUtils.transformArray(xmTask, "lvls");
PageUtils.startPage(xmTask); PageUtils.startPage(xmTask);
String taskOut= (String) xmTask.get("taskOut"); String taskOut= (String) xmTask.get("taskOut");
String projectId= (String) xmTask.get("projectId"); String projectId= (String) xmTask.get("projectId");

5
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml

@ -11,6 +11,11 @@
( #{item}) ( #{item})
</foreach> </foreach>
</if> </if>
<if test=" dclasss != null"> and (res.dclass) in
<foreach collection="dclasss" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test=" pidPathsList != null"> and <if test=" pidPathsList != null"> and
<foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" > <foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" >
#{item} like concat(res.pid_paths,'%') #{item} like concat(res.pid_paths,'%')

6
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskMapper.xml

@ -11,6 +11,12 @@
( #{item}) ( #{item})
</foreach> </foreach>
</if> </if>
<if test=" lvls != null"> and (res.lvl) in
<foreach collection="lvls" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test=" pidPathsList != null"> and <if test=" pidPathsList != null"> and
<foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" > <foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" >
#{item} like concat(res.pid_paths,'%') #{item} like concat(res.pid_paths,'%')

Loading…
Cancel
Save