271 lines
11 KiB
XML
271 lines
11 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.businessDocumentDetali.repository.mapper.BusinessDocumentDetaliMapper">
|
|
|
|
<resultMap type="com.linke.finance.domain.businessDocumentDetali.repository.po.BusinessDocumentDetaliPO" id="BusinessDocumentDetaliResult">
|
|
<result property="businessDocumentDetaliId" column="business_document_detali_id" />
|
|
<result property="businessDocumentId" column="business_document_id" />
|
|
<result property="firstSubject" column="first_subject" />
|
|
<result property="firstSubjectName" column="first_subject_name" />
|
|
<result property="secondSubject" column="second_subject" />
|
|
<result property="secondSubjectName" column="second_subject_name" />
|
|
<result property="amount" column="amount" />
|
|
<result property="amountPaid" column="amount_paid" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="waybillNumber" column="waybill_number" />
|
|
<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" />
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectBusinessDocumentDetaliPo">
|
|
select * from business_document_detali
|
|
</sql>
|
|
|
|
<sql id="selectBusinessDocumentDetaliPo1">
|
|
<where>
|
|
del_flag = 1
|
|
<if test="businessDocumentId != null ">
|
|
and business_document_id = #{businessDocumentId}
|
|
</if>
|
|
<if test="firstSubject != null and firstSubject != ''">
|
|
and first_subject = #{firstSubject}
|
|
</if>
|
|
<if test="firstSubjectName != null and firstSubjectName != ''">
|
|
and first_subject_name like concat('%', #{firstSubjectName}, '%')
|
|
</if>
|
|
<if test="secondSubject != null and secondSubject != ''">
|
|
and second_subject = #{secondSubject}
|
|
</if>
|
|
<if test="secondSubjectName != null and secondSubjectName != ''">
|
|
and second_subject_name like concat('%', #{secondSubjectName}, '%')
|
|
</if>
|
|
<if test="amount != null ">
|
|
and amount = #{amount}
|
|
</if>
|
|
<if test="userId != null ">
|
|
and user_id = #{userId}
|
|
</if>
|
|
<if test="waybillNumber != null and waybillNumber != ''">
|
|
and waybill_number = #{waybillNumber}
|
|
</if>
|
|
<if test="waybillNoList != null">
|
|
AND waybill_number in
|
|
<foreach item="waybillNo" collection="waybillNoList" open="(" separator="," close=")">
|
|
#{waybillNo}
|
|
</foreach>
|
|
</if>
|
|
<if test="createByName != null and createByName != ''">
|
|
and create_by_name like concat('%', #{createByName}, '%')
|
|
</if>
|
|
<if test="updateByName != null and updateByName != ''">
|
|
and update_by_name like concat('%', #{updateByName}, '%')
|
|
</if>
|
|
<if test="organizationId != null ">
|
|
and organization_id = #{organizationId}
|
|
</if>
|
|
<if test="topOrganizationId != null ">
|
|
and top_organization_id = #{topOrganizationId}
|
|
</if>
|
|
<if test="payStatus != null ">
|
|
and pay_status = #{payStatus}
|
|
</if>
|
|
<if test="payStatusShipper != null ">
|
|
and pay_status_shipper = #{payStatusShipper}
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="queryList" parameterType="com.linke.finance.domain.businessDocumentDetali.repository.todo.BusinessDocumentDetaliDO" resultMap="BusinessDocumentDetaliResult">
|
|
<include refid="selectBusinessDocumentDetaliPo"/>
|
|
<include refid="selectBusinessDocumentDetaliPo1"/>
|
|
</select>
|
|
|
|
<select id="selectDetailsByOrderNo" resultType="com.linke.finance.domain.businessDocumentDetali.repository.po.BusinessDocumentDetaliPO">
|
|
SELECT
|
|
a.*
|
|
FROM
|
|
business_document_detali a
|
|
LEFT JOIN business_document b ON a.business_document_id = b.business_document_id
|
|
WHERE
|
|
a.del_flag = 1
|
|
AND b.waybill_source = #{orderSource}
|
|
AND b.waybill_number = #{orderNo}
|
|
</select>
|
|
<select id="auditList" resultType="com.linke.finance.domain.businessDocumentDetali.repository.po.BusinessDocumentDetaliAuditPO">
|
|
SELECT
|
|
a.*,b.approval_number
|
|
FROM business_document_detali a
|
|
left join approval_document b on a.instance_id=b.approval_order_number
|
|
WHERE a.del_flag = 1
|
|
<if test="auditStatus != null">
|
|
and a.audit_status = #{auditStatus}
|
|
</if>
|
|
<if test="paymentMethod != null">
|
|
and a.payment_method = #{paymentMethod}
|
|
</if>
|
|
<if test="waybillNumber != null and waybillNumber != ''">
|
|
and a.waybill_number like concat('%', #{waybillNumber}, '%')
|
|
</if>
|
|
<if test="approvalNumber != null and approvalNumber != ''">
|
|
and b.approval_number like concat('%', #{approvalNumber}, '%')
|
|
</if>
|
|
<!-- <if test="waybillSource != null and waybillSource != ''">-->
|
|
<!-- and b.waybill_source = #{waybillSource}-->
|
|
<!-- </if>-->
|
|
<if test="organizationId != null and organizationId != ''">
|
|
and a.organization_id = #{organizationId}
|
|
</if>
|
|
<if test="firstSubject != null and firstSubject != ''">
|
|
and a.first_subject = #{firstSubject}
|
|
</if>
|
|
<if test="secondSubject != null and secondSubject != ''">
|
|
and a.second_subject = #{secondSubject}
|
|
</if>
|
|
<if test="secondSubject != null and secondSubject != ''">
|
|
and a.second_subject = #{secondSubject}
|
|
</if>
|
|
<if test="expenseItem != null and expenseItem != ''">
|
|
and a.expense_item = #{expenseItem}
|
|
</if>
|
|
<if test="paymentStatus != null">
|
|
and a.payment_status = #{paymentStatus}
|
|
</if>
|
|
|
|
<if test="auditType != null">
|
|
and a.audit_type = #{auditType}
|
|
</if>
|
|
|
|
<if test="payee != null and payee != ''">
|
|
and a.payee like concat('%', #{payee}, '%')
|
|
</if>
|
|
|
|
<if test="payName != null and payName != ''">
|
|
and a.pay_name like concat('%', #{payName}, '%')
|
|
</if>
|
|
|
|
<if test="licenseNumber != null and licenseNumber != ''">
|
|
and a.license_number like concat('%', #{licenseNumber}, '%')
|
|
</if>
|
|
|
|
<if test="departmentName != null and departmentName != ''">
|
|
and a.department_name like concat('%', #{departmentName}, '%')
|
|
</if>
|
|
|
|
<if test="remark != null and remark != ''">
|
|
and a.remark like concat('%', #{remark}, '%')
|
|
</if>
|
|
|
|
<if test="auditNumber != null and auditNumber != ''">
|
|
and a.audit_number like concat('%', #{auditNumber}, '%')
|
|
</if>
|
|
|
|
<if test="createByName != null and createByName != ''">
|
|
and a.create_by_name like concat('%', #{createByName}, '%')
|
|
</if>
|
|
|
|
<if test="businessDocumentDetaliNumber != null and businessDocumentDetaliNumber != ''">
|
|
and a.business_document_detali_number like concat('%', #{businessDocumentDetaliNumber }, '%')
|
|
</if>
|
|
|
|
<if test="departmentName != null and departmentName != ''">
|
|
and a.department_name like concat('%', #{departmentName }, '%')
|
|
</if>
|
|
|
|
|
|
<if test="businessType != null">
|
|
and a.business_type = #{businessType}
|
|
</if>
|
|
|
|
<if test="starTime != null and endTime != null">
|
|
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{starTime},'%Y-%m-%d')
|
|
and DATE_FORMAT(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
<!-- <if test="roleIds != null">-->
|
|
<!-- and a.role_id in-->
|
|
<!-- <foreach item="id" collection="roleIds" open="(" separator="," close=")">-->
|
|
<!-- #{id}-->
|
|
<!-- </foreach>-->
|
|
<!-- </if>-->
|
|
|
|
<!-- <if test="waybillNumberList != null">-->
|
|
<!-- and b.waybill_number in-->
|
|
<!-- <foreach item="waybillNumber" collection="waybillNumberList" open="(" separator="," close=")">-->
|
|
<!-- #{waybillNumber}-->
|
|
<!-- </foreach>-->
|
|
<!-- </if>-->
|
|
order by a.create_time desc
|
|
</select>
|
|
<select id="auditDetailList"
|
|
resultType="com.linke.finance.domain.businessDocumentDetali.repository.po.BusinessDocumentDetaliAuditPO">
|
|
SELECT
|
|
a.create_time,
|
|
a.remark,
|
|
b.second_subject_name,
|
|
b.amount,
|
|
b.service,
|
|
b.audit_status,
|
|
b.audit_role,
|
|
b.audit_time,
|
|
a.role_id,
|
|
a.role_code,
|
|
a.role_name,
|
|
c.waybill_source_name,
|
|
c.organization_name,
|
|
c.waybill_number,
|
|
c.loading_adress,
|
|
c.unload_adress,
|
|
c.carrier_name,
|
|
c.driver_name,
|
|
c.vehicle_license_plate_number
|
|
FROM
|
|
audit_records a
|
|
LEFT JOIN business_document_detali b ON a.business_document_detali_id = b.business_document_detali_id
|
|
LEFT JOIN business_document c ON b.business_document_id = c.business_document_id
|
|
WHERE
|
|
a.del_flag = 1
|
|
AND b.del_flag = 1
|
|
and c.del_flag = 1
|
|
<if test="createBy != null">
|
|
and a.create_by = #{createBy}
|
|
</if>
|
|
<if test="waybillNumber != null and waybillNumber != ''">
|
|
and c.waybill_number like concat('%', #{waybillNumber}, '%')
|
|
</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>
|
|
order by create_time desc
|
|
</select>
|
|
<select id="queryListByReconciliation"
|
|
resultType="com.linke.finance.domain.businessDocumentDetali.repository.po.BusinessDocumentDetaliPO">
|
|
SELECT
|
|
a.*
|
|
FROM
|
|
`business_document_detali` a
|
|
LEFT JOIN reconciliation_business_document c ON a.business_document_id = c.business_document_id
|
|
LEFT JOIN reconciliation d ON c.reconciliation_id = d.reconciliation_id
|
|
WHERE
|
|
a.del_flag = 1
|
|
AND d.del_flag = 1
|
|
<if test="payStatusShipper != null ">
|
|
and a.pay_status_shipper = #{payStatusShipper}
|
|
</if>
|
|
AND d.inner_number IN
|
|
<foreach item="waybillNo" collection="waybillNoList" open="(" separator="," close=")">
|
|
#{waybillNo}
|
|
</foreach>
|
|
</select>
|
|
|
|
</mapper>
|