Files
nanguangszwlback/mhd_finance/src/main/resources/mapper/tmsReceipt/TmsReceiptMapper.xml
T

125 lines
6.7 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.tmsReceipt.repository.mapper.TmsReceiptMapper">
<resultMap type="com.linke.finance.domain.tmsReceipt.repository.po.TmsReceiptPO" id="TmsReceiptResult">
<result property="id" column="id" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="receivePaymentNumber" column="receive_payment_number" />
<!--<result property="settlementPartyId" column="settlement_party_id" />-->
<result property="settlementPartyName" column="settlement_party_name" />
<result property="departmentName" column="department_name" />
<!--<result property="settlementPartyType" column="settlement_party_type" />-->
<result property="receivePaymentAmount" column="receive_payment_amount" />
<result property="receivePaymentTime" column="receive_payment_time" />
<result property="receiveVoucherUrl" column="receive_voucher_url" />
<result property="assignableAmount" column="assignable_amount" />
<result property="assignmentStatus" column="assignment_status" />
<result property="creditAmount" column="credit_amount" />
<result property="creditReason" column="credit_reason" />
<result property="serialNumber" column="serial_number" />
<result property="remark" column="remark" />
<result property="accountName" column="account_name" />
<result property="accountInformation" column="account_information" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectTmsReceiptPo">
select id, top_organization_id,organization_id,organization_name,department_name,settlement_party_name,receive_payment_number, receive_payment_amount,
assignable_amount,assignment_status,credit_amount,credit_reason, receive_payment_time, serial_number,receive_voucher_url,
remark, account_name, account_information, create_by,create_by_name, create_time, update_by,update_by_name, update_time, del_flag from tms_receipt
</sql>
<sql id="selectTmsReceiptPo1">
<where>
and del_flag = 1
<if test="assignmentStatus != null and assignmentStatus > -1">
and assignment_status = #{assignmentStatus}
</if>
<if test="greaterThanAssignmentStatus != null and greaterThanAssignmentStatus > -1">
and assignment_status > #{greaterThanAssignmentStatus}
</if>
<if test="assignableStatusIn != null and assignableStatusIn > -1">
and assignment_status in (0,1)
</if>
<if test="receivePaymentTimeStart != null and receivePaymentTimeStart != ''">
AND date_format(receive_payment_time,'%Y-%m-%d') &gt;= #{receivePaymentTimeStart}
</if>
<if test="receivePaymentTimeEnd != null and receivePaymentTimeEnd != ''">
AND date_format(receive_payment_time,'%Y-%m-%d') &lt;= #{receivePaymentTimeEnd}
</if>
<if test="createTimeStart != null and createTimeStart != ''">
AND date_format(create_time,'%Y-%m-%d') &gt;= #{createTimeStart}
</if>
<if test="createTimeEnd != null and createTimeEnd != ''">
AND date_format(create_time,'%Y-%m-%d') &lt;= #{createTimeEnd}
</if>
<if test="receivePaymentNumber != null and receivePaymentNumber != ''">
and receive_payment_number = #{receivePaymentNumber}
</if>
<!-- <if test="settlementPartyId != null and settlementPartyId != ''">
and settlement_party_id = #{settlementPartyId}
</if>-->
<if test="settlementPartyName != null and settlementPartyName != ''">
and settlement_party_name = #{settlementPartyName}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name LIKE CONCAT('%', #{departmentName},'%')
</if>
<if test="receivePaymentAmount != null ">
and receive_payment_amount = #{receivePaymentAmount}
</if>
<if test="receivePaymentTime != null ">
and receive_payment_time = #{receivePaymentTime}
</if>
<if test="serialNumber != null and serialNumber != ''">
and serial_number = #{serialNumber}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name = #{createByName}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="accountName != null and accountName != ''">
and account_name like concat('%', #{accountName}, '%')
</if>
<if test="accountInformation != null and accountInformation != ''">
and account_information like concat('%', #{accountInformation}, '%')
</if>
<!-- 无论什么情况,organization_name 都不能为空,也不能为空字符串 -->
and organization_name IS NOT NULL
and organization_name &lt;&gt; ''
and LENGTH(TRIM(organization_name)) > 0
<!-- 组织ID过滤条件:如果设置了organizationId,则按组织ID精确匹配 -->
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<!-- 一级组织ID过滤条件:如果设置了topOrganizationId,则按一级组织ID匹配 -->
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<!-- 组织名称模糊查询条件:如果前端传入了组织名称,则按组织名称模糊匹配 -->
<if test="organizationName != null and organizationName != ''">
and organization_name LIKE CONCAT('%',#{organizationName},'%')
</if>
order by create_time desc
</where>
</sql>
<select id="queryList" parameterType="com.linke.finance.domain.tmsReceipt.repository.todo.TmsReceiptDO" resultMap="TmsReceiptResult">
<include refid="selectTmsReceiptPo"/>
<include refid="selectTmsReceiptPo1"/>
</select>
</mapper>