diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java index 41d8f303..1f924388 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java @@ -177,30 +177,9 @@ public class XmIterationController { xmIteration.setIstatus("0"); xmIteration.setAdminUserid(user.getUserid()); xmIteration.setAdminUsername(user.getUsername()); - if(xmIteration.getLinks()!=null && xmIteration.getLinks().size()>0){ - for (XmIterationLink link : xmIteration.getLinks()) { - link.setIterationId(xmIteration.getId()); - link.setCtime(new Date()); - link.setLinkStatus("1"); - link.setCuserid(user.getUserid()); - link.setCusername(user.getUsername()); - if(!StringUtils.hasText(link.getLtype())){ - return ResponseHelper.failed("ltype-0","关联类型不能为空"); - } - - if("1".equals(link.getLtype())){ - if(!xmGroupService.checkUserIsProductAdm(link.getProId(),user.getUserid())){ - return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品与迭代关联"); - }; - }else if("0".equals(link.getLtype())){ - if(!xmGroupService.checkUserIsProjectAdm(link.getProId(),user.getUserid())){ - return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目与迭代关联"); - }; - }else{ - return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); - } - } - } + if(!xmGroupService.checkUserIsPmOrAssByPtype(user.getUserid(),"1",null,xmIteration.getProductId() )){ + return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品与迭代关联"); + }; xmIterationService.addIteration(xmIteration); xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-新增","新增迭代"+xmIteration.getIterationName()); m.put("data",xmIteration); diff --git a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java index deea3ed4..f32fa429 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java @@ -49,7 +49,10 @@ public class XmIterationService extends BaseService { @Transactional public void addIteration(XmIterationVo xmIteration) { super.insert(xmIteration); - this.xmIterationLinkService.batchInsert(xmIteration.getLinks()); + if(xmIteration.getLinks()!=null && xmIteration.getLinks().size()>0){ + + this.xmIterationLinkService.batchInsert(xmIteration.getLinks()); + } } diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml index 3359f733..2ff17662 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml @@ -16,16 +16,16 @@ diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml index a0df13dd..bfd42a8a 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductMapper.xml @@ -18,8 +18,8 @@ ) - and exists( select 1 from xm_iteration_link ppl - where ppl.iteration_id=#{iterationId} and ppl.product_id=res.id + and exists( select 1 from xm_iteration ppl + where ppl.id=#{iterationId} and ppl.product_id=res.id ) @@ -50,7 +50,7 @@ ) - and exists( select 1 from xm_iteration_link ipl where ipl.pro_id =res.id and ipl.iteration_id=#{iterationId} ) + and exists( select 1 from xm_iteration ipl where ipl.product_id =res.id and ipl.id=#{iterationId} ) 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 ) diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml index ad1c1fda..cee6a091 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml @@ -8,7 +8,7 @@ diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml index f21a9cee..ca29f24c 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectMapper.xml @@ -55,8 +55,8 @@ ) - and exists( select 1 from xm_iteration_link ipl - where ipl.pro_id =res.id and ipl.iteration_id=#{iterationId} and ipl.ltype='0' + 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} ) and res.name like #{key}