Browse Source

产品项目关联关系

master
陈裕财 5 years ago
parent
commit
9657558761
  1. 14
      xm-core/src/main/java/com/xm/core/ctrl/XmProjectGroupController.java
  2. 5
      xm-core/src/main/java/com/xm/core/service/XmProductProjectLinkService.java
  3. 45
      xm-core/src/main/java/com/xm/core/service/XmProjectGroupService.java
  4. 5
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProductProjectLinkMapper.xml
  5. 8
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmProjectPhaseMapper.xml

14
xm-core/src/main/java/com/xm/core/ctrl/XmProjectGroupController.java

@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -98,7 +99,18 @@ public class XmProjectGroupController {
Map<String,Object> m = new HashMap<>();
RequestUtils.transformArray(params, "ids");
PageUtils.startPage(params);
List<XmProjectGroupVo> xmProjectGroupList = xmProjectGroupService.getProjectGroupVoList((String) params.get("projectId")); //列出XmProjectGroup列表
List<XmProjectGroupVo> xmProjectGroupList=new ArrayList<>();
String iterationId= (String) params.get("iterationId");
String projectId= (String) params.get("projectId");
String productId= (String) params.get("productId");
if(StringUtils.hasText(projectId)){
xmProjectGroupList = xmProjectGroupService.getProjectGroupVoList(projectId); //列出XmProjectGroup列表
}else if(StringUtils.hasText(iterationId)){
xmProjectGroupList = xmProjectGroupService.getProjectGroupVoListByIterationId(iterationId ); //列出XmProjectGroup列表
} if(StringUtils.hasText(productId)){
xmProjectGroupList = xmProjectGroupService.getProjectGroupVoListByProductId( productId); //列出XmProjectGroup列表
}
PageUtils.responePage(m, xmProjectGroupList);
m.put("data",xmProjectGroupList);
Tips tips=new Tips("查询成功");

5
xm-core/src/main/java/com/xm/core/service/XmProductProjectLinkService.java

@ -15,7 +15,10 @@ import com.xm.core.entity.XmProductProjectLink;
@Service("xm.core.xmProductProjectLinkService")
public class XmProductProjectLinkService extends BaseService {
static Logger logger =LoggerFactory.getLogger(XmProductProjectLinkService.class);
/** 请在此类添加自定义函数 */
List<XmProductProjectLink> selectListByIterationId(String iterationId){
List<XmProductProjectLink> data=super.selectList("selectListByIterationId",iterationId);
return data;
}
}

45
xm-core/src/main/java/com/xm/core/service/XmProjectGroupService.java

@ -6,9 +6,7 @@ import com.mdp.core.err.BizException;
import com.mdp.core.service.BaseService;
import com.mdp.safe.client.entity.User;
import com.mdp.safe.client.utils.LoginUtils;
import com.xm.core.entity.XmProject;
import com.xm.core.entity.XmProjectGroup;
import com.xm.core.entity.XmProjectGroupUser;
import com.xm.core.entity.*;
import com.xm.core.service.cache.XmProjectGroupCacheService;
import com.xm.core.service.push.XmPushMsgService;
import com.xm.core.vo.XmProjectGroupVo;
@ -43,6 +41,11 @@ public class XmProjectGroupService extends BaseService {
@Autowired
XmProjectGroupCacheService groupCacheService;
@Autowired
XmIterationProductLinkService xmIterationProductLinkService;
@Autowired
XmProductProjectLinkService xmProductProjectLinkService;
@Autowired
private XmProjectService xmProjectService;
@ -686,5 +689,41 @@ public class XmProjectGroupService extends BaseService {
return false;
}
public List<XmProjectGroupVo> getProjectGroupVoListByIterationId(String iterationId) {
List<XmProductProjectLink> list=this.xmProductProjectLinkService.selectListByIterationId(iterationId);
List<XmProjectGroupVo> datas=new ArrayList<>();
if(list!=null && list.size()>0){
for (XmProductProjectLink productProjectLink : list) {
List<XmProjectGroupVo> data0=this.getProjectGroupVoList(productProjectLink.getProjectId());
if(data0!=null && data0.size()>0){
datas.addAll(data0);
}
}
}
return datas;
}
/**
* 根据产品编号查询团队
* @param productId
* @return
*/
public List<XmProjectGroupVo> getProjectGroupVoListByProductId(String productId) {
XmProductProjectLink xmProductProjectLink=new XmProductProjectLink();
xmProductProjectLink.setProductId(productId);
List<XmProductProjectLink> list=this.xmProductProjectLinkService.selectListByWhere(xmProductProjectLink);
List<XmProjectGroupVo> datas=new ArrayList<>();
if(list!=null && list.size()>0){
for (XmProductProjectLink productProjectLink : list) {
List<XmProjectGroupVo> data0=this.getProjectGroupVoList(productProjectLink.getProjectId());
if(data0!=null && data0.size()>0){
datas.addAll(data0);
}
}
}
return datas;
}
}

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

@ -6,7 +6,10 @@
<!--开始 自定sql函数区域 -->
<!--请在此区域添加自定义函数-->
<select id="selectListByIterationId" parameterType="String" resultType="com.xm.core.entity.XmProductProjectLink">
select * from XM.xm_product_project_link res
where exists (select 1 from XM.xm_iteration_product_link ipl where ipl.iteration_id=#{iterationId} and ipl.product_id=res.product_id)
</select>
<!--结束 自定义sql函数区域-->

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

@ -65,11 +65,15 @@
</foreach>
</if>
<include refid="where"/>
<if test="key != null and key !='' "> </if>
</where>
<if test='iterationId!=null and iterationId!="" '>
and exists( select 1 from xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id where t.project_phase_id=res.id and im.iteration_id=#{iterationId})
</if>
<if test='productId!=null and productId!="" '>
and exists( select 1 from xm_task t where t.product_id=#{productId})
</if>
<if test="key != null and key !='' "> </if>
</where>
order by res.seq_no asc
</select>

Loading…
Cancel
Save