2025-12-17 03:15:10 +00:00
|
|
|
<?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.OmsReceivableInvoiceDetailMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail" id="OmsReceivableInvoiceDetailResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="invoicePlanId" column="invoice_plan_id" />
|
|
|
|
|
<result property="receivableBillId" column="receivable_bill_id" />
|
|
|
|
|
<result property="invoiceTime" column="invoice_time" />
|
|
|
|
|
<result property="invoiceAmount" column="invoice_amount" />
|
2025-12-22 07:59:31 +00:00
|
|
|
<result property="invoiceAmountWithoutTax" column="invoice_amount_without_tax" />
|
|
|
|
|
<result property="invoiceAmountTax" column="invoice_amount_tax" />
|
2025-12-17 03:15:10 +00:00
|
|
|
<result property="invoiceRate" column="invoice_rate" />
|
|
|
|
|
<result property="invoiceBillCode" column="invoice_bill_code" />
|
|
|
|
|
<result property="remark" column="remark" />
|
2025-12-22 07:59:31 +00:00
|
|
|
<result property="receivableDetailType" column="receivable_detail_type" />
|
|
|
|
|
|
2025-12-17 03:15:10 +00:00
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectOmsReceivableInvoiceDetailVo">
|
2025-12-22 07:59:31 +00:00
|
|
|
select id, invoice_plan_id, receivable_bill_id, invoice_time, invoice_amount, invoice_amount_without_tax, invoice_amount_tax, invoice_rate, invoice_bill_code, remark, receivable_detail_type, create_time, create_by, update_time, update_by
|
2025-12-17 03:15:10 +00:00
|
|
|
from oms_receivable_invoice_detail
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectOmsReceivableInvoiceDetailById" parameterType="Long" resultMap="OmsReceivableInvoiceDetailResult">
|
|
|
|
|
<include refid="selectOmsReceivableInvoiceDetailVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectOmsReceivableInvoiceDetailList" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail" resultMap="OmsReceivableInvoiceDetailResult">
|
|
|
|
|
<include refid="selectOmsReceivableInvoiceDetailVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="invoicePlanId != null "> and invoice_plan_id = #{invoicePlanId}</if>
|
|
|
|
|
<if test="receivableBillId != null "> and receivable_bill_id = #{receivableBillId}</if>
|
|
|
|
|
<if test="invoiceTime != null "> and invoice_time = #{invoiceTime}</if>
|
|
|
|
|
<if test="invoiceAmount != null "> and invoice_amount = #{invoiceAmount}</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="invoiceAmountWithoutTax != null "> and invoice_amount_without_tax = #{invoiceAmountWithoutTax}</if>
|
|
|
|
|
<if test="invoiceAmountTax != null "> and invoice_amount_tax = #{invoiceAmountTax}</if>
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="invoiceRate != null "> and invoice_rate = #{invoiceRate}</if>
|
|
|
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''"> and invoice_bill_code = #{invoiceBillCode}</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableDetailType != null and receivableDetailType != ''"> and receivable_detail_type = #{receivableDetailType}</if>
|
|
|
|
|
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
2025-12-22 07:59:31 +00:00
|
|
|
<select id="list" resultType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail">
|
|
|
|
|
SELECT
|
|
|
|
|
t1.*,t2.invoice_bill_code,t2.actual_invoice_time,t2.invoice_status,t2.id as invoice_bill_id
|
|
|
|
|
FROM
|
|
|
|
|
oms_receivable_invoice_detail t1
|
|
|
|
|
LEFT JOIN oms_invoice_bill t2 ON t1.invoice_bill_code = t2.invoice_bill_code
|
2025-12-17 03:15:10 +00:00
|
|
|
<where>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableBillIdList != null and receivableBillIdList.size() > 0">
|
|
|
|
|
and t1.receivable_bill_id in
|
|
|
|
|
<foreach item="item" collection="receivableBillIdList" separator="," open="(" close=")" index="index">
|
2025-12-17 03:15:10 +00:00
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2025-12-24 08:35:26 +00:00
|
|
|
<if test="writeOffIdList != null and writeOffIdList.size() > 0">
|
|
|
|
|
and t1.write_off_id in
|
|
|
|
|
<foreach item="item" collection="writeOffIdList" separator="," open="(" close=")" index="index">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableBillId != null ">
|
|
|
|
|
and t1.receivable_bill_id =#{receivableBillId}
|
|
|
|
|
</if>
|
2025-12-24 08:35:26 +00:00
|
|
|
<if test="writeOffId != null ">
|
|
|
|
|
and t1.write_off_id =#{writeOffId}
|
|
|
|
|
</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="invoiceBillCode != null ">
|
|
|
|
|
and t1.invoice_bill_code =#{invoiceBillCode}
|
|
|
|
|
</if>
|
2025-12-17 03:15:10 +00:00
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectByInvoicePlanIds" resultType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail">
|
|
|
|
|
<include refid="selectOmsReceivableInvoiceDetailVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="list != null and list.size() > 0">
|
|
|
|
|
and invoice_plan_id in
|
|
|
|
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="index">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
order by create_time desc
|
|
|
|
|
</select>
|
2025-12-23 11:52:57 +00:00
|
|
|
<select id="listReceivableByInvoiceBillCode" resultType="com.ruoyi.sip.domain.dto.ReceiptDetailDTO">
|
2026-03-23 04:31:08 +00:00
|
|
|
select t1.receipt_amount, t1.receivable_bill_id, t2.receivable_bill_code, t4.project_name, t4.project_code, t2.total_price_with_tax,t2.product_type
|
2025-12-23 11:52:57 +00:00
|
|
|
from (SELECT sum(invoice_amount) receipt_amount,
|
|
|
|
|
receivable_bill_id
|
2025-12-29 12:54:57 +00:00
|
|
|
FROM oms_receivable_invoice_detail t1
|
|
|
|
|
left join oms_receivable_invoice_write_off t2 on t1.write_off_id=t2.id
|
|
|
|
|
WHERE (t1.write_off_id is null or t1.invoice_bill_code=t2.invoice_bill_code) and t1.invoice_bill_code in
|
2025-12-23 11:52:57 +00:00
|
|
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
group by receivable_bill_id) t1
|
|
|
|
|
left join oms_receivable_bill t2 on t1.receivable_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>
|
2025-12-24 08:35:26 +00:00
|
|
|
<select id="listReceivableByInvoiceWriteOffId" resultType="com.ruoyi.sip.domain.dto.ReceiptDetailDTO">
|
|
|
|
|
select t1.receipt_amount, t2.receivable_bill_code, t4.project_name, t4.project_code, t2.total_price_with_tax,t2.partner_code,t2.partner_name,t2.create_time
|
|
|
|
|
from (SELECT sum(invoice_amount) receipt_amount,
|
|
|
|
|
receivable_bill_id
|
|
|
|
|
FROM oms_receivable_invoice_detail
|
|
|
|
|
WHERE write_off_id in
|
|
|
|
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
group by receivable_bill_id) t1
|
|
|
|
|
left join oms_receivable_bill t2 on t1.receivable_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>
|
2025-12-17 03:15:10 +00:00
|
|
|
|
|
|
|
|
<insert id="insertOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into oms_receivable_invoice_detail
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="invoicePlanId != null">invoice_plan_id,</if>
|
|
|
|
|
<if test="receivableBillId != null">receivable_bill_id,</if>
|
|
|
|
|
<if test="invoiceTime != null">invoice_time,</if>
|
|
|
|
|
<if test="invoiceAmount != null">invoice_amount,</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="invoiceAmountWithoutTax != null">invoice_amount_without_tax,</if>
|
|
|
|
|
<if test="invoiceAmountTax != null">invoice_amount_tax,</if>
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="invoiceRate != null">invoice_rate,</if>
|
|
|
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">invoice_bill_code,</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableDetailType != null and receivableDetailType != ''">receivable_detail_type,</if>
|
|
|
|
|
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="invoicePlanId != null">#{invoicePlanId},</if>
|
|
|
|
|
<if test="receivableBillId != null">#{receivableBillId},</if>
|
|
|
|
|
<if test="invoiceTime != null">#{invoiceTime},</if>
|
|
|
|
|
<if test="invoiceAmount != null">#{invoiceAmount},</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="invoiceAmountWithoutTax != null">#{invoiceAmountWithoutTax},</if>
|
|
|
|
|
<if test="invoiceAmountTax != null">#{invoiceAmountTax},</if>
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="invoiceRate != null">#{invoiceRate},</if>
|
|
|
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">#{invoiceBillCode},</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableDetailType != null and receivableDetailType != ''">#{receivableDetailType},</if>
|
|
|
|
|
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
2025-12-23 11:52:57 +00:00
|
|
|
<insert id="insertBatch">
|
|
|
|
|
insert into oms_receivable_invoice_detail(
|
|
|
|
|
invoice_plan_id,receivable_bill_id,invoice_time,invoice_amount,invoice_amount_without_tax,invoice_amount_tax,
|
|
|
|
|
invoice_rate,invoice_bill_code,receivable_detail_type,remark,create_time,create_by,update_time,update_by
|
|
|
|
|
)
|
|
|
|
|
values
|
|
|
|
|
<foreach item="item" collection="list" separator="," index="index">
|
|
|
|
|
(
|
|
|
|
|
#{item.invoicePlanId},#{item.receivableBillId},#{item.invoiceTime},#{item.invoiceAmount},#{item.invoiceAmountWithoutTax},#{item.invoiceAmountTax}
|
|
|
|
|
,#{item.invoiceRate},#{item.invoiceBillCode},#{item.receivableDetailType},#{item.remark},#{item.createTime},#{item.createBy},#{item.updateTime},#{item.updateBy}
|
|
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</insert>
|
2025-12-17 03:15:10 +00:00
|
|
|
|
|
|
|
|
<update id="updateOmsReceivableInvoiceDetail" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoiceDetail">
|
|
|
|
|
update oms_receivable_invoice_detail
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="invoicePlanId != null">invoice_plan_id = #{invoicePlanId},</if>
|
|
|
|
|
<if test="receivableBillId != null">receivable_bill_id = #{receivableBillId},</if>
|
|
|
|
|
<if test="invoiceTime != null">invoice_time = #{invoiceTime},</if>
|
|
|
|
|
<if test="invoiceAmount != null">invoice_amount = #{invoiceAmount},</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="invoiceAmountWithoutTax != null">invoice_amount_without_tax = #{invoiceAmountWithoutTax},</if>
|
|
|
|
|
<if test="invoiceAmountTax != null">invoice_amount_tax = #{invoiceAmountTax},</if>
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="invoiceRate != null">invoice_rate = #{invoiceRate},</if>
|
|
|
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">invoice_bill_code = #{invoiceBillCode},</if>
|
2025-12-22 07:59:31 +00:00
|
|
|
<if test="receivableDetailType != null and receivableDetailType != ''">receivable_detail_type = #{receivableDetailType},</if>
|
|
|
|
|
|
2025-12-17 03:15:10 +00:00
|
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
2025-12-24 08:35:26 +00:00
|
|
|
<update id="clearWriteOff">
|
|
|
|
|
update oms_receivable_invoice_detail set write_off_id = null where write_off_id in
|
|
|
|
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateWriteOffIdBatch">
|
|
|
|
|
<foreach collection="list" item="item" separator=";">
|
|
|
|
|
update oms_receivable_invoice_detail set write_off_id = #{item.writeOffId} where id = #{item.id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
2025-12-17 03:15:10 +00:00
|
|
|
|
|
|
|
|
<delete id="deleteOmsReceivableInvoiceDetailById" parameterType="Long">
|
|
|
|
|
delete from oms_receivable_invoice_detail where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteOmsReceivableInvoiceDetailByIds" parameterType="String">
|
|
|
|
|
delete from oms_receivable_invoice_detail where id in
|
|
|
|
|
<foreach item="id" collection="ids.split(',')" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|