Showing
1 changed file
with
9 additions
and
8 deletions
| ... | ... | @@ -84,17 +84,18 @@ |
| 84 | 84 | <if test="vo.principalId != null and vo.principalId != ''"> |
| 85 | 85 | AND tb.principal_id = #{vo.principalId} |
| 86 | 86 | </if> |
| 87 | - <choose> | |
| 88 | - <when test="purchaseDepartmentList != null and purchaseDepartmentList.size() > 0"> | |
| 89 | - AND tb.purchase_department IN | |
| 87 | + <if test="(purchaseDepartmentList != null and purchaseDepartmentList.size() > 0) or userId != null"> | |
| 88 | + AND ( | |
| 89 | + <if test="purchaseDepartmentList != null and purchaseDepartmentList.size() > 0"> | |
| 90 | + tb.purchase_department IN | |
| 90 | 91 | <foreach collection="purchaseDepartmentList" item="item" open="(" separator="," close=")"> |
| 91 | 92 | #{item} |
| 92 | 93 | </foreach> |
| 93 | - </when> | |
| 94 | - <otherwise> | |
| 95 | - AND tb.principal_id = #{userId} | |
| 96 | - </otherwise> | |
| 97 | - </choose> | |
| 94 | + OR | |
| 95 | + </if> | |
| 96 | + tb.principal_id = #{userId} | |
| 97 | + ) | |
| 98 | + </if> | |
| 98 | 99 | </where> |
| 99 | 100 | ORDER BY tb.create_time DESC, tb.id DESC |
| 100 | 101 | </select> | ... | ... |