Commit 9739ec4f439c02ae9b888bb243ee79eb86c3166d

Authored by 房远帅
1 parent 846fd5d5

楚江ERP:客户资信、客户开发选择客户数据过滤

@@ -28,4 +28,10 @@ public class QueryCustomerVo extends SortPageVo implements BaseVo, Serializable @@ -28,4 +28,10 @@ public class QueryCustomerVo extends SortPageVo implements BaseVo, Serializable
28 */ 28 */
29 @ApiModelProperty("状态") 29 @ApiModelProperty("状态")
30 private Boolean available; 30 private Boolean available;
  31 +
  32 + /**
  33 + * 来源
  34 + */
  35 + @ApiModelProperty("来源")
  36 + private String source;
31 } 37 }
@@ -69,6 +69,27 @@ @@ -69,6 +69,27 @@
69 <if test="vo.available != null"> 69 <if test="vo.available != null">
70 AND c.available = #{vo.available} 70 AND c.available = #{vo.available}
71 </if> 71 </if>
  72 + <choose>
  73 + <when test="vo.source == 'CUSTOMER_CREDIT'">
  74 + AND NOT EXISTS (
  75 + SELECT 1
  76 + FROM customer_credit cc
  77 + WHERE cc.company_id = c.id
  78 + AND cc.status != 'CANCEL'
  79 + )
  80 + </when>
  81 + <when test="vo.source == 'CUSTOMER_DEVELOP'">
  82 + AND NOT EXISTS (
  83 + SELECT 1
  84 + FROM customer_develop_plan cdp
  85 + WHERE cdp.customer_id = c.id
  86 + AND cdp.status != 'CANCEL'
  87 + )
  88 + </when>
  89 + <otherwise>
  90 + AND 1 = 1 <!-- 确保查询到任何数据 -->
  91 + </otherwise>
  92 + </choose>
72 </if> 93 </if>
73 </where> 94 </where>
74 ORDER BY c.code 95 ORDER BY c.code
@@ -99,14 +120,27 @@ @@ -99,14 +120,27 @@
99 <if test="vo.available != null"> 120 <if test="vo.available != null">
100 AND c.available = #{vo.available} 121 AND c.available = #{vo.available}
101 </if> 122 </if>
102 - <if test="vo.source == 'CUSTOMER_CREDIT'">  
103 - AND NOT EXISTS (  
104 - SELECT 1  
105 - FROM customer_credit cc  
106 - WHERE cc.company_id = c.id  
107 - AND cc.status != 'CANCEL'  
108 - )  
109 - </if> 123 + <choose>
  124 + <when test="vo.source == 'CUSTOMER_CREDIT'">
  125 + AND NOT EXISTS (
  126 + SELECT 1
  127 + FROM customer_credit cc
  128 + WHERE cc.company_id = c.id
  129 + AND cc.status != 'CANCEL'
  130 + )
  131 + </when>
  132 + <when test="vo.source == 'CUSTOMER_DEVELOP'">
  133 + AND NOT EXISTS (
  134 + SELECT 1
  135 + FROM customer_develop_plan cdp
  136 + WHERE cdp.customer_id = c.id
  137 + AND cdp.status != 'CANCEL'
  138 + )
  139 + </when>
  140 + <otherwise>
  141 + AND 1 = 1 <!-- 确保查询到任何数据 -->
  142 + </otherwise>
  143 + </choose>
110 </if> 144 </if>
111 </where> 145 </where>
112 ORDER BY c.code 146 ORDER BY c.code