Files
nanguangszwlback/mhd_bms/src/main/resources/mapper/BillManageMapper.xml
T
2026-07-23 14:49:19 +08:00

169 lines
9.1 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.billManage.repository.mapper.BillManageMapper">
<select id="queryList" parameterType="com.mhd.bms.domain.billManage.repository.todo.BillManageDO" resultType="com.mhd.bms.domain.billManage.repository.po.BillManagePO">
select
a.*,b.SETTLEMENT_ENTITY_ID as settlementEntityId
from bill_manage a LEFT JOIN SETTLEMENT_CUSTOMERS b on a.SETTLEMENT_CUSTOMERS_ID = b.SETTLEMENT_CUSTOMERS_ID
where a.del_flag = 1
<include refid="common_where"/>
ORDER BY a.create_time DESC
</select>
<sql id="common_where">
<if test="billManageDO.createTimeStart != null and billManageDO.createTimeStart != ''">
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.createTimeStart}
</if>
<if test="billManageDO.createTimeEnd != null and billManageDO.createTimeEnd != ''">
AND date_format(a.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.createTimeEnd}
</if>
<if test="billManageDO.paymentPushTimeStart != null and billManageDO.paymentPushTimeStart != ''">
AND date_format(a.SK_SYNCHRONOUS_TIME,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.paymentPushTimeStart}
</if>
<if test="billManageDO.paymentPushTimeEnd != null and billManageDO.paymentPushTimeEnd != ''">
AND date_format(a.SK_SYNCHRONOUS_TIME,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.paymentPushTimeEnd}
</if>
<if test="billManageDO.receivablePushTimeStart != null and billManageDO.receivablePushTimeStart != ''">
AND date_format(a.SYNCHRONOUS_TIME,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.receivablePushTimeStart}
</if>
<if test="billManageDO.receivablePushTimeEnd != null and billManageDO.receivablePushTimeEnd != ''">
AND date_format(a.SYNCHRONOUS_TIME,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.receivablePushTimeEnd}
</if>
<if test="billManageDO.createByName != null and billManageDO.createByName != ''">
AND a.create_by_name like concat('%', #{billManageDO.createByName}, '%')
</if>
<if test="billManageDO.organizationId != null">
AND a.organization_id = #{billManageDO.organizationId}
</if>
<if test="billManageDO.topOrganizationId != null and billManageDO.topOrganizationId != ''">
AND a.top_organization_id = #{billManageDO.topOrganizationId}
</if>
<if test="billManageDO.updateTimeStart != null and billManageDO.updateTimeStart != ''">
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[>=]]> #{billManageDO.updateTimeStart}
</if>
<if test="billManageDO.updateTimeEnd != null and billManageDO.updateTimeEnd != ''">
AND date_format(a.update_time,'%Y-%m-%d') <![CDATA[<=]]> #{billManageDO.updateTimeEnd}
</if>
<if test="billManageDO.updateByName != null and billManageDO.updateByName != ''">
AND a.update_by_name like concat('%', #{billManageDO.updateByName}, '%')
</if>
<if test="billManageDO.billNumber != null and billManageDO.billNumber != ''">
AND a.bill_number like concat('%', #{billManageDO.billNumber}, '%')
</if>
<if test="billManageDO.belongModule != null and billManageDO.belongModule != ''">
AND a.belong_module like concat('%', #{billManageDO.belongModule}, '%')
</if>
<if test="billManageDO.settlementEntity != null and billManageDO.settlementEntity != ''">
AND a.settlement_entity like concat('%', #{billManageDO.settlementEntity}, '%')
</if>
<if test="billManageDO.billState != null">
AND a.bill_state = #{billManageDO.billState}
</if>
<if test="billManageDO.isInvoice != null">
AND a.IS_INVOICE = #{billManageDO.isInvoice}
</if>
<if test="billManageDO.reconciliationStatus != null">
AND a.reconciliation_status = #{billManageDO.reconciliationStatus}
</if>
<if test="billManageDO.applyNumber != null and billManageDO.applyNumber != ''">
AND a.apply_number like concat('%', #{billManageDO.applyNumber}, '%')
</if>
<if test="billManageDO.settlementCurrency != null and billManageDO.settlementCurrency != ''">
AND a.settlement_currency = #{billManageDO.settlementCurrency}
</if>
<if test="billManageDO.skSynchronousStatus != null">
AND a.sk_synchronous_status = #{billManageDO.skSynchronousStatus}
</if>
<if test="billManageDO.synchronousStatus != null">
AND a.synchronous_status = #{billManageDO.synchronousStatus}
</if>
<if test="billManageDO.billType != null">
AND a.bill_type = #{billManageDO.billType}
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 1">
AND a.bill_state <![CDATA[<]]> 5
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 2">
AND a.bill_state = 5
</if>
<if test="billManageDO.queryParam != null and billManageDO.queryParam == 3">
AND a.bill_state = 6
</if>
<if test="billManageDO.billManageIdSet != null and billManageDO.billManageIdSet.size() > 0">
and a.bill_manage_id in
<foreach item="id" collection="billManageDO.billManageIdSet" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</sql>
<select id="getInvoiceItemName" parameterType="java.lang.String" resultType="java.lang.String">
select SUBJECT_NAME from "NGWL_TEST_SYSTEM".EXPENSE_ACCOUNT where status = 1 and SUBJECT_CODE = #{invoiceItemId} limit 1
</select>
<select id="getInvoiceItemNcCode" parameterType="java.lang.String" resultType="java.lang.String">
select NC_SUBJECT_CODE from "NGWL_TEST_SYSTEM".EXPENSE_ACCOUNT where status = 1 and SUBJECT_CODE = #{invoiceItemId} limit 1
</select>
<select id="getCustomerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select>
<select id="getCustomerCodeNcJson" parameterType="java.lang.String" resultType="java.lang.String">
SELECT ORG_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select>
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
</select>
<select id="getsalespersonNcCode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT SALESPERSON_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
</select>
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1
</select>
<select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
SELECT SERVICE_ITEMS_CODE_NC FROM NGWL_TEST_SYSTEM."SERVICE_ITEMS_MANAGE" where DEL_FLAG = '1' and SERVICE_ITEMS_NAME = #{name} limit 1
</select>
<select id="getNcUrl" resultType="java.lang.String">
SELECT INTERFACE_TYPE_VALUE FROM NGWL_TEST_THIRDPARTY."SYS_DEPART_INTERFACE_INFO"
where DEL_FLAG = '1'
and organization_id = #{organizationId}
and organization_name = #{organizationName}
and interface_type = #{interfaceType} limit 1
</select>
<select id="getCustomerUserDept" parameterType="java.lang.String" resultType="java.lang.String">
SELECT DEPARTMENT_ID FROM NGWL_TEST_USER."USER" where DEL_FLAG = '1' and user_id = #{userId} limit 1
</select>
<select id="getDeptValue" parameterType="java.lang.String" resultType="java.lang.String">
SELECT dict_value FROM NGWL_TEST_SYSTEM."SYS_DICT_DATA" where status = '0' and dict_type = 'department' and dict_code = #{dictCode} limit 1
</select>
<select id="getDeptName" parameterType="java.lang.String" resultType="java.lang.String">
SELECT dict_label FROM NGWL_TEST_SYSTEM."SYS_DICT_DATA" where status = '0' and dict_type = 'department' and dict_code = #{dictCode} limit 1
</select>
<select id="getOrgCodeNc" resultType="java.lang.String">
SELECT NC_CODE FROM NGWL_TEST_PRODUCT."SYS_ORGANIZATION" where DEL_FLAG = 1 and organization_id = #{organizationId} limit 1
</select>
<select id="getShipperId" resultType="java.lang.Long">
SELECT SHIPPER_ID FROM NGWL_TEST_USER."USER_SHIPPER" where DEL_FLAG = '1' and user_id = #{userId} and organization_id = #{organizationId} limit 1
</select>
</mapper>