398 lines
16 KiB
XML
398 lines
16 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.OmsInvoiceBillMapper">
|
||
|
|
|
||
|
|
<resultMap type="com.ruoyi.sip.domain.OmsInvoiceBill" id="OmsInvoiceBillResult">
|
||
|
|
<result property="id" column="id" />
|
||
|
|
<result property="invoiceBillCode" column="invoice_bill_code" />
|
||
|
|
<result property="invoiceType" column="invoice_type" />
|
||
|
|
<result property="invoiceBillType" column="invoice_bill_type" />
|
||
|
|
|
||
|
|
<result property="invoiceTime" column="invoice_time" />
|
||
|
|
<result property="partnerCode" column="partner_code" />
|
||
|
|
<result property="totalPriceWithTax" column="total_price_with_tax" />
|
||
|
|
<result property="totalPriceWithoutTax" column="total_price_without_tax" />
|
||
|
|
<result property="taxRate" column="tax_rate" />
|
||
|
|
<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="remark" column="remark" />
|
||
|
|
<result property="delFlag" column="del_flag" />
|
||
|
|
<result property="actualInvoiceTime" column="actual_invoice_time" />
|
||
|
|
<result property="invoiceStatus" column="invoice_status" />
|
||
|
|
<result property="approveStatus" column="approve_status" />
|
||
|
|
<result property="approveNode" column="approve_node" />
|
||
|
|
<result property="approveTime" column="approve_time" />
|
||
|
|
<result property="refundStatus" column="refund_status" />
|
||
|
|
<result property="originalBillId" column="original_bill_id" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectOmsInvoiceBillVo">
|
||
|
|
select id, invoice_bill_code, invoice_type, invoice_bill_type,
|
||
|
|
invoice_time, partner_code, total_price_with_tax, total_price_without_tax,
|
||
|
|
tax_rate, create_by, create_time, update_by, update_time,
|
||
|
|
remark, del_flag, actual_invoice_time, invoice_status,
|
||
|
|
approve_status, approve_time, refund_status
|
||
|
|
, original_bill_id
|
||
|
|
from oms_invoice_bill
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectOmsInvoiceBillList" parameterType="com.ruoyi.sip.domain.OmsInvoiceBill" resultMap="OmsInvoiceBillResult">
|
||
|
|
<include refid="selectOmsInvoiceBillVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">
|
||
|
|
and invoice_bill_code = #{invoiceBillCode}
|
||
|
|
</if>
|
||
|
|
<if test="invoiceType != null and invoiceType != ''">
|
||
|
|
and invoice_type = #{invoiceType}
|
||
|
|
</if>
|
||
|
|
<if test="invoiceBillType != null and invoiceBillType != ''">
|
||
|
|
and invoice_bill_type = #{invoiceBillType}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="invoiceTime != null ">
|
||
|
|
and invoice_time = #{invoiceTime}
|
||
|
|
</if>
|
||
|
|
<if test="partnerCode != null and partnerCode != ''">
|
||
|
|
and partner_code = #{partnerCode}
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithTax != null ">
|
||
|
|
and total_price_with_tax = #{totalPriceWithTax}
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithoutTax != null ">
|
||
|
|
and total_price_without_tax = #{totalPriceWithoutTax}
|
||
|
|
</if>
|
||
|
|
<if test="taxRate != null ">
|
||
|
|
and tax_rate = #{taxRate}
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
and create_by = #{createBy}
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null ">
|
||
|
|
and create_time = #{createTime}
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
and update_by = #{updateBy}
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null ">
|
||
|
|
and update_time = #{updateTime}
|
||
|
|
</if>
|
||
|
|
<if test="remark != null and remark != ''">
|
||
|
|
and remark = #{remark}
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null and delFlag != ''">
|
||
|
|
and del_flag = #{delFlag}
|
||
|
|
</if>
|
||
|
|
<if test="actualInvoiceTime != null ">
|
||
|
|
and actual_invoice_time = #{actualInvoiceTime}
|
||
|
|
</if>
|
||
|
|
<if test="invoiceStatus != null and invoiceStatus != ''">
|
||
|
|
and invoice_status = #{invoiceStatus}
|
||
|
|
</if>
|
||
|
|
<if test="approveStatus != null and approveStatus != ''">
|
||
|
|
and approve_status = #{approveStatus}
|
||
|
|
</if>
|
||
|
|
<if test="approveNode != null and approveNode != ''">
|
||
|
|
and approve_node = #{approveNode}
|
||
|
|
</if>
|
||
|
|
<if test="approveTime != null ">
|
||
|
|
and approve_time = #{approveTime}
|
||
|
|
</if>
|
||
|
|
<if test="refundStatus != null and refundStatus != ''">
|
||
|
|
and refund_status = #{refundStatus}
|
||
|
|
</if>
|
||
|
|
<if test="originalBillId != null ">
|
||
|
|
and original_bill_id = #{originalBillId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectOmsInvoiceBillById" parameterType="Long" resultMap="OmsInvoiceBillResult">
|
||
|
|
<include refid="selectOmsInvoiceBillVo"/>
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertOmsInvoiceBill" parameterType="com.ruoyi.sip.domain.OmsInvoiceBill" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into oms_invoice_bill
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">
|
||
|
|
invoice_bill_code,
|
||
|
|
</if>
|
||
|
|
<if test="invoiceType != null and invoiceType != ''">
|
||
|
|
invoice_type,
|
||
|
|
</if>
|
||
|
|
<if test="invoiceBillType != null and invoiceBillType != ''">
|
||
|
|
invoice_bill_type,
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="invoiceTime != null">
|
||
|
|
invoice_time,
|
||
|
|
</if>
|
||
|
|
<if test="partnerCode != null and partnerCode != ''">
|
||
|
|
partner_code,
|
||
|
|
</if>
|
||
|
|
<if test="partnerName != null and partnerName != ''">
|
||
|
|
partner_name,
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithTax != null">
|
||
|
|
total_price_with_tax,
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithoutTax != null">
|
||
|
|
total_price_without_tax,
|
||
|
|
</if>
|
||
|
|
<if test="taxRate != null">
|
||
|
|
tax_rate,
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
create_by,
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time,
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
update_by,
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
update_time,
|
||
|
|
</if>
|
||
|
|
<if test="remark != null and remark != ''">
|
||
|
|
remark,
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null and delFlag != ''">
|
||
|
|
del_flag,
|
||
|
|
</if>
|
||
|
|
<if test="actualInvoiceTime != null">
|
||
|
|
actual_invoice_time,
|
||
|
|
</if>
|
||
|
|
<if test="invoiceStatus != null and invoiceStatus != ''">
|
||
|
|
invoice_status,
|
||
|
|
</if>
|
||
|
|
<if test="approveStatus != null and approveStatus != ''">
|
||
|
|
approve_status,
|
||
|
|
</if>
|
||
|
|
<if test="approveNode != null and approveNode != ''">
|
||
|
|
approve_node,
|
||
|
|
</if>
|
||
|
|
<if test="approveTime != null">
|
||
|
|
approve_time,
|
||
|
|
</if>
|
||
|
|
<if test="refundStatus != null and refundStatus != ''">
|
||
|
|
refund_status,
|
||
|
|
</if>
|
||
|
|
<if test="originalBillId != null">
|
||
|
|
original_bill_id,
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">
|
||
|
|
#{invoiceBillCode},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceType != null and invoiceType != ''">
|
||
|
|
#{invoiceType},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceBillType != null and invoiceBillType != ''">
|
||
|
|
#{invoiceBillType},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceTime != null">
|
||
|
|
#{invoiceTime},
|
||
|
|
</if>
|
||
|
|
<if test="partnerCode != null and partnerCode != ''">
|
||
|
|
#{partnerCode},
|
||
|
|
</if>
|
||
|
|
<if test="partnerName != null and partnerName != ''">
|
||
|
|
#{partnerName},
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithTax != null">
|
||
|
|
#{totalPriceWithTax},
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithoutTax != null">
|
||
|
|
#{totalPriceWithoutTax},
|
||
|
|
</if>
|
||
|
|
<if test="taxRate != null">
|
||
|
|
#{taxRate},
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
#{createBy},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
#{createTime},
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
#{updateBy},
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
#{updateTime},
|
||
|
|
</if>
|
||
|
|
<if test="remark != null and remark != ''">
|
||
|
|
#{remark},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null and delFlag != ''">
|
||
|
|
#{delFlag},
|
||
|
|
</if>
|
||
|
|
<if test="actualInvoiceTime != null">
|
||
|
|
#{actualInvoiceTime},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceStatus != null and invoiceStatus != ''">
|
||
|
|
#{invoiceStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveStatus != null and approveStatus != ''">
|
||
|
|
#{approveStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveNode != null and approveNode != ''">
|
||
|
|
#{approveNode},
|
||
|
|
</if>
|
||
|
|
<if test="approveTime != null">
|
||
|
|
#{approveTime},
|
||
|
|
</if>
|
||
|
|
<if test="refundStatus != null and refundStatus != ''">
|
||
|
|
#{refundStatus},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="originalBillId != null">
|
||
|
|
#{originalBillId},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateOmsInvoiceBill" parameterType="com.ruoyi.sip.domain.OmsInvoiceBill">
|
||
|
|
update oms_invoice_bill
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="invoiceBillCode != null and invoiceBillCode != ''">
|
||
|
|
invoice_bill_code = #{invoiceBillCode},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceType != null and invoiceType != ''">
|
||
|
|
invoice_type = #{invoiceType},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceBillType != null and invoiceBillType != ''">
|
||
|
|
invoice_bill_type = #{invoiceBillType},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="invoiceTime != null">
|
||
|
|
invoice_time = #{invoiceTime},
|
||
|
|
</if>
|
||
|
|
<if test="partnerCode != null and partnerCode != ''">
|
||
|
|
partner_code = #{partnerCode},
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithTax != null">
|
||
|
|
total_price_with_tax = #{totalPriceWithTax},
|
||
|
|
</if>
|
||
|
|
<if test="totalPriceWithoutTax != null">
|
||
|
|
total_price_without_tax = #{totalPriceWithoutTax},
|
||
|
|
</if>
|
||
|
|
<if test="taxRate != null">
|
||
|
|
tax_rate = #{taxRate},
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
create_by = #{createBy},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time = #{createTime},
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null and updateBy != ''">
|
||
|
|
update_by = #{updateBy},
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
update_time = #{updateTime},
|
||
|
|
</if>
|
||
|
|
<if test="remark != null and remark != ''">
|
||
|
|
remark = #{remark},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null and delFlag != ''">
|
||
|
|
del_flag = #{delFlag},
|
||
|
|
</if>
|
||
|
|
<if test="actualInvoiceTime != null">
|
||
|
|
actual_invoice_time = #{actualInvoiceTime},
|
||
|
|
</if>
|
||
|
|
<if test="invoiceStatus != null and invoiceStatus != ''">
|
||
|
|
invoice_status = #{invoiceStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveStatus != null and approveStatus != ''">
|
||
|
|
approve_status = #{approveStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveNode != null and approveNode != ''">
|
||
|
|
approve_node = #{approveNode},
|
||
|
|
</if>
|
||
|
|
<if test="approveTime != null">
|
||
|
|
approve_time = #{approveTime},
|
||
|
|
</if>
|
||
|
|
<if test="refundStatus != null and refundStatus != ''">
|
||
|
|
refund_status = #{refundStatus},
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="originalBillId != null">
|
||
|
|
original_bill_id = #{originalBillId},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateOmsInvoiceBillByCode" parameterType="com.ruoyi.sip.domain.OmsInvoiceBill">
|
||
|
|
update oms_invoice_bill
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="invoiceStatus != null and invoiceStatus != ''">
|
||
|
|
invoice_status = #{invoiceStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveStatus != null and approveStatus != ''">
|
||
|
|
approve_status = #{approveStatus},
|
||
|
|
</if>
|
||
|
|
<if test="approveNode != null and approveNode != ''">
|
||
|
|
approve_node = #{approveNode},
|
||
|
|
</if>
|
||
|
|
<if test="approveTime != null">
|
||
|
|
approve_time = #{approveTime},
|
||
|
|
</if>
|
||
|
|
<if test="actualInvoiceTime != null">
|
||
|
|
actual_invoice_time = #{actualInvoiceTime},
|
||
|
|
</if>
|
||
|
|
<if test="refundStatus != null and refundStatus != ''">
|
||
|
|
refund_status = #{refundStatus},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
where invoice_bill_code = #{invoiceBillCode}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteOmsInvoiceBillById" parameterType="Long">
|
||
|
|
delete from oms_invoice_bill where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteOmsInvoiceBillByIds" parameterType="String">
|
||
|
|
delete from oms_invoice_bill where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
<delete id="clearRelationReceivable">
|
||
|
|
delete from oms_receivable_invoice_detail where invoice_bill_code=#{code}
|
||
|
|
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="listApprove" resultType="com.ruoyi.sip.domain.OmsInvoiceBill">
|
||
|
|
select t1.* from oms_invoice_bill t1
|
||
|
|
left join ${tablename} t2 on t1.invoice_bill_code = t2.business_key
|
||
|
|
where 1=1
|
||
|
|
<if test="omsInvoiceBill.invoiceBillCode != null and omsInvoiceBill.invoiceBillCode != ''">
|
||
|
|
and t1.invoice_bill_code = #{omsInvoiceBill.invoiceBillCode}
|
||
|
|
</if>
|
||
|
|
<if test="omsInvoiceBill.partnerCode != null and omsInvoiceBill.partnerCode != ''">
|
||
|
|
and t1.partner_code = #{omsInvoiceBill.partnerCode}
|
||
|
|
</if>
|
||
|
|
<if test="omsInvoiceBill.approveUser != null">
|
||
|
|
and t2.assignee_user_id = #{omsInvoiceBill.approveUser}
|
||
|
|
</if>
|
||
|
|
order by t1.create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectOmsInvoiceBillByCode" resultType="com.ruoyi.sip.domain.OmsInvoiceBill">
|
||
|
|
<include refid="selectOmsInvoiceBillVo"/>
|
||
|
|
where invoice_bill_code = #{invoiceBillCode} and del_flag = '0'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectMaxCodeByPrefix" resultType="java.lang.Integer">
|
||
|
|
select COALESCE(MAX(CAST(SUBSTRING(invoice_bill_code, #{codePrefix.length() + 1}) AS UNSIGNED)), 0)
|
||
|
|
from oms_invoice_bill
|
||
|
|
where invoice_bill_code LIKE CONCAT(#{codePrefix}, '%')
|
||
|
|
</select>
|
||
|
|
</mapper>
|