Showing
2 changed files
with
48 additions
and
8 deletions
| ... | ... | @@ -69,6 +69,27 @@ |
| 69 | 69 | <if test="vo.available != null"> |
| 70 | 70 | AND c.available = #{vo.available} |
| 71 | 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 | 93 | </if> |
| 73 | 94 | </where> |
| 74 | 95 | ORDER BY c.code |
| ... | ... | @@ -99,14 +120,27 @@ |
| 99 | 120 | <if test="vo.available != null"> |
| 100 | 121 | AND c.available = #{vo.available} |
| 101 | 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 | 144 | </if> |
| 111 | 145 | </where> |
| 112 | 146 | ORDER BY c.code | ... | ... |