unis_sip/ruoyi-sip/src/main/resources/mapper/sip/OmsTicketBillMapper.xml

337 lines
14 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.OmsTicketBillMapper">
<resultMap type="com.ruoyi.sip.domain.OmsTicketBill" id="OmsTicketBillResult">
<result property="id" column="id" />
<result property="ticketBillCode" column="ticket_bill_code" />
<result property="ticketType" column="ticket_type" />
<result property="ticketBillType" column="ticket_bill_type" />
<result property="vendorTicketTime" column="vendor_ticket_time" />
<result property="ticketTime" column="ticket_time" />
<result property="vendorCode" column="vendor_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="actualTicketTime" column="actual_ticket_time" />
<result property="ticketStatus" column="ticket_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" />
</resultMap>
<sql id="selectOmsTicketBillVo">
select t1.id, t1.ticket_bill_code, t1.ticket_type, t1.ticket_bill_type, t1.vendor_ticket_time, t1.ticket_time, t1.vendor_code,
t1.total_price_with_tax, t1.total_price_without_tax, t1.ticket_price_with_tax, t1.ticket_price_without_tax, t1.tax_rate, t1.create_by, t1.create_time, t1.update_by,
t1.update_time, t1.remark, t1.del_flag, t1.actual_ticket_time, t1.ticket_status, t1.approve_status, t1.approve_node, t1.approve_time, t1.refund_status
,t2.vendor_name
from oms_ticket_bill t1
left join oms_vendor_info t2 on t1.vendor_code=t2.vendor_code
</sql>
<select id="selectOmsTicketBillList" parameterType="com.ruoyi.sip.domain.OmsTicketBill" resultMap="OmsTicketBillResult">
<include refid="selectOmsTicketBillVo"/>
<where>
<if test="ticketBillCode != null and ticketBillCode != ''">
and ticket_bill_code = #{ticketBillCode}
</if>
<if test="ticketType != null and ticketType != ''">
and ticket_type = #{ticketType}
</if>
<if test="ticketBillType != null and ticketBillType != ''">
and ticket_bill_type = #{ticketBillType}
</if>
<if test="vendorCode != null and vendorCode != ''">
and vendor_code = #{vendorCode}
</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 like concat('%', #{remark}, '%')
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
<if test="actualTicketTime != null">
and actual_ticket_time = #{actualTicketTime}
</if>
<if test="ticketStatus != null and ticketStatus != ''">
and ticket_status = #{ticketStatus}
</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>
</where>
</select>
<select id="selectOmsTicketBillById" parameterType="Long" resultMap="OmsTicketBillResult">
<include refid="selectOmsTicketBillVo"/>
where id = #{id}
</select>
<insert id="insertOmsTicketBill" parameterType="com.ruoyi.sip.domain.OmsTicketBill" useGeneratedKeys="true" keyProperty="id">
insert into oms_ticket_bill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketBillCode != null and ticketBillCode != ''">
ticket_bill_code,
</if>
<if test="ticketType != null and ticketType != ''">
ticket_type,
</if>
<if test="ticketBillType != null and ticketBillType != ''">
ticket_bill_type,
</if>
<if test="vendorTicketTime != null">
vendor_ticket_time,
</if>
<if test="ticketTime != null">
ticket_time,
</if>
<if test="vendorCode != null and vendorCode != ''">
vendor_code,
</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="actualTicketTime != null">
actual_ticket_time,
</if>
<if test="ticketStatus != null and ticketStatus != ''">
ticket_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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketBillCode != null and ticketBillCode != ''">
#{ticketBillCode},
</if>
<if test="ticketType != null and ticketType != ''">
#{ticketType},
</if>
<if test="ticketBillType != null and ticketBillType != ''">
#{ticketBillType},
</if>
<if test="vendorTicketTime != null">
#{vendorTicketTime},
</if>
<if test="ticketTime != null">
#{ticketTime},
</if>
<if test="vendorCode != null and vendorCode != ''">
#{vendorCode},
</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="actualTicketTime != null">
#{actualTicketTime},
</if>
<if test="ticketStatus != null and ticketStatus != ''">
#{ticketStatus},
</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>
</trim>
</insert>
<update id="updateOmsTicketBill" parameterType="com.ruoyi.sip.domain.OmsTicketBill">
update oms_ticket_bill
<trim prefix="SET" suffixOverrides=",">
<if test="ticketBillCode != null and ticketBillCode != ''">
ticket_bill_code = #{ticketBillCode},
</if>
<if test="ticketType != null and ticketType != ''">
ticket_type = #{ticketType},
</if>
<if test="ticketBillType != null and ticketBillType != ''">
ticket_bill_type = #{ticketBillType},
</if>
<if test="vendorTicketTime != null">
vendor_ticket_time = #{vendorTicketTime},
</if>
<if test="ticketTime != null">
ticket_time = #{ticketTime},
</if>
<if test="vendorCode != null and vendorCode != ''">
vendor_code = #{vendorCode},
</if>
<if test="totalPriceWithTax != null">
total_price_with_tax = #{totalPriceWithTax},
</if>
<if test="ticketPriceWithTax != null">
ticket_price_with_tax = #{ticketPriceWithTax},
</if>
<if test="totalPriceWithoutTax != null">
total_price_without_tax = #{totalPriceWithoutTax},
</if>
<if test="ticketPriceWithoutTax != null">
ticket_price_without_tax = #{ticketPriceWithoutTax},
</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="actualTicketTime != null">
actual_ticket_time = #{actualTicketTime},
</if>
<if test="ticketStatus != null and ticketStatus != ''">
ticket_status = #{ticketStatus},
</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>
</trim>
where id = #{id}
</update>
<delete id="deleteOmsTicketBillById" parameterType="Long">
delete from oms_ticket_bill where id = #{id}
</delete>
<delete id="deleteOmsTicketBillByIds" parameterType="String">
delete from oms_ticket_bill where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectMaxCodeByPrefix" resultType="int">
SELECT COALESCE(MAX(CAST(SUBSTRING(ticket_bill_code, -4) AS UNSIGNED)), 0)
FROM oms_ticket_bill
WHERE ticket_bill_code LIKE CONCAT(#{codePrefix}, '%')
</select>
</mapper>