2025-10-22 07:45:13 +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.OmsPaymentBillMapper" >
<resultMap type= "OmsPaymentBill" id= "OmsPaymentBillResult" >
<result property= "id" column= "id" />
<result property= "paymentBillCode" column= "payment_bill_code" />
<result property= "paymentBillType" column= "payment_bill_type" />
<result property= "paymentTime" column= "payment_time" />
<result property= "vendorCode" column= "vendor_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" />
2025-12-09 01:11:32 +00:00
<result property= "projectCode" column= "project_code" />
<result property= "projectName" column= "project_name" />
<result property= "preResidueAmount" column= "pre_residue_amount" />
<result property= "actualPaymentTime" column= "actual_payment_time" />
<result property= "paymentStatus" column= "payment_status" />
<result property= "approveStatus" column= "approve_status" />
<result property= "approveNode" column= "approve_node" />
<result property= "approveTime" column= "approve_time" />
<result property= "paymentMethod" column= "payment_method" />
<result property= "payableBillCode" column= "payable_bill_code" />
<result property= "payName" column= "pay_name" />
<result property= "payBankNumber" column= "pay_bank_number" />
<result property= "payBankOpenAddress" column= "pay_bank_open_address" />
<result property= "bankNumber" column= "bank_number" />
2025-12-09 12:51:15 +00:00
2025-12-09 01:11:32 +00:00
<result property= "refundStatus" column= "refund_status" />
</resultMap>
<resultMap type= "com.ruoyi.sip.domain.dto.PaymentBillDetailDTO" id= "PaymentBillDetailResult" >
<result property= "id" column= "id" />
<result property= "paymentBillCode" column= "payment_bill_code" />
<result property= "paymentTime" column= "payment_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= "taxAmount" column= "tax_amount" />
<result property= "paymentBillType" column= "payment_bill_type" />
<result property= "preResidueAmount" column= "pre_residue_amount" />
<result property= "actualPaymentTime" column= "actual_payment_time" />
<result property= "paymentMethod" column= "payment_method" />
<result property= "paymentStatus" column= "payment_status" />
<result property= "remark" column= "remark" />
<result property= "createBy" column= "create_by" />
<result property= "payName" column= "pay_name" />
<result property= "payBankNumber" column= "pay_bank_number" />
<result property= "payBankOpenAddress" column= "pay_bank_open_address" />
<result property= "bankNumber" column= "bank_number" />
<result property= "approveNode" column= "approve_node" />
<result property= "approveStatus" column= "approve_status" />
<result property= "approveTime" column= "approve_time" />
</resultMap>
<resultMap type= "com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO" id= "PaymentBillPayableDetailResult" >
<result property= "projectCode" column= "project_code" />
<result property= "projectName" column= "project_name" />
<result property= "payableBillCode" column= "payable_bill_code" />
<result property= "totalPriceWithTax" column= "total_price_with_tax" />
<result property= "paymentAmount" column= "payment_amount" />
<result property= "paymentRate" column= "payment_rate" />
2025-10-22 07:45:13 +00:00
</resultMap>
<sql id= "selectOmsPaymentBillVo" >
2025-12-09 01:11:32 +00:00
select
pb.id,
pb.payment_bill_code,
pb.payment_bill_type,
pb.payment_time,
pb.vendor_code,
pb.order_code,
pb.total_price_with_tax,
pb.total_price_without_tax,
pb.tax_amount,
pb.create_by,
pb.create_time,
pb.update_by,
pb.update_time,
pb.remark,
pb.del_flag,
pb.project_code,
pb.project_name,
pb.pre_residue_amount,
pb.actual_payment_time,
pb.payment_status,
pb.approve_status,
pb.approve_node,
pb.approve_time,
pb.payment_method,
pb.pay_name,
pb.pay_bank_number,
pb.pay_bank_open_address,
pb.bank_number,
2025-12-09 12:51:15 +00:00
2025-12-09 01:11:32 +00:00
pb.refund_status,
ovi.vendor_name
from oms_payment_bill pb
left join oms_vendor_info ovi on pb.vendor_code = ovi.vendor_code
2025-10-22 07:45:13 +00:00
</sql>
<select id= "selectOmsPaymentBillList" parameterType= "OmsPaymentBill" resultMap= "OmsPaymentBillResult" >
<include refid= "selectOmsPaymentBillVo" />
2025-12-09 01:11:32 +00:00
<where >
<if test= "paymentBillCode != null and paymentBillCode != ''" > and pb.payment_bill_code like concat('%', #{paymentBillCode}, '%')</if>
<if test= "paymentBillType != null and paymentBillType != ''" > and pb.payment_bill_type = #{paymentBillType}</if>
<if test= "paymentTime != null " > and date_format(pb.payment_time,'%Y-%m-%d') = date_format(#{paymentTime},'%Y-%m-%d')</if>
<if test= "vendorCode != null and vendorCode != ''" > and pb.vendor_code like concat('%', #{vendorCode}, '%')</if>
<if test= "orderCode != null and orderCode != ''" > and pb.order_code like concat('%', #{orderCode}, '%')</if>
<if test= "totalPriceWithTax != null " > and pb.total_price_with_tax = #{totalPriceWithTax}</if>
<if test= "totalPriceWithoutTax != null " > and pb.total_price_without_tax = #{totalPriceWithoutTax}</if>
<if test= "taxAmount != null " > and pb.tax_amount = #{taxAmount}</if>
<if test= "projectCode != null and projectCode != ''" > and pb.project_code like concat('%', #{projectCode}, '%')</if>
<if test= "projectName != null and projectName != ''" > and pb.project_name like concat('%', #{projectName}, '%')</if>
<if test= "paymentStatus != null and paymentStatus != ''" > and pb.payment_status = #{paymentStatus}</if>
<if test= "approveStatus != null and approveStatus != ''" > and pb.approve_status = #{approveStatus}</if>
<if test= "approveNode != null and approveNode != ''" > and pb.approve_node = #{approveNode}</if>
<if test= "approveTime != null " > and date_format(pb.approve_time,'%Y-%m-%d') = date_format(#{approveTime},'%Y-%m-%d')</if>
<if test= "actualPaymentTime != null " > and date_format(pb.actual_payment_time,'%Y-%m-%d') = date_format(#{actualPaymentTime},'%Y-%m-%d')</if>
<if test= "paymentMethod != null and paymentMethod != ''" > and pb.payment_method = #{paymentMethod}</if>
<if test= "payableBillCode != null and payableBillCode != ''" > and apb.payable_bill_code like concat('%', #{payableBillCode}, '%')</if>
and pb.del_flag = '0'
2025-10-22 07:45:13 +00:00
</where>
2025-12-09 01:11:32 +00:00
group by pb.id
order by pb.create_time desc
2025-10-22 07:45:13 +00:00
</select>
<select id= "selectOmsPaymentBillById" parameterType= "Long" resultMap= "OmsPaymentBillResult" >
<include refid= "selectOmsPaymentBillVo" />
2025-12-09 01:11:32 +00:00
where pb.id = #{id}
2025-12-16 06:47:15 +00:00
2025-10-22 07:45:13 +00:00
</select>
<insert id= "insertOmsPaymentBill" parameterType= "OmsPaymentBill" useGeneratedKeys= "true" keyProperty= "id" >
insert into oms_payment_bill
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "paymentBillCode != null and paymentBillCode != ''" > payment_bill_code,</if>
<if test= "paymentBillType != null" > payment_bill_type,</if>
<if test= "paymentTime != null" > payment_time,</if>
<if test= "vendorCode != null" > vendor_code,</if>
<if test= "orderCode != null" > 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" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "remark != null" > remark,</if>
<if test= "delFlag != null" > del_flag,</if>
2025-12-09 01:11:32 +00:00
<if test= "projectCode != null" > project_code,</if>
<if test= "projectName != null" > project_name,</if>
<if test= "preResidueAmount != null" > pre_residue_amount,</if>
<if test= "actualPaymentTime != null" > actual_payment_time,</if>
<if test= "paymentStatus != null" > payment_status,</if>
<if test= "approveStatus != null" > approve_status,</if>
<if test= "approveNode != null" > approve_node,</if>
<if test= "approveTime != null" > approve_time,</if>
<if test= "paymentMethod != null" > payment_method,</if>
<if test= "payName != null" > pay_name,</if>
<if test= "payBankNumber != null" > pay_bank_number,</if>
<if test= "payBankOpenAddress != null" > pay_bank_open_address,</if>
<if test= "bankNumber != null" > bank_number,</if>
<if test= "refundStatus != null" > refund_status,</if>
2025-10-22 07:45:13 +00:00
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "paymentBillCode != null and paymentBillCode != ''" > #{paymentBillCode},</if>
<if test= "paymentBillType != null" > #{paymentBillType},</if>
<if test= "paymentTime != null" > #{paymentTime},</if>
<if test= "vendorCode != null" > #{vendorCode},</if>
<if test= "orderCode != null" > #{orderCode},</if>
<if test= "totalPriceWithTax != null" > #{totalPriceWithTax},</if>
<if test= "totalPriceWithoutTax != null" > #{totalPriceWithoutTax},</if>
<if test= "taxAmount != null" > #{taxAmount},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "delFlag != null" > #{delFlag},</if>
2025-12-09 01:11:32 +00:00
<if test= "projectCode != null" > #{projectCode},</if>
<if test= "projectName != null" > #{projectName},</if>
<if test= "preResidueAmount != null" > #{preResidueAmount},</if>
<if test= "actualPaymentTime != null" > #{actualPaymentTime},</if>
<if test= "paymentStatus != null" > #{paymentStatus},</if>
<if test= "approveStatus != null" > #{approveStatus},</if>
<if test= "approveNode != null" > #{approveNode},</if>
<if test= "approveTime != null" > #{approveTime},</if>
<if test= "paymentMethod != null" > #{paymentMethod},</if>
<if test= "payName != null" > #{payName},</if>
<if test= "payBankNumber != null" > #{payBankNumber},</if>
<if test= "payBankOpenAddress != null" > #{payBankOpenAddress},</if>
<if test= "bankNumber != null" > #{bankNumber},</if>
<if test= "refundStatus != null" > #{refundStatus},</if>
2025-10-22 07:45:13 +00:00
</trim>
</insert>
<update id= "updateOmsPaymentBill" parameterType= "OmsPaymentBill" >
update oms_payment_bill
<trim prefix= "SET" suffixOverrides= "," >
<if test= "paymentBillCode != null and paymentBillCode != ''" > payment_bill_code = #{paymentBillCode},</if>
<if test= "paymentBillType != null" > payment_bill_type = #{paymentBillType},</if>
<if test= "paymentTime != null" > payment_time = #{paymentTime},</if>
<if test= "vendorCode != null" > vendor_code = #{vendorCode},</if>
<if test= "orderCode != null" > 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" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "remark != null" > remark = #{remark},</if>
<if test= "delFlag != null" > del_flag = #{delFlag},</if>
2025-12-09 01:11:32 +00:00
<if test= "projectCode != null" > project_code = #{projectCode},</if>
<if test= "projectName != null" > project_name = #{projectName},</if>
<if test= "preResidueAmount != null" > pre_residue_amount = #{preResidueAmount},</if>
<if test= "actualPaymentTime != null" > actual_payment_time = #{actualPaymentTime},</if>
<if test= "paymentStatus != null" > payment_status = #{paymentStatus},</if>
<if test= "approveStatus != null" > approve_status = #{approveStatus},</if>
<if test= "approveNode != null" > approve_node = #{approveNode},</if>
<if test= "approveTime != null" > approve_time = #{approveTime},</if>
<if test= "paymentMethod != null" > payment_method = #{paymentMethod},</if>
<if test= "payName != null" > pay_name = #{payName},</if>
<if test= "payBankNumber != null" > pay_bank_number = #{payBankNumber},</if>
<if test= "payBankOpenAddress != null" > pay_bank_open_address = #{payBankOpenAddress},</if>
<if test= "bankNumber != null" > bank_number = #{bankNumber},</if>
2025-12-09 12:51:15 +00:00
2025-12-09 01:11:32 +00:00
<if test= "refundStatus != null" > refund_status = #{refundStatus},</if>
2025-10-22 07:45:13 +00:00
</trim>
where id = #{id}
</update>
2025-12-09 12:51:15 +00:00
<update id= "updateOmsPaymentBillByCode" >
update oms_payment_bill
<trim prefix= "SET" suffixOverrides= "," >
<if test= "paymentBillType != null" > payment_bill_type = #{paymentBillType},</if>
<if test= "paymentTime != null" > payment_time = #{paymentTime},</if>
<if test= "vendorCode != null" > vendor_code = #{vendorCode},</if>
<if test= "orderCode != null" > 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" > create_by = #{createBy},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "remark != null" > remark = #{remark},</if>
<if test= "delFlag != null" > del_flag = #{delFlag},</if>
<if test= "projectCode != null" > project_code = #{projectCode},</if>
<if test= "projectName != null" > project_name = #{projectName},</if>
<if test= "preResidueAmount != null" > pre_residue_amount = #{preResidueAmount},</if>
<if test= "actualPaymentTime != null" > actual_payment_time = #{actualPaymentTime},</if>
<if test= "paymentStatus != null" > payment_status = #{paymentStatus},</if>
<if test= "approveStatus != null" > approve_status = #{approveStatus},</if>
<if test= "approveNode != null" > approve_node = #{approveNode},</if>
<if test= "approveTime != null" > approve_time = #{approveTime},</if>
<if test= "paymentMethod != null" > payment_method = #{paymentMethod},</if>
<if test= "payName != null" > pay_name = #{payName},</if>
<if test= "payBankNumber != null" > pay_bank_number = #{payBankNumber},</if>
<if test= "payBankOpenAddress != null" > pay_bank_open_address = #{payBankOpenAddress},</if>
<if test= "bankNumber != null" > bank_number = #{bankNumber},</if>
<if test= "refundStatus != null" > refund_status = #{refundStatus},</if>
</trim>
where payment_bill_code = #{paymentBillCode}
</update>
2025-12-16 01:43:34 +00:00
<update id= "revoke" >
update oms_payment_bill
set approve_status = #{approveStatus},
approve_time =null,
pre_residue_amount=null,
update_time=now()
where id = #{id}
</update>
2025-10-22 07:45:13 +00:00
<delete id= "deleteOmsPaymentBillById" parameterType= "Long" >
delete from oms_payment_bill where id = #{id}
</delete>
<delete id= "deleteOmsPaymentBillByIds" parameterType= "String" >
delete from oms_payment_bill where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2025-12-09 01:11:32 +00:00
<delete id= "clearRelationPayable" >
delete from oms_payable_payment_detail where payment_bill_code=#{code}
</delete>
<select id= "selectMaxCodeByPrefix" parameterType= "String" resultType= "Integer" >
SELECT IFNULL(MAX(CAST(SUBSTRING(payment_bill_code, LENGTH(#{prefix}) + 1) AS SIGNED)), 0)
FROM oms_payment_bill
WHERE payment_bill_code LIKE CONCAT(#{prefix}, '%')
</select>
<select id= "selectPaymentBillDetail" resultType= "com.ruoyi.sip.domain.dto.PaymentBillDetailDTO" >
<include refid= "selectOmsPaymentBillVo" />
where pb.id = #{id}
</select>
2025-12-09 12:51:15 +00:00
<select id= "selectOmsPaymentBillByCode" resultType= "com.ruoyi.sip.domain.OmsPaymentBill" >
<include refid= "selectOmsPaymentBillVo" />
where pb.payment_bill_code = #{code}
</select>
2025-12-16 01:43:34 +00:00
<select id= "listApprove" resultType= "com.ruoyi.sip.domain.OmsPaymentBill" >
select
pb.id,
pb.payment_bill_code,
pb.payment_bill_type,
pb.payment_time,
pb.vendor_code,
pb.order_code,
pb.total_price_with_tax,
pb.total_price_without_tax,
pb.tax_amount,
pb.create_by,
pb.create_time,
pb.update_by,
pb.update_time,
pb.remark,
pb.del_flag,
pb.project_code,
pb.project_name,
pb.pre_residue_amount,
pb.actual_payment_time,
pb.payment_status,
pb.approve_status,
pb.approve_node,
pb.approve_time,
pb.payment_method,
pb.pay_name,
pb.pay_bank_number,
pb.pay_bank_open_address,
pb.bank_number,
pb.refund_status,
t2.vendor_name
2025-12-16 07:45:14 +00:00
2025-12-16 01:43:34 +00:00
,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_payment_bill pb
left join oms_vendor_info t2 on pb.vendor_code = t2.vendor_code
2025-12-16 06:47:15 +00:00
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=pb.payment_bill_code)
2025-12-16 01:43:34 +00:00
<where >
<if test= "entity.paymentBillCode != null and entity.paymentBillCode != ''" > and pb.payment_bill_code like concat('%', #{entity.paymentBillCode}, '%')</if>
<if test= "entity.paymentBillType != null and entity.paymentBillType != ''" > and pb.payment_bill_type = #{entity.paymentBillType}</if>
<if test= "entity.paymentTime != null " > and date_format(pb.payment_time,'%Y-%m-%d') = date_format(#{entity.paymentTime},'%Y-%m-%d')</if>
<if test= "entity.vendorCode != null and entity.vendorCode != ''" > and pb.vendor_code like concat('%', #{entity.vendorCode}, '%')</if>
<if test= "entity.orderCode != null and entity.orderCode != ''" > and pb.order_code like concat('%', #{entity.orderCode}, '%')</if>
<if test= "entity.totalPriceWithTax != null " > and pb.total_price_with_tax = #{entity.totalPriceWithTax}</if>
<if test= "entity.totalPriceWithoutTax != null " > and pb.total_price_without_tax = #{entity.totalPriceWithoutTax}</if>
<if test= "entity.taxAmount != null " > and pb.tax_amount = #{taxAmount}</if>
<if test= "entity.projectCode != null and entity.projectCode != ''" > and pb.project_code like concat('%', #{entity.projectCode}, '%')</if>
<if test= "entity.projectName != null and entity.projectName != ''" > and pb.project_name like concat('%', #{entity.projectName}, '%')</if>
<if test= "entity.paymentStatus != null and entity.paymentStatus != ''" > and pb.payment_status = #{entity.paymentStatus}</if>
<if test= "entity.approveStatus != null and entity.approveStatus != ''" > and pb.approve_status = #{entity.approveStatus}</if>
<if test= "entity.approveNode != null and entity.approveNode != ''" > and pb.approve_node = #{entity.approveNode}</if>
<if test= "entity.approveTime != null " > and date_format(pb.approve_time,'%Y-%m-%d') = date_format(#{entity.approveTime},'%Y-%m-%d')</if>
<if test= "entity.actualPaymentTime != null " > and date_format(pb.actual_payment_time,'%Y-%m-%d') = date_format(#{entity.actualPaymentTime},'%Y-%m-%d')</if>
<if test= "entity.paymentMethod != null and entity.paymentMethod != ''" > and pb.payment_method = #{entity.paymentMethod}</if>
<if test= "entity.payableBillCode != null and entity.payableBillCode != ''" > and apb.payable_bill_code like concat('%', #{entity.payableBillCode}, '%')</if>
and pb.del_flag = '0'
</where>
</select>
2025-12-09 01:11:32 +00:00
2025-10-22 07:45:13 +00:00
</mapper>