diff --git a/xm-core/src/main/java/com/xm/core/entity/XmProductProjectLink.java b/xm-core/src/main/java/com/xm/core/entity/XmProductProjectLink.java index 2053a9ed..957e74a6 100644 --- a/xm-core/src/main/java/com/xm/core/entity/XmProductProjectLink.java +++ b/xm-core/src/main/java/com/xm/core/entity/XmProductProjectLink.java @@ -11,7 +11,7 @@ import java.util.Date; * 表 XM.xm_product_project_link 产品与项目的关联关系表,一般由产品经理挂接项目到产品上的所有字段名:
* project_id,product_id,ctime,cuserid,cusername,link_status;
* 当前主键(包括多主键):
- * project_id;
+ * project_id,product_id;
*/ @ApiModel(description="产品与项目的关联关系表,一般由产品经理挂接项目到产品上") public class XmProductProjectLink implements java.io.Serializable { @@ -20,10 +20,10 @@ public class XmProductProjectLink implements java.io.Serializable { @ApiModelProperty(notes="项目表中的主键,主键",allowEmptyValue=true,example="",allowableValues="") String projectId; - - @ApiModelProperty(notes="产品表中的主键",allowEmptyValue=true,example="",allowableValues="") + @ApiModelProperty(notes="产品表中的主键,主键",allowEmptyValue=true,example="",allowableValues="") String productId; + @ApiModelProperty(notes="创建时间",allowEmptyValue=true,example="",allowableValues="") Date ctime; @@ -37,9 +37,10 @@ public class XmProductProjectLink implements java.io.Serializable { @ApiModelProperty(notes="关联状态1关联0取消关联",allowEmptyValue=true,example="",allowableValues="") String linkStatus; - /**项目表中的主键**/ - public XmProductProjectLink(String projectId) { + /**项目表中的主键,产品表中的主键**/ + public XmProductProjectLink(String projectId,String productId) { this.projectId = projectId; + this.productId = productId; } /**产品与项目的关联关系表,一般由产品经理挂接项目到产品上**/ diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml index 6a494a83..cc7efff5 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationMapper.xml @@ -24,15 +24,22 @@ and res.online_time > #{onlineTimeStart} and res.online_time < #{onlineTimeEnd} - - and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id + + and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id and im.menu_id=#{menuId} and im.product_id=#{productId} - and im.menu_id=#{menuId} ) + + + and exists ( select 1 from xm_iteration_product_link ipl + where ipl.iteration_id=res.id and ipl.product_id=#{productId} + ) + - and exists( select 1 from XM.xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id - where t.project_id=#{projectId} and im.iteration_id =res.id + and exists( select 1 from XM.xm_iteration_product_link ipl inner join XM.xm_product_project_link ppl + on ipl.product_id=ppl.product_id + where ppl.project_id=#{projectId} and ipl.iteration_id =res.id + and ipl.product_id=#{productId} ) @@ -58,14 +65,29 @@ #{item} + and res.ctime > #{createTimeStart} + and res.ctime < #{createTimeEnd} + and res.online_time > #{onlineTimeStart} + and res.online_time < #{onlineTimeEnd} + + and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id and im.menu_id=#{menuId} + and im.product_id=#{productId} + ) + - - and exists ( select 1 from XM.xm_iteration_menu im where im.iteration_id=res.id - and im.product_id=#{productId} - and im.menu_id=#{menuId} - ) - + + and exists ( select 1 from xm_iteration_product_link ipl + where ipl.iteration_id=res.id and ipl.product_id=#{productId} + ) + + + and exists( select 1 from XM.xm_iteration_product_link ipl inner join XM.xm_product_project_link ppl + on ipl.product_id=ppl.product_id + where ppl.project_id=#{projectId} and ipl.iteration_id =res.id + and ipl.product_id=#{productId} + ) + and ( res.admin_userid=#{compete} or exists (select 1 from XM.xm_iteration_menu im left join xm.xm_menu m on im.product_id=m.product_id where m.mm_userid=#{compete} and im.iteration_id=res.id) 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 ced28165..b0577b34 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 @@ -16,16 +16,20 @@ - and exists (select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and t.project_id=#{projectId} where t.project_id=#{projectId} and m.product_id=res.id) - + + and exists( select 1 from XM.xm_product_project_link ppl + where ppl.project_id=#{projectId} and ppl.product_id=res.id + ) + + + and exists( select 1 from xm_iteration_product_link ipl where ipl.product_id =res.id and ipl.iteration_id=#{iterationId} ) + + and ( exists ( select 1 from xm_project_group_user gu inner join XM.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) ) - - and exists( select 1 from xm_iteration_menu im where im.product_id =res.id and im.iteration_id=#{iterationId} ) - and res.product_name like #{key} @@ -46,8 +50,12 @@ and res.product_name like #{key} - and exists (select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and t.project_id=#{projectId} where t.project_id=#{projectId} and m.product_id=res.id) - + + and exists( select 1 from XM.xm_product_project_link ppl + where ppl.project_id=#{projectId} and ppl.product_id=res.id + ) + + and ( exists ( select 1 from xm_project_group_user gu inner join XM.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) 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 8bd2e863..ef4f8ece 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 @@ -40,6 +40,7 @@ select * from XM.xm_product_project_link res where res.project_id = #{projectId} + and res.product_id = #{productId} @@ -47,6 +48,7 @@ select * from XM.xm_product_project_link res where res.project_id = #{projectId} + and res.product_id = #{productId} - - + + insert into XM.xm_product_project_link( ) values ( @@ -75,7 +77,7 @@ delete from XM.xm_product_project_link - where project_id = #{projectId} + where project_id = #{projectId} and product_id = #{productId} @@ -84,7 +86,7 @@ - where project_id = #{projectId} + where project_id = #{projectId} and product_id = #{productId} @@ -93,7 +95,7 @@ - where project_id = #{projectId} + where project_id = #{projectId} and product_id = #{productId} delete from XM.xm_product_project_link where - (project_id) + (project_id, product_id) in - ( #{item.projectId} + ( #{item.projectId}, #{item.productId} ) @@ -139,14 +141,12 @@ - product_id = #{productId}, ctime = #{ctime}, cuserid = #{cuserid}, cusername = #{cusername}, link_status = #{linkStatus} - product_id = #{productId}, ctime = #{ctime}, cuserid = #{cuserid}, cusername = #{cusername}, @@ -154,7 +154,6 @@ - product_id = #{item.productId}, ctime = #{item.ctime}, cuserid = #{item.cuserid}, cusername = #{item.cusername}, 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 282b2875..c0f6ff49 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 @@ -115,15 +115,15 @@ and exists ( select 1 from XM.xm_my_focus f where f.userid=#{userid} and f.project_id=res.id ) - - and exists ( select 1 from XM.xm_task t left join XM.xm_menu m on t.menu_id=m.menu_id and m.product_id=#{productId} - where m.product_id=#{productId} and t.project_id=res.id + + and exists( select 1 from XM.xm_product_project_link ppl + where ppl.product_id=#{productId} and ppl.project_id=res.id ) - - - and exists( select 1 from XM.xm_task t inner join xm_iteration_menu im on t.menu_id=im.menu_id - where t.project_id=res.id and im.iteration_id =#{iterationId} + + and exists( select 1 from xm_iteration_product_link ipl inner join xm_product_project ppl + on ipl.product_id=ppl.product_id + where ipl.product_id =res.id and ipl.iteration_id=#{iterationId} ) and res.name like #{key}