259 lines
11 KiB
XML
259 lines
11 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.OmsPayableTicketWriteOffMapper">
|
|
|
|
<resultMap type="com.ruoyi.sip.domain.OmsPayableTicketWriteOff" id="OmsPayableTicketWriteOffResult">
|
|
<result property="id" column="id" />
|
|
<result property="writeOffCode" column="write_off_code" />
|
|
<result property="writeOffType" column="write_off_type" />
|
|
<result property="ticketBillCode" column="ticket_bill_code" />
|
|
<result property="vendorCode" column="vendor_code" />
|
|
<result property="writeOffAmount" column="write_off_amount" />
|
|
<result property="writeOffAmountWithoutTax" column="write_off_amount_without_tax" />
|
|
<result property="writeOffTaxAmount" column="write_off_tax_amount" />
|
|
<result property="writeOffTime" column="write_off_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectOmsPayableTicketWriteOffVo">
|
|
select t1.id, t1.write_off_code, t1.write_off_type, t1.ticket_bill_code, t1.vendor_code,
|
|
t1.write_off_amount, t1.write_off_amount_without_tax, t1.write_off_tax_amount,
|
|
t1.write_off_time, t1.remark, t1.create_by, t1.create_time, t1.update_by, t1.update_time,
|
|
t3.user_name as create_by_name,t2.vendor_name
|
|
from oms_payable_ticket_write_off t1
|
|
left join oms_vendor_info t2 on t1.vendor_code = t2.vendor_code
|
|
left join sys_user t3 on t1.create_by = t3.user_id
|
|
</sql>
|
|
|
|
<select id="selectOmsPayableTicketWriteOffById" parameterType="Long" resultMap="OmsPayableTicketWriteOffResult">
|
|
<include refid="selectOmsPayableTicketWriteOffVo"/>
|
|
where t1.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectOmsPayableTicketWriteOffList" parameterType="com.ruoyi.sip.domain.OmsPayableTicketWriteOff" resultMap="OmsPayableTicketWriteOffResult">
|
|
<include refid="selectOmsPayableTicketWriteOffVo"/>
|
|
<where>
|
|
<if test="writeOffCode != null and writeOffCode != ''">
|
|
and t1.write_off_code = #{writeOffCode}
|
|
</if>
|
|
<if test="writeOffType != null and writeOffType != ''">
|
|
and t1.write_off_type = #{writeOffType}
|
|
</if>
|
|
<if test="ticketBillCode != null and ticketBillCode != ''">
|
|
and t1.ticket_bill_code = #{ticketBillCode}
|
|
</if>
|
|
<if test="vendorCode != null and vendorCode != ''">
|
|
and t1.vendor_code = #{vendorCode}
|
|
</if>
|
|
<if test="writeOffAmount != null">
|
|
and t1.write_off_amount = #{writeOffAmount}
|
|
</if>
|
|
<if test="writeOffAmountWithoutTax != null">
|
|
and t1.write_off_amount_without_tax = #{writeOffAmountWithoutTax}
|
|
</if>
|
|
<if test="writeOffTaxAmount != null">
|
|
and t1.write_off_tax_amount = #{writeOffTaxAmount}
|
|
</if>
|
|
<if test="writeOffTime != null">
|
|
and t1.write_off_time = #{writeOffTime}
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
and t1.remark like concat('%', #{remark}, '%')
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
and t1.create_by = #{createBy}
|
|
</if>
|
|
<if test="createTime != null">
|
|
and t1.create_time = #{createTime}
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
and t1.update_by = #{updateBy}
|
|
</if>
|
|
<if test="updateTime != null">
|
|
and t1.update_time = #{updateTime}
|
|
</if>
|
|
<if test="payableBillCode != null and payableBillCode != ''"> and t1.id in (
|
|
select write_off_id from oms_payable_ticket_detail t1 left join oms_payable_bill t2 on t1.payable_bill_id=t2.id where t2.payable_bill_code=#{payableBillCode}
|
|
) </if>
|
|
<if test="vendorName != null and vendorName != ''"> and t2.vendor_name = #{vendorName}</if>
|
|
<if test="(params.beginTime != null and params.beginTime != '') or (params.endTime != null and params.endTime!='')">
|
|
<choose>
|
|
<when test="(params.beginTime != null and params.beginTime != '') and (params.endTime != null and params.endTime!='')">
|
|
and t1.create_time between #{params.beginTime} and #{params.endTime}
|
|
</when>
|
|
<when test="(params.beginTime != null and params.beginTime != '')">
|
|
and t1.create_time <![CDATA[ >= ]]> #{params.beginTime}
|
|
</when>
|
|
<when test="(params.endTime != null and params.endTime!='')">
|
|
and t1.create_time <![CDATA[ <= ]]> #{params.endTime}
|
|
</when>
|
|
|
|
</choose>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="insertOmsPayableTicketWriteOff" parameterType="com.ruoyi.sip.domain.OmsPayableTicketWriteOff" useGeneratedKeys="true" keyProperty="id">
|
|
insert into oms_payable_ticket_write_off
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="writeOffCode != null and writeOffCode != ''">
|
|
write_off_code,
|
|
</if>
|
|
<if test="writeOffType != null and writeOffType != ''">
|
|
write_off_type,
|
|
</if>
|
|
<if test="ticketBillCode != null and ticketBillCode != ''">
|
|
ticket_bill_code,
|
|
</if>
|
|
<if test="vendorCode != null and vendorCode != ''">
|
|
vendor_code,
|
|
</if>
|
|
<if test="writeOffAmount != null">
|
|
write_off_amount,
|
|
</if>
|
|
<if test="writeOffAmountWithoutTax != null">
|
|
write_off_amount_without_tax,
|
|
</if>
|
|
<if test="writeOffTaxAmount != null">
|
|
write_off_tax_amount,
|
|
</if>
|
|
<if test="writeOffTime != null">
|
|
write_off_time,
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark,
|
|
</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="writeOffCode != null and writeOffCode != ''">
|
|
#{writeOffCode},
|
|
</if>
|
|
<if test="writeOffType != null and writeOffType != ''">
|
|
#{writeOffType},
|
|
</if>
|
|
<if test="ticketBillCode != null and ticketBillCode != ''">
|
|
#{ticketBillCode},
|
|
</if>
|
|
<if test="vendorCode != null and vendorCode != ''">
|
|
#{vendorCode},
|
|
</if>
|
|
<if test="writeOffAmount != null">
|
|
#{writeOffAmount},
|
|
</if>
|
|
<if test="writeOffAmountWithoutTax != null">
|
|
#{writeOffAmountWithoutTax},
|
|
</if>
|
|
<if test="writeOffTaxAmount != null">
|
|
#{writeOffTaxAmount},
|
|
</if>
|
|
<if test="writeOffTime != null">
|
|
#{writeOffTime},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
#{remark},
|
|
</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateOmsPayableTicketWriteOff" parameterType="com.ruoyi.sip.domain.OmsPayableTicketWriteOff">
|
|
update oms_payable_ticket_write_off
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="writeOffCode != null and writeOffCode != ''">
|
|
write_off_code = #{writeOffCode},
|
|
</if>
|
|
<if test="writeOffType != null and writeOffType != ''">
|
|
write_off_type = #{writeOffType},
|
|
</if>
|
|
<if test="ticketBillCode != null and ticketBillCode != ''">
|
|
ticket_bill_code = #{ticketBillCode},
|
|
</if>
|
|
<if test="vendorCode != null and vendorCode != ''">
|
|
vendor_code = #{vendorCode},
|
|
</if>
|
|
<if test="writeOffAmount != null">
|
|
write_off_amount = #{writeOffAmount},
|
|
</if>
|
|
<if test="writeOffAmountWithoutTax != null">
|
|
write_off_amount_without_tax = #{writeOffAmountWithoutTax},
|
|
</if>
|
|
<if test="writeOffTaxAmount != null">
|
|
write_off_tax_amount = #{writeOffTaxAmount},
|
|
</if>
|
|
<if test="writeOffTime != null">
|
|
write_off_time = #{writeOffTime},
|
|
</if>
|
|
<if test="remark != null and remark != ''">
|
|
remark = #{remark},
|
|
</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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteOmsPayableTicketWriteOffById" parameterType="Long">
|
|
delete from oms_payable_ticket_write_off where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteOmsPayableTicketWriteOffByIds" parameterType="String">
|
|
delete from oms_payable_ticket_write_off where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="listByIds" parameterType="String" resultMap="OmsPayableTicketWriteOffResult">
|
|
<include refid="selectOmsPayableTicketWriteOffVo"/>
|
|
where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectMaxCodeByPrefix" parameterType="String" resultType="java.lang.Integer">
|
|
SELECT COALESCE(MAX(CAST(SUBSTRING(write_off_code, LENGTH(#{codePrefix}) + 1) AS UNSIGNED)), 0)
|
|
FROM oms_payable_ticket_write_off
|
|
WHERE write_off_code LIKE CONCAT(#{codePrefix}, '%')
|
|
</select>
|
|
|
|
</mapper> |