|
@@ -157,25 +157,21 @@
|
|
|
|
|
|
<select id="searchPage" parameterType="com.winhc.repal.model.bo.SearchBillPageBO" resultType="com.winhc.repal.entity.RepalBill">
|
|
|
SELECT bill.* FROM REPAL_BILL AS bill
|
|
|
- <if test="!param2.receivableFlag or !param2.receiptFlag">
|
|
|
- <if test="!param2.receivableFlag">
|
|
|
- LEFT JOIN REPAL_RESPONSIBLE_PERSON AS aPerson ON aPerson.REPAL_BILL_ID = bill.ID and bill.REPAL_BILL_TYPE = 1
|
|
|
- </if>
|
|
|
- <if test="!param2.receiptFlag">
|
|
|
- LEFT JOIN REPAL_RESPONSIBLE_PERSON AS bPerson ON bPerson.REPAL_BILL_ID = bill.ID and bill.REPAL_BILL_TYPE = 2
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+ LEFT JOIN REPAL_RESPONSIBLE_PERSON AS aPerson ON aPerson.REPAL_BILL_ID = bill.ID and bill.REPAL_BILL_TYPE = 1 and aPerson.DELETED = 0
|
|
|
+ LEFT JOIN REPAL_RESPONSIBLE_PERSON AS bPerson ON bPerson.REPAL_BILL_ID = bill.ID and bill.REPAL_BILL_TYPE = 2 and bPerson.DELETED = 0
|
|
|
<where>
|
|
|
- <if test="!param2.receivableFlag">
|
|
|
- aPerson.USER_ID = #{param2.userId} and aPerson.DELETED = 0 AND
|
|
|
- </if>
|
|
|
- <if test="!param2.receiptFlag">
|
|
|
- bPerson.USER_ID = #{param2.userId} and bPerson.DELETED = 0 AND
|
|
|
+ <if test="!param2.allFlag">
|
|
|
+ <if test="!param2.receivableFlag and param2.receiptFlag">
|
|
|
+ (aPerson.USER_ID = #{param2.userId} or bPerson.USER_ID is not null)
|
|
|
+ </if>
|
|
|
+ <if test="!param2.receiptFlag and param2.receivableFlag">
|
|
|
+ (bPerson.USER_ID = #{param2.userId} or aPerson.USER_ID is not null)
|
|
|
+ </if>
|
|
|
</if>
|
|
|
AND bill.REPAL_BOOK_ID = #{param2.repalBookId}
|
|
|
AND bill.REPAL_GROUP_ID = #{param2.repalGroupId}
|
|
|
AND bill.DELETED = 0
|
|
|
- <if test="param2.keyword != null and param2.keyword != ''">
|
|
|
+ <if test='param2.keyword != null'>
|
|
|
AND bill.CUSTOMER_NAME LIKE concat('%', #{param2.keyword}, '%')
|
|
|
</if>
|
|
|
</where>
|