Browse Source

添加节点类型、标签等

master
陈裕财 4 years ago
parent
commit
39eea58335
  1. 54
      xm-core/src/main/java/com/xm/core/ctrl/XmMenuController.java
  2. 4
      xm-core/src/main/java/com/xm/core/service/XmMenuService.java
  3. 4
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml
  4. 12
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml
  5. 43
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml
  6. 8
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml

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

@ -3,6 +3,7 @@ package com.xm.core.ctrl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mdp.core.entity.Tips; import com.mdp.core.entity.Tips;
import com.mdp.core.err.BizException; import com.mdp.core.err.BizException;
import com.mdp.core.utils.BaseUtils;
import com.mdp.core.utils.NumberUtil; import com.mdp.core.utils.NumberUtil;
import com.mdp.core.utils.RequestUtils; import com.mdp.core.utils.RequestUtils;
import com.mdp.core.utils.ResponseHelper; import com.mdp.core.utils.ResponseHelper;
@ -372,8 +373,57 @@ public class XmMenuController {
m.put("tips", tips); m.put("tips", tips);
return m; return m;
} }
/***/
@ApiOperation( value = "根据主键修改一条项目菜单表信息",notes="editXmMenu")
@ApiResponses({
@ApiResponse(code = 200,response=XmMenu.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")
})
@HasQx(value = "xm_core_xmMenu_editSomeFields",name = "修改用户需求中的某些字段",categoryId = "admin-xm",categoryName = "管理端-项目管理系统")
@RequestMapping(value="/editSomeFields",method=RequestMethod.POST)
public Map<String,Object> editSomeFields(@RequestBody Map<String,Object> xmMenuMap) {
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("成功更新一条数据");
try{
List<String> menuIds= (List<String>) xmMenuMap.get("menuIds");
if(menuIds==null || menuIds.size()==0){
ResponseHelper.failed("menuIds-0","menuIds不能为空");
}
XmMenu xmMenu= BaseUtils.fromMap(xmMenuMap,XmMenu.class);
List<XmMenu> xmMenusDb=xmMenuService.selectListByIds(menuIds);
if(xmMenusDb==null ||xmMenusDb.size()==0){
ResponseHelper.failed("menus-0","该需求已不存在");
}
List<XmMenu> can=new ArrayList<>();
List<XmMenu> no=new ArrayList<>();
groupService.calcCanOpMenus(xmMenusDb,can,no);
if(can.size()<=0){
return ResponseHelper.failed("noqx","您无权修改选中的需求。");
}
Set<String> fields=new HashSet<>();
fields.add("childrenCnt");
fields.add("ntype");
fields.add("pidPaths");
for (String fieldName : xmMenuMap.keySet()) {
if(fields.contains(fieldName)){
return ResponseHelper.failed(fieldName+"-no-edit",fieldName+"不允许修改");
}
}
xmMenuService.editSomeFields(xmMenuMap);
xmRecordService.addXmMenuRecord(xmMenu.getProductId(),xmMenu.getMenuId(),"修改产品需求","修改产品需求"+xmMenu.getMenuName(),"", JSON.toJSONString(xmMenu));
//m.put("data",xmMenu);
}catch (BizException e) {
tips=e.getTips();
logger.error("",e);
}catch (Exception e) {
tips.setFailureMsg(e.getMessage());
logger.error("",e);
}
m.put("tips", tips);
return m;
}
/***/ /***/

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

@ -301,5 +301,9 @@ public class XmMenuService extends BaseService {
super.update("batchChangeParent",map("menuIds",xmMenus.stream().map(i->i.getMenuId()).collect(Collectors.toList()),"pmenuId",parentMenu.getMenuId(),"parentPidPaths",parentMenu.getPidPaths())); super.update("batchChangeParent",map("menuIds",xmMenus.stream().map(i->i.getMenuId()).collect(Collectors.toList()),"pmenuId",parentMenu.getMenuId(),"parentPidPaths",parentMenu.getPidPaths()));
xmMenuStateService.sumParents(parentMenu); xmMenuStateService.sumParents(parentMenu);
} }
public void editSomeFields(Map<String, Object> xmMenuMap) {
super.update("editSomeFields",xmMenuMap);
}
} }

4
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml

@ -27,9 +27,9 @@
<if test="productId != null and productId !='' "> and im.product_id=#{productId} </if> <if test="productId != null and productId !='' "> and im.product_id=#{productId} </if>
) )
</if> </if>
<if test=" projectId !=null and projectId!=''">
<if test=" linkProjectId !=null and linkProjectId!=''">
and exists( select 1 from xm_product_project_link ppl and exists( select 1 from xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id =res.product_id
where ppl.project_id=#{linkProjectId} and ppl.product_id =res.product_id
) )
</if> </if>
<if test="compete !=null and compete!=''"> <if test="compete !=null and compete!=''">

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

@ -172,6 +172,18 @@
res.lvl= LENGTH(replace(res.pid_paths,t1.pid_paths,concat(#{parentPidPaths},res.menu_id,',')))-LENGTH(REPLACE(replace(res.pid_paths,t1.pid_paths,concat(#{parentPidPaths},res.menu_id,',')),',',''))-1 res.lvl= LENGTH(replace(res.pid_paths,t1.pid_paths,concat(#{parentPidPaths},res.menu_id,',')))-LENGTH(REPLACE(replace(res.pid_paths,t1.pid_paths,concat(#{parentPidPaths},res.menu_id,',')),',',''))-1
</update> </update>
<update id="editSomeFields" parameterType="HashMap">
update xm_menu
<set>
<include refid="someFieldSet"/>
</set>
where menu_id in
<foreach collection="menuIds" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</update>
<!--结束 自定义sql函数区域--> <!--结束 自定义sql函数区域-->

43
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml

@ -12,15 +12,13 @@
</foreach> </foreach>
</if> </if>
<if test="key != null and key !='' "> and res.product_name like #{key} </if> <if test="key != null and key !='' "> and res.product_name like #{key} </if>
<if test=" projectId !=null and projectId!=''">
<if test=" linkProjectId !=null and linkProjectId!=''">
and exists( select 1 from xm_product_project_link ppl and exists( select 1 from xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id=res.id
where ppl.project_id=#{linkProjectId} and ppl.product_id=res.id
) )
</if> </if>
<if test=" iterationId !=null and iterationId!=''">
and exists( select 1 from xm_iteration ppl
where ppl.id=#{iterationId} and ppl.product_id=res.id
)
<if test=" linkIterationId !=null and linkIterationId!=''">
and exists( select 1 from xm_iteration ppl where ppl.product_id=res.id and ppl.id=#{linkIterationId} )
</if> </if>
<if test="compete !=null and compete!=''"> <if test="compete !=null and compete!=''">
and ( exists ( select 1 from xm_group_user gu inner join xm_task t on gu.project_id=t.project_id and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id ) and ( exists ( select 1 from xm_group_user gu inner join xm_task t on gu.project_id=t.project_id and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id )
@ -29,6 +27,9 @@
) )
</if> </if>
<if test="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if> <if test="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<if test="isTpl!=null and isTpl=='1'">
and (res.branch_id in( #{platformBranchId},#{myBranchId}) and res.is_tpl='1')
</if>
<if test="del==null or del==''"> <if test="del==null or del==''">
and res.del!="1" and res.del!="1"
</if> </if>
@ -37,36 +38,8 @@
<select id="selectListMapByWhereWithState" parameterType="HashMap" resultType="HashMap"> <select id="selectListMapByWhereWithState" parameterType="HashMap" resultType="HashMap">
select res.*,s.* from xm_product res left join xm_product_state s on res.id=s.product_id select res.*,s.* from xm_product res left join xm_product_state s on res.id=s.product_id
<where> <where>
<if test="ids != null"> and
id in
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
<include refid="whereForMap"/>
<include refid="where"/> <include refid="where"/>
<if test=" projectId !=null and projectId!=''">
and exists( select 1 from xm_product_project_link ppl
where ppl.project_id=#{projectId} and ppl.product_id=res.id
)
</if>
<if test="iterationId!=null and iterationId!=''">
and exists( select 1 from xm_iteration ipl where ipl.product_id =res.id and ipl.id=#{iterationId} )
</if>
<if test="compete !=null and compete!=''">
and ( exists ( select 1 from xm_group_user gu inner join xm_task t on gu.project_id=t.project_id and t.product_id=res.id where gu.userid=#{compete} and t.product_id=res.id )
or res.pm_userid=#{compete}
or exists ( select 1 from xm_menu m where m.mm_userid=#{compete} and m.product_id=res.id)
)
</if>
<if test="key != null and key !='' "> and res.product_name like #{key} </if>
<if test="ctimeStart!=null and ctimeEnd!=null ">and ctime between #{ctimeStart} and #{ctimeEnd}</if>
<if test="isTpl!=null and isTpl=='1'">
and (res.branch_id in( #{platformBranchId},#{myBranchId}) and res.is_tpl='1')
</if>
<if test="del==null or del==''">
and res.del!="1"
</if>
</where> </where>
</select> </select>

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

@ -49,14 +49,14 @@
<if test="myFocus != null and myFocus != ''"> <if test="myFocus != null and myFocus != ''">
and exists ( select 1 from xm_my_focus f where f.userid=#{userid} and f.project_id=res.id ) and exists ( select 1 from xm_my_focus f where f.userid=#{userid} and f.project_id=res.id )
</if> </if>
<if test=" productId !=null and productId!='' ">
<if test=" linkProductId !=null and linkProductId!='' ">
and exists( select 1 from xm_product_project_link ppl and exists( select 1 from xm_product_project_link ppl
where ppl.product_id=#{productId} and ppl.project_id=res.id
where ppl.product_id=#{linkProductId} and ppl.project_id=res.id
) )
</if> </if>
<if test="iterationId!=null and iterationId!=''">
<if test="linkIterationId!=null and linkIterationId!=''">
and exists( select 1 from xm_iteration ipl inner join xm_product_project_link l on ipl.product_id=l.product_id and exists( select 1 from xm_iteration ipl inner join xm_product_project_link l on ipl.product_id=l.product_id
where l.project_id =res.id and ipl.id=#{iterationId}
where l.project_id =res.id and ipl.id=#{linkIterationId}
) )
</if> </if>
<if test="key != null and key !='' "> and res.name like #{key} </if> <if test="key != null and key !='' "> and res.name like #{key} </if>

Loading…
Cancel
Save