121 lines
6.5 KiB
XML
121 lines
6.5 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.ruoyi.sip.mapper.OmsPayablePaymentDetailMapper">
|
|
|
|
<resultMap type="OmsPayablePaymentDetail" id="OmsPayablePaymentDetailResult">
|
|
<result property="id" column="id" />
|
|
<result property="paymentPlanId" column="payment_plan_id" />
|
|
<result property="payableBillId" column="payable_bill_id" />
|
|
<result property="paymentStatus" column="payment_status" />
|
|
<result property="paymentTime" column="payment_time" />
|
|
<result property="paymentAmount" column="payment_amount" />
|
|
<result property="paymentAmountWithoutTax" column="payment_amount_without_tax" />
|
|
<result property="paymentAmountTax" column="payment_amount_tax" />
|
|
<result property="writeOffId" column="write_off_id" />
|
|
<result property="paymentRate" column="payment_rate" />
|
|
<result property="paymentBillCode" column="payment_bill_code" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<insert id="insertOmsPayablePaymentDetail" parameterType="OmsPayablePaymentDetail" useGeneratedKeys="true" keyProperty="id">
|
|
insert into oms_payable_payment_detail (
|
|
<if test="paymentPlanId != null">payment_plan_id,</if>
|
|
<if test="payableBillId != null">payable_bill_id,</if>
|
|
<if test="paymentTime != null">payment_time,</if>
|
|
<if test="paymentAmount != null">payment_amount,</if>
|
|
<if test="paymentAmountWithoutTax != null">payment_amount_without_tax,</if>
|
|
<if test="paymentAmountTax != null">payment_amount_tax,</if>
|
|
<if test="writeOffId != null">write_off_id,</if>
|
|
<if test="paymentRate != null">payment_rate,</if>
|
|
<if test="paymentBillCode != null and paymentBillCode != ''">payment_bill_code,</if>
|
|
<if test="payableDetailType != null and payableDetailType != ''">payable_detail_type,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
create_by,
|
|
create_time
|
|
) values (
|
|
<if test="paymentPlanId != null">#{paymentPlanId},</if>
|
|
<if test="payableBillId != null">#{payableBillId},</if>
|
|
<if test="paymentTime != null">#{paymentTime},</if>
|
|
<if test="paymentAmount != null">#{paymentAmount},</if>
|
|
<if test="paymentAmountWithoutTax != null">#{paymentAmountWithoutTax},</if>
|
|
<if test="paymentAmountTax != null">#{paymentAmountTax},</if>
|
|
<if test="writeOffId != null">#{writeOffId},</if>
|
|
<if test="paymentRate != null">#{paymentRate},</if>
|
|
<if test="paymentBillCode != null and paymentBillCode != ''">#{paymentBillCode},</if>
|
|
<if test="payableDetailType != null and payableDetailType != ''">#{payableDetailType},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
#{createBy},
|
|
sysdate()
|
|
)
|
|
</insert>
|
|
<insert id="insertBatch">
|
|
insert into oms_payable_payment_detail (
|
|
payment_plan_id, payable_bill_id, payment_time, payment_amount, payment_amount_without_tax,
|
|
payment_amount_tax, write_off_id, payment_rate, payment_bill_code, payable_detail_type, remark,
|
|
create_by, create_time )
|
|
values
|
|
<foreach item="item" collection="list" separator="," index="">
|
|
(#{item.paymentPlanId},#{item.payableBillId},#{item.paymentTime},#{item.paymentAmount},#{item.paymentAmountWithoutTax},
|
|
#{item.paymentAmountTax},#{item.writeOffId},#{item.paymentRate},#{item.paymentBillCode},#{item.payableDetailType},#{item.remark},
|
|
#{item.createBy},
|
|
sysdate())
|
|
</foreach>
|
|
</insert>
|
|
<select id="list" resultType="com.ruoyi.sip.domain.OmsPayablePaymentDetail">
|
|
|
|
SELECT
|
|
t1.*,t2.payment_bill_code,t2.actual_payment_time,t2.payment_status,t2.id as paymentBillId
|
|
FROM
|
|
oms_payable_payment_detail t1
|
|
LEFT JOIN oms_payment_bill t2 ON t1.payment_bill_code = t2.payment_bill_code
|
|
<where>
|
|
<if test="payableBillId != null">
|
|
and t1.payable_bill_id = #{payableBillId}
|
|
</if>
|
|
<if test="paymentBillCode != null and paymentBillCode!=''">
|
|
and t1.payment_bill_code = #{paymentBillCode}
|
|
</if>
|
|
<if test="payableBillIdList != null and payableBillIdList.size>0">
|
|
and t1.payable_bill_id in
|
|
<foreach item="item" collection="payableBillIdList" separator="," open="(" close=")" index="">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
order by t1.create_time desc
|
|
</select>
|
|
|
|
<select id="selectByPaymentPlanIds" resultType="com.ruoyi.sip.domain.OmsPayablePaymentDetail">
|
|
SELECT
|
|
t1.id, t1.payment_plan_id, t1.payable_bill_id, t1.payment_time,
|
|
t1.payment_amount, t1.payment_amount_without_tax, t1.payment_amount_tax, t1.write_off_id, t1.payment_rate, t1.payment_bill_code, t1.remark,
|
|
t1.create_time, t1.create_by, t1.update_time, t1.payable_detail_type
|
|
FROM
|
|
oms_payable_payment_detail t1
|
|
WHERE t1.payment_plan_id IN
|
|
<foreach collection="paymentPlanIds" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
ORDER BY t1.create_time DESC
|
|
</select>
|
|
<select id="listPayableByPaymentCode" resultType="com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO">
|
|
select t1.payment_amount, t2.payable_bill_code, t4.project_name, t4.project_code, t2.total_price_with_tax
|
|
from (SELECT sum(payment_amount) payment_amount,
|
|
payable_bill_id
|
|
FROM oms_payable_payment_detail
|
|
WHERE payment_bill_code in
|
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
|
#{item}
|
|
</foreach>
|
|
group by payable_bill_id) t1
|
|
left join oms_payable_bill t2 on t1.payable_bill_id = t2.id
|
|
left join project_order_info t3 on t2.order_code = t3.order_code
|
|
left join project_info t4 on t3.project_id = t4.id
|
|
</select>
|
|
|
|
</mapper> |