543 lines
22 KiB
XML
543 lines
22 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="invoicePriceWithTax" column="invoice_price_with_tax" />
|
|
<result property="invoicePriceWithoutTax" column="invoice_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" />
|
|
<result property="buyerName" column="buyer_name" />
|
|
<result property="buyerCreditCode" column="buyer_credit_code" />
|
|
<result property="buyerBank" column="buyer_bank" />
|
|
<result property="buyerBankAccount" column="buyer_bank_account" />
|
|
<result property="sellerName" column="seller_name" />
|
|
<result property="sellerCreditCode" column="seller_credit_code" />
|
|
<result property="sellerBank" column="seller_bank" />
|
|
<result property="sellerBankAccount" column="seller_bank_account" />
|
|
</resultMap>
|
|
|
|
<sql id="selectOmsInvoiceBillVo">
|
|
select id, invoice_bill_code, invoice_type, invoice_bill_type,
|
|
invoice_time, partner_code,partner_name, total_price_with_tax, total_price_without_tax,invoice_price_with_tax,invoice_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, buyer_name, buyer_credit_code, buyer_bank, buyer_bank_account,
|
|
seller_name, seller_credit_code, seller_bank, seller_bank_account
|
|
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>
|
|
<if test="buyerName != null and buyerName != ''">
|
|
and buyer_name = #{buyerName}
|
|
</if>
|
|
<if test="buyerCreditCode != null and buyerCreditCode != ''">
|
|
and buyer_credit_code = #{buyerCreditCode}
|
|
</if>
|
|
<if test="buyerBank != null and buyerBank != ''">
|
|
and buyer_bank = #{buyerBank}
|
|
</if>
|
|
<if test="buyerBankAccount != null and buyerBankAccount != ''">
|
|
and buyer_bank_account = #{buyerBankAccount}
|
|
</if>
|
|
<if test="sellerName != null and sellerName != ''">
|
|
and seller_name = #{sellerName}
|
|
</if>
|
|
<if test="sellerCreditCode != null and sellerCreditCode != ''">
|
|
and seller_credit_code = #{sellerCreditCode}
|
|
</if>
|
|
<if test="sellerBank != null and sellerBank != ''">
|
|
and seller_bank = #{sellerBank}
|
|
</if>
|
|
<if test="sellerBankAccount != null and sellerBankAccount != ''">
|
|
and seller_bank_account = #{sellerBankAccount}
|
|
</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="invoicePriceWithTax != null">
|
|
invoice_price_with_tax,
|
|
</if>
|
|
<if test="invoicePriceWithoutTax != null">
|
|
invoice_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>
|
|
<if test="buyerName != null and buyerName != ''">
|
|
buyer_name,
|
|
</if>
|
|
<if test="buyerCreditCode != null and buyerCreditCode != ''">
|
|
buyer_credit_code,
|
|
</if>
|
|
<if test="buyerBank != null and buyerBank != ''">
|
|
buyer_bank,
|
|
</if>
|
|
<if test="buyerBankAccount != null and buyerBankAccount != ''">
|
|
buyer_bank_account,
|
|
</if>
|
|
<if test="sellerName != null and sellerName != ''">
|
|
seller_name,
|
|
</if>
|
|
<if test="sellerCreditCode != null and sellerCreditCode != ''">
|
|
seller_credit_code,
|
|
</if>
|
|
<if test="sellerBank != null and sellerBank != ''">
|
|
seller_bank,
|
|
</if>
|
|
<if test="sellerBankAccount != null and sellerBankAccount != ''">
|
|
seller_bank_account,
|
|
</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="invoicePriceWithTax != null">
|
|
#{invoicePriceWithTax},
|
|
</if>
|
|
<if test="invoicePriceWithoutTax != null">
|
|
#{invoicePriceWithoutTax},
|
|
</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>
|
|
<if test="buyerName != null and buyerName != ''">
|
|
#{buyerName},
|
|
</if>
|
|
<if test="buyerCreditCode != null and buyerCreditCode != ''">
|
|
#{buyerCreditCode},
|
|
</if>
|
|
<if test="buyerBank != null and buyerBank != ''">
|
|
#{buyerBank},
|
|
</if>
|
|
<if test="buyerBankAccount != null and buyerBankAccount != ''">
|
|
#{buyerBankAccount},
|
|
</if>
|
|
<if test="sellerName != null and sellerName != ''">
|
|
#{sellerName},
|
|
</if>
|
|
<if test="sellerCreditCode != null and sellerCreditCode != ''">
|
|
#{sellerCreditCode},
|
|
</if>
|
|
<if test="sellerBank != null and sellerBank != ''">
|
|
#{sellerBank},
|
|
</if>
|
|
<if test="sellerBankAccount != null and sellerBankAccount != ''">
|
|
#{sellerBankAccount},
|
|
</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="invoicePriceWithTax != null">
|
|
invoice_price_with_tax = #{invoicePriceWithTax},
|
|
</if>
|
|
<if test="invoicePriceWithoutTax != null">
|
|
invoice_price_without_tax = #{invoicePriceWithoutTax},
|
|
</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>
|
|
<if test="buyerName != null and buyerName != ''">
|
|
buyer_name = #{buyerName},
|
|
</if>
|
|
<if test="buyerCreditCode != null and buyerCreditCode != ''">
|
|
buyer_credit_code = #{buyerCreditCode},
|
|
</if>
|
|
<if test="buyerBank != null and buyerBank != ''">
|
|
buyer_bank = #{buyerBank},
|
|
</if>
|
|
<if test="buyerBankAccount != null and buyerBankAccount != ''">
|
|
buyer_bank_account = #{buyerBankAccount},
|
|
</if>
|
|
<if test="sellerName != null and sellerName != ''">
|
|
seller_name = #{sellerName},
|
|
</if>
|
|
<if test="sellerCreditCode != null and sellerCreditCode != ''">
|
|
seller_credit_code = #{sellerCreditCode},
|
|
</if>
|
|
<if test="sellerBank != null and sellerBank != ''">
|
|
seller_bank = #{sellerBank},
|
|
</if>
|
|
<if test="sellerBankAccount != null and sellerBankAccount != ''">
|
|
seller_bank_account = #{sellerBankAccount},
|
|
</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>
|
|
<update id="applyInvoice">
|
|
update oms_invoice_bill
|
|
set buyer_name = #{buyerName},
|
|
buyer_credit_code = #{buyerCreditCode},
|
|
buyer_bank = #{buyerBank},
|
|
buyer_bank_account = #{buyerBankAccount},
|
|
seller_name = #{sellerName},
|
|
seller_credit_code = #{sellerCreditCode},
|
|
seller_bank = #{sellerBank},
|
|
seller_bank_account = #{sellerBankAccount},
|
|
approve_status=#{approveStatus}
|
|
where invoice_bill_code = #{invoiceBillCode}
|
|
|
|
</update>
|
|
<update id="clearApprove">
|
|
update oms_invoice_bill
|
|
set approve_status=#{approveStatus},
|
|
approve_time=null
|
|
where id = #{id}
|
|
</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> |