198 lines
9.6 KiB
XML
198 lines
9.6 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.linke.finance.domain.reconciliation.repository.mapper.ReconciliationMapper">
|
|
|
|
<resultMap type="com.linke.finance.domain.reconciliation.repository.po.ReconciliationPO" id="ReconciliationResult">
|
|
<result property="reconciliationId" column="reconciliation_id" />
|
|
<result property="verificationMoney" column="verification_money" />
|
|
<result property="settlementCount" column="settlement_count" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="shipperName" column="shipper_name" />
|
|
<result property="waybillSource" column="waybill_source" />
|
|
<result property="waybillSourceName" column="waybill_source_name" />
|
|
<result property="reconciliationStart" column="reconciliation_start" />
|
|
<result property="reconciliationEnd" column="reconciliation_end" />
|
|
<result property="billName" column="bill_name" />
|
|
<result property="collectionAmount" column="collection_amount" />
|
|
<result property="changeAmount" column="change_amount" />
|
|
<result property="otherAmount" column="other_amount" />
|
|
<result property="receivable" column="receivable" />
|
|
<result property="actualReceivable" column="actual_receivable" />
|
|
<result property="uncollectedReceivable" column="uncollected_receivable" />
|
|
<result property="collectionState" column="collection_state" />
|
|
<result property="auditState" column="audit_state" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createByName" column="create_by_name" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateByName" column="update_by_name" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="organizationId" column="organization_id" />
|
|
<result property="topOrganizationId" column="top_organization_id" />
|
|
<result property="approvalNumber" column="approval_number" />
|
|
<result property="isInvoice" column="is_invoice" />
|
|
<result property="invoiceMakeTime" column="invoice_make_time" />
|
|
<result property="applyNumber" column="apply_number" />
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectReconciliationPo">
|
|
select a.*,b.approval_number from reconciliation a LEFT JOIN approval_document b ON a.instance_id = b.approval_order_number
|
|
</sql>
|
|
|
|
<sql id="selectReconciliationPo1">
|
|
<where>
|
|
a.del_flag =1
|
|
<if test="invoiceApplyStatus != null ">
|
|
and a.invoice_apply_status = #{invoiceApplyStatus}
|
|
</if> <if test="synchronousStatus != null ">
|
|
and a.synchronous_status = #{synchronousStatus}
|
|
</if> <if test="skSynchronousStatus != null ">
|
|
and a.sk_synchronous_status = #{skSynchronousStatus}
|
|
</if>
|
|
<if test="verificationMoney != null ">
|
|
and a.verification_money = #{verificationMoney}
|
|
</if>
|
|
<if test="isInvoice != null ">
|
|
and a.is_invoice = #{isInvoice}
|
|
</if>
|
|
<if test="settlementCount != null ">
|
|
and a.settlement_count = #{settlementCount}
|
|
</if>
|
|
<if test="userId != null ">
|
|
and a.user_id = #{userId}
|
|
</if>
|
|
<if test="applyNumber != null and applyNumber != ''">
|
|
and a.apply_number like concat('%', #{applyNumber}, '%')
|
|
</if>
|
|
<if test="shipperName != null and shipperName != ''">
|
|
and a.shipper_name like concat('%', #{shipperName}, '%')
|
|
</if>
|
|
<if test="innerNumber != null and innerNumber != ''">
|
|
and a.inner_number like concat('%', #{innerNumber}, '%')
|
|
</if>
|
|
<if test="partyName != null and partyName != ''">
|
|
and a.inner_number like concat('%', #{partyName}, '%')
|
|
</if>
|
|
<if test="billRemark != null and billRemark != ''">
|
|
and a.bill_remark like concat('%', #{billRemark}, '%')
|
|
</if>
|
|
<if test="settlementRemark != null and settlementRemark != ''">
|
|
and a.settlement_remark like concat('%', #{settlementRemark}, '%')
|
|
</if>
|
|
<if test="auditNumber != null and auditNumber != ''">
|
|
and a.audit_number like concat('%', #{auditNumber}, '%')
|
|
</if>
|
|
<if test="waybillSource != null and waybillSource != ''">
|
|
and a.waybill_source = #{waybillSource}
|
|
</if>
|
|
<if test="waybillSourceName != null and waybillSourceName != ''">
|
|
and a.waybill_source_name like concat('%', #{waybillSourceName}, '%')
|
|
</if>
|
|
<if test="reconciliationStart != null ">
|
|
and a.reconciliation_start = #{reconciliationStart}
|
|
</if>
|
|
<if test="reconciliationEnd != null ">
|
|
and a.reconciliation_end = #{reconciliationEnd}
|
|
</if>
|
|
<if test="billName != null and billName != ''">
|
|
and a.bill_name like concat('%', #{billName}, '%')
|
|
</if>
|
|
<if test="collectionAmount != null ">
|
|
and a.collection_amount = #{collectionAmount}
|
|
</if>
|
|
<if test="changeAmount != null ">
|
|
and a.change_amount = #{changeAmount}
|
|
</if>
|
|
<if test="otherAmount != null ">
|
|
and a.other_amount = #{otherAmount}
|
|
</if>
|
|
<if test="receivable != null ">
|
|
and a.receivable = #{receivable}
|
|
</if>
|
|
<if test="actualReceivable != null ">
|
|
and a.actual_receivable = #{actualReceivable}
|
|
</if>
|
|
<if test="uncollectedReceivable != null ">
|
|
and a.uncollected_receivable = #{uncollectedReceivable}
|
|
</if>
|
|
<if test="collectionState != null and collectionState>=0">
|
|
and a.collection_state = #{collectionState}
|
|
</if>
|
|
<if test="auditState != null ">
|
|
and a.audit_state = #{auditState}
|
|
</if>
|
|
<if test="auditType != null ">
|
|
and a.audit_type = #{auditType}
|
|
</if>
|
|
<if test="createByName != null and createByName != ''">
|
|
and a.create_by_name like concat('%', #{createByName}, '%')
|
|
</if>
|
|
<if test="updateByName != null and updateByName != ''">
|
|
and a.update_by_name like concat('%', #{updateByName}, '%')
|
|
</if>
|
|
<if test="organizationId != null ">
|
|
and a.organization_id = #{organizationId}
|
|
</if>
|
|
<if test="topOrganizationId != null ">
|
|
and a.top_organization_id = #{topOrganizationId}
|
|
</if>
|
|
<if test="collectionTimeStart != null and collectionTimeEnd != null">
|
|
AND (date_format(a.collection_time,'%Y-%m-%d') >= date_format(#{collectionTimeStart},'%Y-%m-%d')
|
|
and date_format(a.collection_time,'%Y-%m-%d') <![CDATA[<=]]> date_format(#{collectionTimeEnd},'%Y-%m-%d'))
|
|
</if>
|
|
<if test="createTimeStart != null and createTimeEnd != null">
|
|
AND (date_format(a.create_time,'%Y-%m-%d') >= date_format(#{createTimeStart},'%Y-%m-%d')
|
|
and date_format(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> date_format(#{createTimeEnd},'%Y-%m-%d'))
|
|
</if>
|
|
<if test="authTimeStart != null and authTimeEnd != null">
|
|
AND (date_format(a.auth_time,'%Y-%m-%d') >= date_format(#{authTimeStart},'%Y-%m-%d')
|
|
and date_format(a.auth_time,'%Y-%m-%d') <![CDATA[<=]]> date_format(#{authTimeEnd},'%Y-%m-%d'))
|
|
</if>
|
|
<if test="innerNumberList != null and innerNumberList.size > 0">
|
|
and a.inner_number in
|
|
<foreach item="innerNumber" collection="innerNumberList" open="(" separator="," close=")">
|
|
#{innerNumber}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
<insert id="saveBatchReconciliationBusinessDocument">
|
|
insert into reconciliation_business_document(business_document_id,reconciliation_id) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
(#{item.businessDocumentId},#{item.reconciliationId})
|
|
</foreach>
|
|
</insert>
|
|
<update id="delReconciliationBusinessDocumentByReconciliationId">
|
|
update reconciliation_business_document set del_flag = 2 where reconciliation_id = #{reconciliationId}
|
|
</update>
|
|
|
|
<select id="queryList" parameterType="com.linke.finance.domain.reconciliation.repository.todo.ReconciliationDO" resultMap="ReconciliationResult">
|
|
<include refid="selectReconciliationPo"/>
|
|
<include refid="selectReconciliationPo1"/>
|
|
order by create_time desc
|
|
</select>
|
|
<select id="selectBusinessByReconciliationId"
|
|
resultType="com.linke.finance.domain.businessDocument.entity.BusinessDocument">
|
|
SELECT
|
|
a.*
|
|
FROM
|
|
business_document a
|
|
LEFT JOIN reconciliation_business_document b ON a.business_document_id = b.business_document_id
|
|
WHERE
|
|
a.del_flag = 1
|
|
and b.del_flag = 1
|
|
AND b.reconciliation_id = #{reconciliationId}
|
|
</select>
|
|
|
|
<update id="delReconciliationByInnerNumber">
|
|
update reconciliation set del_flag = 2 where inner_number = #{innerNumber}
|
|
</update>
|
|
<update id="delReconciliationDetailByInnerNumber">
|
|
update reconciliation_order_detail set del_flag = 2 where reconciliation_id = #{reconciliationId}
|
|
</update>
|
|
</mapper>
|