unis_sip/ruoyi-sip/src/main/resources/mapper/OmsReceiptBill/OmsReceiptBillMapper.xml

455 lines
18 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.OmsReceiptBillMapper">
<resultMap type="com.ruoyi.sip.domain.OmsReceiptBill" id="OmsReceiptBillMap">
<result property="id" column="id"/>
<result property="receiptBillCode" column="receipt_bill_code"/>
<result property="receiptBillType" column="receipt_bill_type"/>
<result property="receiptTime" column="receipt_time"/>
<result property="actualReceiptTime" column="actual_receipt_time"/>
<result property="partnerCode" column="partner_code"/>
<result property="orderCode" column="order_code"/>
<result property="totalPriceWithTax" column="total_price_with_tax"/>
<result property="totalPriceWithoutTax" column="total_price_without_tax"/>
<result property="taxAmount" column="tax_amount"/>
<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="projectCode" column="project_code"/>
<result property="projectName" column="project_name"/>
<result property="receiptStatus" column="receipt_status"/>
<result property="approveStatus" column="approve_status"/>
<result property="approveNode" column="approve_node"/>
<result property="approveTime" column="approve_time"/>
<result property="receiptMethod" column="receipt_method"/>
<result property="receiptAccountName" column="receipt_account_name"/>
<result property="receiptBankNumber" column="receipt_bank_number"/>
<result property="receiptBankOpenAddress" column="receipt_bank_open_address"/>
<result property="bankNumber" column="bank_number"/>
<result property="refundStatus" column="refund_status"/>
</resultMap>
<!-- 基本字段 -->
<sql id="Base_Column_List">
id, receipt_bill_code, receipt_bill_type, receipt_time, actual_receipt_time, partner_code, order_code, total_price_with_tax, total_price_without_tax, tax_amount, create_by, create_time, update_by, update_time, remark, del_flag, project_code, project_name, receipt_status, approve_status, approve_node, approve_time, receipt_method, receipt_account_name, receipt_bank_number, receipt_bank_open_address, bank_number, refund_status
</sql>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="OmsReceiptBillMap">
select
<include refid="Base_Column_List"/>
from oms_receipt_bill
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="receiptBillCode != null and receiptBillCode != ''">
and receipt_bill_code = #{receiptBillCode}
</if>
<if test="receiptBillType != null and receiptBillType != ''">
and receipt_bill_type = #{receiptBillType}
</if>
<if test="receiptTime != null">
and receipt_time = #{receiptTime}
</if>
<if test="actualReceiptTime != null">
and actual_receipt_time = #{actualReceiptTime}
</if>
<if test="partnerCode != null and partnerCode != ''">
and partner_code = #{partnerCode}
</if>
<if test="orderCode != null and orderCode != ''">
and order_code = #{orderCode}
</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="taxAmount != null">
and tax_amount = #{taxAmount}
</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="projectCode != null and projectCode != ''">
and project_code = #{projectCode}
</if>
<if test="projectName != null and projectName != ''">
and project_name = #{projectName}
</if>
<if test="receiptStatus != null and receiptStatus != ''">
and receipt_status = #{receiptStatus}
</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="receiptMethod != null and receiptMethod != ''">
and receipt_method = #{receiptMethod}
</if>
<if test="receiptAccountName != null and receiptAccountName != ''">
and receipt_account_name = #{receiptAccountName}
</if>
<if test="receiptBankNumber != null and receiptBankNumber != ''">
and receipt_bank_number = #{receiptBankNumber}
</if>
<if test="receiptBankOpenAddress != null and receiptBankOpenAddress != ''">
and receipt_bank_open_address = #{receiptBankOpenAddress}
</if>
<if test="bankNumber != null and bankNumber != ''">
and bank_number = #{bankNumber}
</if>
<if test="refundStatus != null and refundStatus != ''">
and refund_status = #{refundStatus}
</if>
</where>
</select>
<!--根据ID查详情-->
<select id="queryById" parameterType="Integer" resultMap="OmsReceiptBillMap">
SELECT id,
receipt_bill_code,
receipt_bill_type,
receipt_time,
actual_receipt_time,
partner_code,
order_code,
total_price_with_tax,
total_price_without_tax,
tax_amount,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag,
project_code,
project_name,
receipt_status,
approve_status,
approve_node,
approve_time,
receipt_method,
receipt_account_name,
receipt_bank_number,
receipt_bank_open_address,
bank_number,
refund_status
FROM oms_receipt_bill
WHERE id = #{id}
LIMIT 1
</select>
<select id="selectMaxCodeByPrefix" resultType="java.lang.Integer">
SELECT IFNULL(MAX(CAST(SUBSTRING(receipt_bill_code, LENGTH(#{prefix}) + 1) AS SIGNED)), 0)
FROM oms_receipt_bill
WHERE receipt_bill_code LIKE CONCAT(#{prefix}, '%')
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO oms_receipt_bill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receiptBillCode != null and receiptBillCode != ''">
receipt_bill_code,
</if>
<if test="receiptBillType != null and receiptBillType != ''">
receipt_bill_type,
</if>
<if test="receiptTime != null">
receipt_time,
</if>
<if test="actualReceiptTime != null">
actual_receipt_time,
</if>
<if test="partnerCode != null and partnerCode != ''">
partner_code,
</if>
<if test="orderCode != null and orderCode != ''">
order_code,
</if>
<if test="totalPriceWithTax != null">
total_price_with_tax,
</if>
<if test="totalPriceWithoutTax != null">
total_price_without_tax,
</if>
<if test="taxAmount != null">
tax_amount,
</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="projectCode != null and projectCode != ''">
project_code,
</if>
<if test="projectName != null and projectName != ''">
project_name,
</if>
<if test="receiptStatus != null and receiptStatus != ''">
receipt_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="receiptMethod != null and receiptMethod != ''">
receipt_method,
</if>
<if test="receiptAccountName != null and receiptAccountName != ''">
receipt_account_name,
</if>
<if test="receiptBankNumber != null and receiptBankNumber != ''">
receipt_bank_number,
</if>
<if test="receiptBankOpenAddress != null and receiptBankOpenAddress != ''">
receipt_bank_open_address,
</if>
<if test="bankNumber != null and bankNumber != ''">
bank_number,
</if>
<if test="refundStatus != null and refundStatus != ''">
refund_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="receiptBillCode != null and receiptBillCode != ''">
#{receiptBillCode},
</if>
<if test="receiptBillType != null and receiptBillType != ''">
#{receiptBillType},
</if>
<if test="receiptTime != null">
#{receiptTime},
</if>
<if test="actualReceiptTime != null">
#{actualReceiptTime},
</if>
<if test="partnerCode != null and partnerCode != ''">
#{partnerCode},
</if>
<if test="orderCode != null and orderCode != ''">
#{orderCode},
</if>
<if test="totalPriceWithTax != null">
#{totalPriceWithTax},
</if>
<if test="totalPriceWithoutTax != null">
#{totalPriceWithoutTax},
</if>
<if test="taxAmount != null">
#{taxAmount},
</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="projectCode != null and projectCode != ''">
#{projectCode},
</if>
<if test="projectName != null and projectName != ''">
#{projectName},
</if>
<if test="receiptStatus != null and receiptStatus != ''">
#{receiptStatus},
</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="receiptMethod != null and receiptMethod != ''">
#{receiptMethod},
</if>
<if test="receiptAccountName != null and receiptAccountName != ''">
#{receiptAccountName},
</if>
<if test="receiptBankNumber != null and receiptBankNumber != ''">
#{receiptBankNumber},
</if>
<if test="receiptBankOpenAddress != null and receiptBankOpenAddress != ''">
#{receiptBankOpenAddress},
</if>
<if test="bankNumber != null and bankNumber != ''">
#{bankNumber},
</if>
<if test="refundStatus != null and refundStatus != ''">
#{refundStatus},
</if>
</trim>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE oms_receipt_bill
<trim prefix="SET" suffixOverrides=",">
<if test="receiptBillCode != null and receiptBillCode != ''">
receipt_bill_code = #{receiptBillCode},
</if>
<if test="receiptBillType != null and receiptBillType != ''">
receipt_bill_type = #{receiptBillType},
</if>
<if test="receiptTime != null">
receipt_time = #{receiptTime},
</if>
<if test="actualReceiptTime != null">
actual_receipt_time = #{actualReceiptTime},
</if>
<if test="partnerCode != null and partnerCode != ''">
partner_code = #{partnerCode},
</if>
<if test="orderCode != null and orderCode != ''">
order_code = #{orderCode},
</if>
<if test="totalPriceWithTax != null">
total_price_with_tax = #{totalPriceWithTax},
</if>
<if test="totalPriceWithoutTax != null">
total_price_without_tax = #{totalPriceWithoutTax},
</if>
<if test="taxAmount != null">
tax_amount = #{taxAmount},
</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="projectCode != null and projectCode != ''">
project_code = #{projectCode},
</if>
<if test="projectName != null and projectName != ''">
project_name = #{projectName},
</if>
<if test="receiptStatus != null and receiptStatus != ''">
receipt_status = #{receiptStatus},
</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="receiptMethod != null and receiptMethod != ''">
receipt_method = #{receiptMethod},
</if>
<if test="receiptAccountName != null and receiptAccountName != ''">
receipt_account_name = #{receiptAccountName},
</if>
<if test="receiptBankNumber != null and receiptBankNumber != ''">
receipt_bank_number = #{receiptBankNumber},
</if>
<if test="receiptBankOpenAddress != null and receiptBankOpenAddress != ''">
receipt_bank_open_address = #{receiptBankOpenAddress},
</if>
<if test="bankNumber != null and bankNumber != ''">
bank_number = #{bankNumber},
</if>
<if test="refundStatus != null and refundStatus != ''">
refund_status = #{refundStatus},
</if>
</trim>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM oms_receipt_bill
WHERE id = #{id}
</delete>
<!--通过id批量删除-->
<delete id="batchRemove">
delete from oms_receipt_bill where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>