unis_sip/ruoyi-sip/src/main/resources/mapper/sip/OmsReceivableReceiptPlanMap...

117 lines
5.7 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.OmsReceivableReceiptPlanMapper">
<resultMap type="com.ruoyi.sip.domain.OmsReceivableReceiptPlan" id="OmsReceivableReceiptPlanResult">
<result property="id" column="id" />
<result property="receivableBillId" column="receivable_bill_id" />
<result property="planReceiptDate" column="plan_receipt_date" />
<result property="planAmount" column="plan_amount" />
<result property="planRate" column="plan_rate" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectOmsReceivableReceiptPlanVo">
select id, receivable_bill_id, plan_receipt_date, plan_amount, plan_rate, remark, create_time, create_by, update_time
from oms_receivable_receipt_plan
</sql>
<select id="selectOmsReceivableReceiptPlanById" parameterType="Long" resultMap="OmsReceivableReceiptPlanResult">
<include refid="selectOmsReceivableReceiptPlanVo"/>
where id = #{id}
</select>
<select id="selectOmsReceivableReceiptPlanList" parameterType="com.ruoyi.sip.domain.OmsReceivableReceiptPlan" resultMap="OmsReceivableReceiptPlanResult">
<include refid="selectOmsReceivableReceiptPlanVo"/>
<where>
<if test="receivableBillId != null "> and receivable_bill_id = #{receivableBillId}</if>
<if test="planReceiptDate != null "> and plan_receipt_date = #{planReceiptDate}</if>
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
<if test="planRate != null "> and plan_rate = #{planRate}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
</where>
</select>
<select id="selectOmsReceivableReceiptPlanListByReceivableBillId" parameterType="Long" resultMap="OmsReceivableReceiptPlanResult">
<include refid="selectOmsReceivableReceiptPlanVo"/>
where receivable_bill_id = #{receivableBillId}
order by plan_receipt_date
</select>
<select id="firstUnPayPlan" resultType="com.ruoyi.sip.domain.OmsReceivableReceiptPlan">
select t1.id,
t1.receivable_bill_id,
t1.plan_receipt_date,
t1.plan_amount,
t1.plan_rate,
t1.remark,
t1.create_time,
t1.create_by,
t1.update_time
from oms_receivable_receipt_plan t1
left join oms_receivable_receipt_detail t2 on t1.id = t2.receipt_plan_id
where t2.id is null and t1.receivable_bill_id = #{receivableBillId}
order by plan_receipt_date
limit 1
</select>
<insert id="insertOmsReceivableReceiptPlan" parameterType="com.ruoyi.sip.domain.OmsReceivableReceiptPlan" useGeneratedKeys="true" keyProperty="id">
insert into oms_receivable_receipt_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receivableBillId != null">receivable_bill_id,</if>
<if test="planReceiptDate != null">plan_receipt_date,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="planRate != null">plan_rate,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="receivableBillId != null">#{receivableBillId},</if>
<if test="planReceiptDate != null">#{planReceiptDate},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="planRate != null">#{planRate},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateOmsReceivableReceiptPlan" parameterType="com.ruoyi.sip.domain.OmsReceivableReceiptPlan">
update oms_receivable_receipt_plan
<trim prefix="SET" suffixOverrides=",">
<if test="receivableBillId != null">receivable_bill_id = #{receivableBillId},</if>
<if test="planReceiptDate != null">plan_receipt_date = #{planReceiptDate},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="planRate != null">plan_rate = #{planRate},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOmsReceivableReceiptPlanById" parameterType="Long">
delete from oms_receivable_receipt_plan where id = #{id}
</delete>
<delete id="deleteOmsReceivableReceiptPlanByIds" parameterType="String">
delete from oms_receivable_receipt_plan where id in
<foreach item="id" collection="ids.split(',')" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByReceivableBillId" parameterType="Long">
delete from oms_receivable_receipt_plan where receivable_bill_id = #{receivableBillId}
</delete>
</mapper>