Browse Source

优化查询条件

master
陈裕财 5 years ago
parent
commit
0cb7f9e2a8
  1. 15
      xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java
  2. 2
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMenuMapper.xml
  3. 8
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml
  4. 3
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml

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

@ -68,6 +68,21 @@ public class XmMenuController {
Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(xmMenu, "menuIds");
PageUtils.startPage(xmMenu);
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.selectListMapByWhere(xmMenu); //列出XmMenu列表
PageUtils.responePage(m, xmMenuList);
m.put("data",xmMenuList);

2
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMenuMapper.xml

@ -23,7 +23,7 @@
</foreach>
</if>
<include refid="where"/>
<if test="key != null and key !='' "> m.menu_name like #{key} </if>
<if test="key != null and key !='' "> and m.menu_name like #{key} </if>
</where>
</select>

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

@ -78,9 +78,11 @@
</foreach>
</if>
<include refid="where"/>
<if test="key != null and key !='' "> </if>
<if test=" excludeIterationId !=null and excludeIterationId !='' "> and not exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=#{excludeIterationId} and im.menu_id=res.menu_id)</if>
<if test="key != null and key !='' "> and res.menu_name like #{key} </if>
<if test=" excludeIterationId !=null and excludeIterationId !='' and (includeIterationAll==null or includeIterationAll=='') "> and not exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=#{excludeIterationId} and im.menu_id=res.menu_id)</if>
<if test=" includeIterationAll !=null and includeIterationAll !='' and (excludeIterationId !=null and excludeIterationId !='' ) "> and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id !=#{excludeIterationId} and im.menu_id=res.menu_id)</if>
<if test=" includeIterationAll !=null and includeIterationAll !='' and (excludeIterationId ==null or excludeIterationId =='' ) "> and exists ( select 1 from XM.xm_iteration_menu im where im.menu_id=res.menu_id)</if>
</where>
order by res.seq_no asc
</select>

3
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml

@ -69,6 +69,9 @@
#{item}
</foreach>
</if>
<if test=" createTimeStart !=null "> and res.create_time &gt; #{createTimeStart} </if>
<if test=" createTimeEnd !=null "> and res.create_time &lt; #{createTimeEnd} </if>
<include refid="where"/>
<!-- 筛选属于当前年份的项目 -->

Loading…
Cancel
Save