2025-12-11 12:06:23 +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.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}
2025-12-18 08:13:40 +00:00
</if>
<if test= "ticketBillCodeList != null and ticketBillCodeList.size>0" >
and ticket_bill_code in <foreach item= "item" collection= "ticketBillCodeList" separator= "," open= "(" close= ")" index= "" >
#{item}
</foreach>
2025-12-11 12:06:23 +00:00
</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>
2025-12-16 06:47:15 +00:00
<update id= "updateOmsTicketBillByCode" >
update oms_ticket_bill
<trim prefix= "SET" suffixOverrides= "," >
<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 ticket_bill_code = #{ticketBillCode}
</update>
2025-12-18 08:13:40 +00:00
<update id= "updateReturnWriteOffBatch" >
<foreach collection= "list" item= "item" separator= ";" >
update oms_ticket_bill
set
ticket_status=#{item.ticketStatus},
approve_status=#{item.approveStatus},
approve_time=null,
update_time=now()
where id = #{item.id}
</foreach>
</update>
2025-12-11 12:06:23 +00:00
<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>
2025-12-16 07:45:14 +00:00
<select id= "listApprove" resultType= "com.ruoyi.sip.domain.OmsTicketBill" >
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
,t3.apply_time,t3.process_key,t3.todo_id,t3.task_id
<if test= "'bu_todo_completed'.equals(tableName)" >
,t3.approve_time as todo_approve_time
</if>
from oms_ticket_bill t1
left join oms_vendor_info t2 on t1.vendor_code=t2.vendor_code
inner join ${tableName} t3 on (t3.process_key in (#{entity.processKey}) and t3.approve_user=#{entity.approveUser} and t3.task_name!='商务' and t3.business_key=t1.ticket_bill_code)
<where >
<if test= "entity.ticketBillCode != null and entity.ticketBillCode != ''" >
and t1.ticket_bill_code = #{entity.ticketBillCode}
</if>
<if test= "entity.ticketType != null and entity.ticketType != ''" >
and t1.ticket_type = #{entity.ticketType}
</if>
<if test= "entity.ticketBillType != null and entity.ticketBillType != ''" >
and t1.ticket_bill_type = #{entity.ticketBillType}
</if>
<if test= "entity.vendorCode != null and entity.vendorCode != ''" >
and t1.vendor_code = #{entity.vendorCode}
</if>
<if test= "entity.totalPriceWithTax != null" >
and t1.total_price_with_tax = #{entity.totalPriceWithTax}
</if>
<if test= "entity.totalPriceWithoutTax != null" >
and t1.total_price_without_tax = #{entity.totalPriceWithoutTax}
</if>
<if test= "entity.taxRate != null" >
and t1.tax_rate = #{entity.taxRate}
</if>
<if test= "entity.createBy != null and entity.createBy != ''" >
and t1.create_by = #{entity.createBy}
</if>
<if test= "entity.createTime != null" >
and t1.create_time = #{entity.createTime}
</if>
<if test= "entity.updateBy != null and entity.updateBy != ''" >
and t1.update_by = #{entity.updateBy}
</if>
<if test= "entity.updateTime != null" >
and t1.update_time = #{entity.updateTime}
</if>
<if test= "entity.remark != null and entity.remark != ''" >
and t1.remark like concat('%', #{entity.remark}, '%')
</if>
<if test= "entity.delFlag != null and entity.delFlag != ''" >
and t1.del_flag = #{entity.delFlag}
</if>
<if test= "entity.actualTicketTime != null" >
and t1.actual_ticket_time = #{entity.actualTicketTime}
</if>
<if test= "entity.ticketStatus != null and entity.ticketStatus != ''" >
and t1.ticket_status = #{entity.ticketStatus}
</if>
<if test= "entity.approveStatus != null and entity.approveStatus != ''" >
and t1.approve_status = #{entity.approveStatus}
</if>
<if test= "entity.approveNode != null and entity.approveNode != ''" >
and t1.approve_node = #{entity.approveNode}
</if>
<if test= "entity.approveTime != null" >
and t1.approve_time = #{entity.approveTime}
</if>
<if test= "entity.refundStatus != null and entity.refundStatus != ''" >
and t1.refund_status = #{entity.refundStatus}
</if>
</where>
</select>
2025-12-18 08:13:40 +00:00
<select id= "selectOmsTicketBillByCode" resultType= "com.ruoyi.sip.domain.OmsTicketBill" >
<include refid= "selectOmsTicketBillVo" />
where ticket_bill_code = #{ticketBillCode}</select>
2025-12-11 12:06:23 +00:00
</mapper>