| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <?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.ydtech.modules.fnc.dao.SettlementDocumentaryFeesMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
- <id column="id" property="id" />
- <result column="total_orders" property="totalOrders"/>
- <result column="time_frame" property="timeFrame"/>
- <result column="total_amount" property="totalAmount"/>
- <result column="create_time" property="createTime"/>
- <result column="settlement_time" property="settlementTime"/>
- <result column="end_time" property="endTime"/>
- <result column="settlement_amount" property="settlementAmount"/>
- <result column="unsettled_amount" property="unsettledAmount"/>
- <result column="company_id" property="companyId"/>
- <result column="year" property="year"/>
- <result column="month" property="month"/>
- <result column="day" property="day"/>
- <result column="agree_ment_id" property="agreeMentId"/>
- <result column="invoice_id" property="invoiceId"/>
- <result column="is_not_car" property="isNotCar"/>
- <result column="partner_companies_id" property="partnerCompaniesId"/>
- <result column="invoicing_method" property="invoicingMethod"/>
- <result column="tax_points" property="taxPoints"/>
- <result column="expend_amount" property="expendAmount"/>
- <result column="parent_id" property="parentId"/>
- <result column="handling_fees_status" property="handlingFeesStatus"/>
- <result column="agreement_type" property="agreementType"/>
- <result column="settlement_status" property="settlementStatus"/>
- <result column="settlement_image_id" property="settlementImageId"/>
- <result column="task_id" property="taskId"/>
- </resultMap>
- <select id="querySettle" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
- select
- a.id as "id",
- a.total_orders as "totalOrders",
- a.time_frame as "timeFrame",
- a.total_amount as "totalAmount",
- a.create_time as "createTime",
- a.start_time as "startTime",
- a.end_time as "endTime",
- a.settlement_amount as "settlementAmount",
- a.agree_ment_id as "agreeMentId",
- a.partner_companies_id as "partnerCompaniesId",
- a.invoicing_method as "invoicingMethod",
- a.tax_points as "taxPoints",
- a.expend_amount as "expendAmount",
- a.parent_id as "parentId",
- a.handling_fees_status as "handlingFeesStatus",
- a.agreement_type as "agreementType",
- a.settlement_time as "settlementTime",
- a.settlement_image_id as "settlementImageId",
- a.task_id as "taskId",
- upf.url as "imageUrl",
- a.unsettled_amount as "unsettledAmount"
- from settlement_documentary_fees a
- LEFT JOIN ins_upload_files upf on a.settlement_image_id=upf.id
- <where>
- 1=1
- <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
- and a.partner_companies_id =#{partnerCompaniesId}
- </if>
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
- and a.handling_fees_status =#{handlingFeesStatus}
- </if>
- <if test="isNotCar !=null and isNotCar !=''">
- and a.is_not_car =#{isNotCar}
- </if>
- <if test="agreementType !=null and agreementType !=''">
- and a.agreement_type =#{agreementType}
- </if>
- <if test="parentId !=null and parentId !=''">
- and a.parent_id =#{parentId}
- </if>
- <if test="settlementStatus !=null and settlementStatus !=''">
- and a.settlement_status =#{settlementStatus}
- </if>
- </where>
- </select>
- <select id="getOtherSettldetail" resultType="java.util.HashMap">
- SELECT
- a.id as "id",
- a.create_time AS "invoicTime",
- a.invoice_id AS "invoicId",
- a.tax_points AS "taxPoints",
- a.partner_companies_id AS "partnerCompaniesId",
- a.agreement_type as "agreementType",
- IFNULL(settlement_amount ,0) "invoicCommissionFeevalue",
- a.invoicing_method as "invoicingMethod",
- a.task_id AS "taskId"
- FROM
- settlement_documentary_fees a
- left join (
- select a.parent_id as "parentId" ,sum(a.settlement_amount) as "settlementAmount" from
- settlement_documentary_fees a
- where a.settlement_status ='2' and a.parent_id is not null
- GROUP BY a.parent_id
- ) b on a.id=b.parentId
- <where>
- 1=1
- <choose>
- <when test="settlementStatus != null and settlementStatus!=''">
- and a.settlement_status =#{settlementStatus}
- </when>
- <otherwise>
- and a.settlement_status ='1'
- </otherwise>
- </choose>
- <if test="isSettlement !=null and isSettlement !=''">
- and a.settlement_amount - COALESCE(b.settlementAmount, 0) <> 0
- </if>
- <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
- and a.partner_companies_id =#{partnerCompaniesId}
- </if>
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
- and a.handling_fees_status =#{handlingFeesStatus}
- </if>
- <if test="isNotCar !=null and isNotCar !=''">
- and a.is_not_car =#{isNotCar}
- </if>
- <if test="invoiceIds !=null and invoiceIds !='' and invoiceIds.length>0">
- and a.id IN
- <foreach item="item" index="index" collection="invoiceIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <update id="batchByInvoice" parameterType="java.util.HashMap">
- update settlement_documentary_fees
- <set>
- settlement_status = '2',
- settlement_time = NOW(),
- <if test="settlementAmount !=null and settlementAmount !=''">
- settlement_amount =#{settlementAmount}
- </if>
- </set>
- <where>
- <if test="ids !=null and ids!='' and ids.length>0">
- id in
- <foreach collection="ids" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </update>
- <select id="getInvoicIds" resultType="java.util.HashMap">
- SELECT
- a.id as "id",
- a.partner_companies_id AS "partnerCompaniesId"
- FROM settlement_documentary_fees a
- <where>
- a.settlement_status = '1'
- <if test="isNotCar !=null and isNotCar !=''">
- and a.is_not_car =#{isNotCar}
- </if>
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
- a.handling_fees_status=#{handlingFeesStatus}
- </if>
- </where>
- </select>
- <select id="getByParentSettlementAmount" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
- SELECT
- sum(a.settlement_amount) as "totalAmount"
- FROM settlement_documentary_fees a
- <where>
- a.settlement_status = '2'
- <if test="id !=null and id !=''">
- and a.parent_id =#{id}
- </if>
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
- and a.handling_fees_status =#{handlingFeesStatus}
- </if>
- </where>
- </select>
- <select id="queryNew" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
- select
- a.id as "id",
- a.total_orders as "totalOrders",
- a.time_frame as "timeFrame",
- a.total_amount as "totalAmount",
- a.create_time as "createTime",
- a.start_time as "startTime",
- a.end_time as "endTime",
- a.settlement_amount as "settlementAmount",
- a.agree_ment_id as "agreeMentId",
- a.partner_companies_id as "partnerCompaniesId",
- a.invoicing_method as "invoicingMethod",
- a.tax_points as "taxPoints",
- a.expend_amount as "expendAmount",
- a.parent_id as "parentId",
- a.handling_fees_status as "handlingFeesStatus",
- a.agreement_type as "agreementType",
- a.settlement_time as "settlementTime",
- a.settlement_image_id as "settlementImageId",
- a.task_id as "taskId",
- upf.url as "imageUrl",
- a.unsettled_amount as "unsettledAmount"
- from settlement_documentary_fees a
- LEFT JOIN ins_upload_files upf on a.settlement_image_id=upf.id
- <where>
- 1=1
- <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
- and a.partner_companies_id =#{partnerCompaniesId}
- </if>
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
- and a.handling_fees_status =#{handlingFeesStatus}
- </if>
- <if test="isNotCar !=null and isNotCar !=''">
- and a.is_not_car =#{isNotCar}
- </if>
- <if test="agreementType !=null and agreementType !=''">
- and a.agreement_type =#{agreementType}
- </if>
- <if test="parentId !=null and parentId !=''">
- and a.parent_id =#{parentId}
- </if>
- <if test="settlementStatus !=null and settlementStatus !=''">
- and a.settlement_status =#{settlementStatus}
- </if>
- </where>
- </select>
- </mapper>
|