陈裕财 2 years ago
parent
commit
a1ed9fc51c
  1. 9
      xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java
  2. 58
      xm-core/src/main/java/com/xm/core/mapper/XmMenuMapper.xml
  3. 15
      xm-core/src/main/java/com/xm/core/mapper/XmProjectMapper.xml
  4. 11
      xm-core/src/main/java/com/xm/core/service/XmMenuService.java

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

@ -162,11 +162,12 @@ public class XmMenuController {
RequestUtils.transformArray(params, "menuIds");
RequestUtils.transformArray(params, "tagIdList");
RequestUtils.transformArray(params, "dclasss");
RequestUtils.transformArray(params, "dclasss");
IPage page=QueryTools.initPage(params);
this.paramsInit(params);
List<Map<String,Object>> datas = xmMenuService.selectListMapByWhereWithState(params); //列出XmMenu列表
QueryWrapper<XmMenu> qw = QueryTools.initQueryWrapper(XmMenu.class , params);
this.paramsInit(params);
List<Map<String,Object>> datas = xmMenuService.selectListMapByWhereWithState(page,qw,params); //列出XmMenu列表
if("1".equals(params.get("withParents")) && !"1".equals(params.get("isTop"))&& datas.size()>0){
Set<String> pidPathsSet=new HashSet<>();
@ -182,7 +183,7 @@ public class XmMenuController {
}
List<String> menusIds=pidPathsSet.stream().filter(i->!originIdSet.contains(i)).collect(Collectors.toList());
if(menusIds!=null && menusIds.size()>0){
List<Map<String,Object>> parentList=xmMenuService.selectListMapByWhereWithState(map("menuIds",menusIds));
List<Map<String,Object>> parentList=xmMenuService.selectListMapByWhereWithState(QueryTools.initPage(),QueryTools.initQueryWrapper(XmMenu.class),map("menuIds",menusIds));
if(parentList!=null && parentList.size()>0){
datas.addAll(parentList);
return Result.ok("query-ok","查询成功").setData(datas).setTotal(page.getTotal()+parentList.size()); //列出XmMenu列表

58
xm-core/src/main/java/com/xm/core/mapper/XmMenuMapper.xml

@ -16,55 +16,55 @@
</select>
<sql id="whereForMap">
<if test=" menuIds != null"> and (res.menu_id) in
<foreach collection="menuIds" item="item" index="index" open="(" separator="," close=")" >
<if test="ext.menuIds != null"> and (res.menu_id) in
<foreach collection="ext.menuIds" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test=" dclasss != null"> and (res.dclass) in
<foreach collection="dclasss" item="item" index="index" open="(" separator="," close=")" >
<if test="ext.dclasss != null"> and (res.dclass) in
<foreach collection="ext.dclasss" item="item" index="index" open="(" separator="," close=")" >
( #{item})
</foreach>
</if>
<if test="pidPathsLike">
and res.pid_paths like concat(#{pidPathsLike},'%')
<if test="ext.pidPathsLike">
and res.pid_paths like concat(#{ext.pidPathsLike},'%')
</if>
<if test=" pidPathsList != null"> and
<foreach collection="pidPathsList" item="item" index="index" open="(" separator=" or " close=")" >
<if test="ext.pidPathsList != null"> and
<foreach collection="ext.pidPathsList" item="item" index="index" open="(" separator=" or " close=")" >
#{item} like concat(res.pid_paths,'%')
</foreach>
</if>
<if test=" tagIdList != null"> and
<foreach collection="tagIdList" item="item" index="index" open="(" separator=" or " close=")" >
<if test="ext.tagIdList != null"> and
<foreach collection="ext.tagIdList" item="item" index="index" open="(" separator=" or " close=")" >
find_in_set(#{item},res.tag_ids)
</foreach>
</if>
<if test=' iterationFilterType!=null and iterationFilterType!=""'>
<if test='iterationFilterType=="not-join-any-iteration"'> and (res.iteration_id is null ) </if>
<if test='iterationFilterType=="join-any-iteration"'> and ( res.iteration_id is not null ) </if>
<if test='iterationFilterType=="join-curr-iteration"'> and res.iteration_id=#{filterIterationId} </if>
<if test='iterationFilterType=="not-join-curr-iteration"'> and (res.iteration_id!=#{filterIterationId} or res.iteration_id is null) </if>
<if test='ext.iterationFilterType!=null and ext.iterationFilterType!=""'>
<if test='ext.iterationFilterType=="not-join-any-iteration"'> and (res.iteration_id is null ) </if>
<if test='ext.iterationFilterType=="join-any-iteration"'> and ( res.iteration_id is not null ) </if>
<if test='ext.iterationFilterType=="join-curr-iteration"'> and res.iteration_id=#{ext.filterIterationId} </if>
<if test='ext.iterationFilterType=="not-join-curr-iteration"'> and (res.iteration_id!=#{ext.filterIterationId} or res.iteration_id is null) </if>
</if>
<if test=' taskFilterType!=null and taskFilterType!="" '>
<if test='taskFilterType=="not-join-curr-project"'>
and not exists(select 1 from xm_task t where t.menu_id=res.menu_id and t.project_id=#{projectId})
<if test='ext.taskFilterType!=null and ext.taskFilterType!="" '>
<if test='ext.taskFilterType=="not-join-curr-project"'>
and not exists(select 1 from xm_task t where t.menu_id=res.menu_id and t.project_id=#{ext.projectId})
</if>
<if test='taskFilterType=="not-join-any-project"'>
<if test='ext.taskFilterType=="not-join-any-project"'>
and not exists(select 1 from xm_task t where t.menu_id=res.menu_id)
</if>
<if test='taskFilterType=="join-any-project"'>
<if test='ext.taskFilterType=="join-any-project"'>
and exists(select 1 from xm_task t where t.menu_id=res.menu_id)
</if>
<if test='taskFilterType=="join-curr-project"'>
and exists(select 1 from xm_task t where t.menu_id=res.menu_id and t.project_id=#{projectId})
<if test='ext.taskFilterType=="join-curr-project"'>
and exists(select 1 from xm_task t where t.menu_id=res.menu_id and t.project_id=#{ext.projectId})
</if>
</if>
<if test=" planStartTimeStart !=null "> and res.start_time &gt; #{planStartTimeStart} </if>
<if test=" planStartTimeEnd !=null "> and res.start_time &lt; #{planStartTimeEnd} </if>
<if test=" planEndTimeStart !=null "> and res.end_time &gt; #{planEndTimeStart} </if>
<if test=" planEndTimeEnd !=null "> and res.end_time &lt; #{planEndTimeEnd} </if>
<if test="key != null and key !='' "> and res.menu_name like #{key} </if>
<if test="isTop!=null and isTop!=''"> and (res.pmenu_id is null )</if>
<if test="ext.planStartTimeStart !=null "> and res.start_time &gt; #{ext.planStartTimeStart} </if>
<if test="ext.planStartTimeEnd !=null "> and res.start_time &lt; #{ext.planStartTimeEnd} </if>
<if test="ext.planEndTimeStart !=null "> and res.end_time &gt; #{ext.planEndTimeStart} </if>
<if test="ext.planEndTimeEnd !=null "> and res.end_time &lt; #{ext.planEndTimeEnd} </if>
<if test="ext.key != null and ext.key !='' "> and res.menu_name like #{ext.key} </if>
<if test="ext.isTop!=null and ext.isTop!=''"> and (res.pmenu_id is null )</if>
</sql>
<select id="selectExistIterationMenus" parameterType="HashMap" resultType="com.xm.core.entity.XmMenu">
@ -92,7 +92,7 @@
${@com.mdp.Util@trimGroupBy(ew.customSqlSegment,'')}
</select>
<select id="selectListMapByWhereWithPlan" parameterType="HashMap" resultType="HashMap">
select res.*,plan.* from xm_menu res left join xm_menu_plan plan on res.menu_id=plan.menu_id and plan.project_id=#{projectId}
select res.*,plan.* from xm_menu res left join xm_menu_plan plan on res.menu_id=plan.menu_id and plan.project_id=#{ext.projectId}
<where>
${@com.mdp.Util@trimWhere(ew.customSqlSegment)}
<!--下面可以添加更多查询条件,正常的if 条件都是支持的-->

15
xm-core/src/main/java/com/xm/core/mapper/XmProjectMapper.xml

@ -36,21 +36,6 @@
<if test="ext.hideStatus != null and ext.hideStatus != ''">
and res.status != #{ext.hideStatus}
</if>
<!-- 我参与的 包括我创建的,我监控的,我审核的-->
<if test="ext.compete !=null and ext.compete !='' ">
and ( exists ( select 1 from xm_group g,XM.xm_group_user gu where gu.group_id=g.id and gu.userid=#{ext.userid} and g.project_id=res.id )
or res.create_userid=#{ext.compete} or res.pm_userid=#{ext.compete} or res.adm_userid=#{ext.compete} or res.ass_userid=#{ext.compete}
)
</if>
<!-- 按参与角色查询等-->
<if test="ext.pgTypeIds != null ">
and exists ( select 1 from xm_group g,XM.xm_group_user gu where gu.group_id=g.id and gu.userid=#{ext.userid} and g.project_id=res.id
and g.pg_type_id in
<foreach collection="ext.pgTypeIds" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
)
</if>
<if test="ext.myExecuserStatus != null and ext.myExecuserStatus != ''">
and exists ( select 1 from xm_task_execuser exe where exe.project_id=res.id and exe.userid=#{ext.userid}

11
xm-core/src/main/java/com/xm/core/service/XmMenuService.java

@ -45,22 +45,19 @@ public class XmMenuService extends BaseService<XmMenuMapper,XmMenu> {
/**
* 连同功能关联的项目需求计划数据一起带出
*
* @param params
* @return
*/
public List<Map<String, Object>> selectListMapByWhereWithPlan(Map<String, Object> params) {
return baseMapper.selectListMapByWhereWithPlan(QueryTools.initPage(params),QueryTools.initQueryWrapper(XmMenu.class,params),params);
public List<Map<String, Object>> selectListMapByWhereWithPlan(IPage page, QueryWrapper ew, Map<String,Object> ext) {
return baseMapper.selectListMapByWhereWithPlan(page,ew,ext);
}
/**
* 连同功能关联的状态数据一起带出
*
* @param params
* @return
*/
public List<Map<String, Object>> selectListMapByWhereWithState(Map<String, Object> params) {
public List<Map<String, Object>> selectListMapByWhereWithState(IPage page, QueryWrapper ew, Map<String,Object> ext) {
return baseMapper.selectListMapByWhereWithState(QueryTools.initPage(params),QueryTools.initQueryWrapper(XmMenu.class,params),params);
return baseMapper.selectListMapByWhereWithState(page,ew,ext);
}
/**

Loading…
Cancel
Save