103 lines
4.8 KiB
XML
103 lines
4.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.mhd.bms.domain.receiptManage.repository.mapper.ReceiptManageMapper">
|
|
|
|
|
|
|
|
<select id="queryList" parameterType="com.mhd.bms.domain.receiptManage.repository.todo.ReceiptManageDO"
|
|
resultType="com.mhd.bms.domain.receiptManage.repository.po.ReceiptManagePO">
|
|
SELECT
|
|
a.* ,
|
|
WM_CONCAT(b.bill_number) AS billNumbers
|
|
FROM
|
|
receipt_manage a
|
|
LEFT JOIN receipt_detail b ON a.receipt_manage_id = b.receipt_manage_id
|
|
WHERE
|
|
a.del_flag = 1
|
|
<include refid="common_where"/>
|
|
GROUP BY
|
|
a.receipt_manage_id
|
|
ORDER BY
|
|
a.collection_time DESC
|
|
</select>
|
|
|
|
<sql id="common_where">
|
|
<if test="receiptManageDO.createTimeStart != null and receiptManageDO.createTimeStart != ''">
|
|
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[>=]]> #{receiptManageDO.createTimeStart}
|
|
</if>
|
|
<if test="receiptManageDO.createTimeEnd != null and receiptManageDO.createTimeEnd != ''">
|
|
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{receiptManageDO.createTimeEnd}
|
|
</if>
|
|
<if test="receiptManageDO.createByName != null and receiptManageDO.createByName != ''">
|
|
AND a.create_by_name like concat('%', #{receiptManageDO.createByName}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.organizationId != null">
|
|
AND a.organization_id = #{receiptManageDO.organizationId}
|
|
</if>
|
|
<if test="receiptManageDO.topOrganizationId != null and receiptManageDO.topOrganizationId != ''">
|
|
AND a.top_organization_id = #{receiptManageDO.topOrganizationId}
|
|
</if>
|
|
<if test="receiptManageDO.updateTimeStart != null and receiptManageDO.updateTimeStart != ''">
|
|
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[>=]]> #{receiptManageDO.updateTimeStart}
|
|
</if>
|
|
<if test="receiptManageDO.updateTimeEnd != null and receiptManageDO.updateTimeEnd != ''">
|
|
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[<=]]> #{receiptManageDO.updateTimeEnd}
|
|
</if>
|
|
<if test="receiptManageDO.updateByName != null and receiptManageDO.updateByName != ''">
|
|
AND a.update_by_name like concat('%', #{receiptManageDO.updateByName}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.collectionTimeStart != null and receiptManageDO.collectionTimeStart != ''">
|
|
AND date_format(a.collection_time,'%Y-%m-%d') <![CDATA[>=]]> #{receiptManageDO.collectionTimeStart}
|
|
</if>
|
|
<if test="receiptManageDO.collectionTimeEnd != null and receiptManageDO.collectionTimeEnd != ''">
|
|
AND date_format(a.collection_time,'%Y-%m-%d') <![CDATA[<=]]> #{receiptManageDO.collectionTimeEnd}
|
|
</if>
|
|
<if test="receiptManageDO.settlementEntity != null and receiptManageDO.settlementEntity != ''">
|
|
AND a.settlement_entity like concat('%', #{receiptManageDO.settlementEntity}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.paymentCard != null and receiptManageDO.paymentCard != ''">
|
|
AND a.payment_card like concat('%', #{receiptManageDO.paymentCard}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.transactionFlow != null and receiptManageDO.transactionFlow != ''">
|
|
AND a.transaction_flow like concat('%', #{receiptManageDO.transactionFlow}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.receiptNumber != null and receiptManageDO.receiptNumber != ''">
|
|
AND a.receipt_number like concat('%', #{receiptManageDO.receiptNumber}, '%')
|
|
</if>
|
|
<if test="receiptManageDO.payeeName != null and receiptManageDO.payeeName != ''">
|
|
AND a.payee_name like concat('%', #{receiptManageDO.payeeName}, '%')
|
|
</if>
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="getDetailsByBillManageId" resultType="com.mhd.bms.domain.receiptManage.repository.po.ReceiptDetailPO" parameterType="java.lang.Long">
|
|
SELECT
|
|
a.*,
|
|
b.settlement_customers_id,
|
|
b.settlement_customers_code,
|
|
b.settlement_entity,
|
|
b.payment_method_code,
|
|
b.payment_method,
|
|
b.payment_card_id,
|
|
b.payment_card,
|
|
b.transaction_flow,
|
|
b.receipt_number,
|
|
b.collection_time,
|
|
b.receipt_voucher,
|
|
b.collection_remark,
|
|
b.payee_user_id,
|
|
b.payee_name,
|
|
b.collection_source,
|
|
(a.collected_discount+a.collected_amount) AS collectedTotaAmount
|
|
FROM
|
|
receipt_detail a
|
|
LEFT JOIN receipt_manage b ON a.receipt_manage_id = b.receipt_manage_id
|
|
WHERE
|
|
a.bill_manage_id = #{billManageId}
|
|
</select>
|
|
|
|
</mapper>
|