150 lines
8.6 KiB
XML
150 lines
8.6 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.OmsReceivableWriteOffMapper">
|
|
|
|
<resultMap type="com.ruoyi.sip.domain.OmsReceivableWriteOff" id="OmsReceivableWriteOffResult">
|
|
<result property="id" column="id" />
|
|
<result property="writeOffCode" column="write_off_code" />
|
|
<result property="writeOffType" column="write_off_type" />
|
|
<result property="receiptBillCode" column="receipt_bill_code" />
|
|
<result property="partnerCode" column="partner_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="selectOmsReceivableWriteOffVo">
|
|
select t1.id, t1.write_off_code, t1.write_off_type, t1.receipt_bill_code, t1.partner_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,
|
|
t1.partner_name,t3.user_name as create_by_name
|
|
from oms_receivable_write_off t1
|
|
left join sys_user t3 on t1.create_by=t3.user_id
|
|
</sql>
|
|
|
|
<select id="selectOmsReceivableWriteOffById" parameterType="Long" resultMap="OmsReceivableWriteOffResult">
|
|
<include refid="selectOmsReceivableWriteOffVo"/>
|
|
where t1.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectOmsReceivableWriteOffList" parameterType="com.ruoyi.sip.domain.OmsReceivableWriteOff" resultMap="OmsReceivableWriteOffResult">
|
|
<include refid="selectOmsReceivableWriteOffVo"/>
|
|
<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="receiptBillCode != null and receiptBillCode != ''"> and t1.receipt_bill_code = #{receiptBillCode}</if>
|
|
<if test="receivableBillCode != null and receivableBillCode != ''"> and t1.id in (
|
|
select write_off_id from oms_receivable_receipt_detail t1
|
|
inner join oms_receivable_bill t2 on t1.receivable_bill_id=t2.id
|
|
|
|
where t2.receivable_bill_code=#{receivableBillCode}
|
|
) </if>
|
|
<if test="receiptBillCodeList != null and receiptBillCodeList.size>0"> and t1.receipt_bill_code in
|
|
<foreach index="index" collection="receiptBillCodeList" item="receiptBillCode" separator="," open="(" close=")">
|
|
#{receiptBillCode}
|
|
</foreach>
|
|
</if>
|
|
<if test="partnerCode != null and partnerCode != ''"> and t1.partner_code = #{partnerCode}</if>
|
|
<if test="partnerName != null and partnerName != ''"> and t1.partner_name like concat('%', #{partnerName}, '%')</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>
|
|
<select id="selectMaxCodeByPrefix" resultType="java.lang.Integer">
|
|
select ifnull(max(SUBSTR(write_off_code FROM LENGTH(#{prefix}) + 1 FOR 4)), 0)
|
|
from oms_receivable_write_off
|
|
where write_off_code like concat(#{prefix}, '%')
|
|
</select>
|
|
<select id="listByIds" resultType="com.ruoyi.sip.domain.OmsReceivableWriteOff">
|
|
<include refid="selectOmsReceivableWriteOffVo"/>
|
|
where t1.id in
|
|
<foreach item="item" index="index" collection="array" open="(" separator="," close=")" >
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<insert id="insertOmsReceivableWriteOff" parameterType="com.ruoyi.sip.domain.OmsReceivableWriteOff" useGeneratedKeys="true" keyProperty="id">
|
|
insert into oms_receivable_write_off
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="writeOffCode != null">write_off_code,</if>
|
|
<if test="writeOffType != null">write_off_type,</if>
|
|
<if test="receiptBillCode != null">receipt_bill_code,</if>
|
|
<if test="partnerCode != null">partner_code,</if>
|
|
<if test="partnerName != null">partner_name,</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">remark,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="writeOffCode != null">#{writeOffCode},</if>
|
|
<if test="writeOffType != null">#{writeOffType},</if>
|
|
<if test="receiptBillCode != null">#{receiptBillCode},</if>
|
|
<if test="partnerCode != null">#{partnerCode},</if>
|
|
<if test="partnerName != null">#{partnerName},</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">#{remark},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateOmsReceivableWriteOff" parameterType="com.ruoyi.sip.domain.OmsReceivableWriteOff">
|
|
update oms_receivable_write_off
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="writeOffCode != null">write_off_code = #{writeOffCode},</if>
|
|
<if test="writeOffType != null">write_off_type = #{writeOffType},</if>
|
|
<if test="receiptBillCode != null">receipt_bill_code = #{receiptBillCode},</if>
|
|
<if test="partnerCode != null">partner_code = #{partnerCode},</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">remark = #{remark},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteOmsReceivableWriteOffById" parameterType="Long">
|
|
delete from oms_receivable_write_off where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteOmsReceivableWriteOffByIds" parameterType="String">
|
|
delete from oms_receivable_write_off where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |