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

101 lines
5.4 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.OmsReceivableInvoicePlanMapper">
<resultMap type="com.ruoyi.sip.domain.OmsReceivableInvoicePlan" id="OmsReceivableInvoicePlanResult">
<result property="id" column="id" />
<result property="receivableBillId" column="receivable_bill_id" />
<result property="planInvoiceDate" column="plan_invoice_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" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectOmsReceivableInvoicePlanVo">
select id, receivable_bill_id, plan_invoice_date, plan_amount, plan_rate, remark, create_time, create_by, update_time
from oms_receivable_invoice_plan
</sql>
<select id="selectOmsReceivableInvoicePlanById" parameterType="Long" resultMap="OmsReceivableInvoicePlanResult">
<include refid="selectOmsReceivableInvoicePlanVo"/>
where id = #{id}
</select>
<select id="selectOmsReceivableInvoicePlanList" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoicePlan" resultMap="OmsReceivableInvoicePlanResult">
<include refid="selectOmsReceivableInvoicePlanVo"/>
<where>
<if test="receivableBillId != null "> and receivable_bill_id = #{receivableBillId}</if>
<if test="planInvoiceDate != null "> and plan_invoice_date = #{planInvoiceDate}</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="firstUnPayPlan" resultType="com.ruoyi.sip.domain.OmsReceivableInvoicePlan">
select t1.id, t1.receivable_bill_id, t1.plan_invoice_date, t1.plan_amount, t1.plan_rate, t1.create_by, t1.create_time,
t1.update_time
from oms_receivable_invoice_plan t1
left join oms_receivable_invoice_detail t2 on t1.id=t2.invoice_plan_id
where t2.id is null and t1.receivable_bill_id=#{payableBillId}
order by t1.plan_invoice_date
limit 1
</select>
<insert id="insertOmsReceivableInvoicePlan" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoicePlan" useGeneratedKeys="true" keyProperty="id">
insert into oms_receivable_invoice_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receivableBillId != null">receivable_bill_id,</if>
<if test="planInvoiceDate != null">plan_invoice_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>
<if test="updateBy != null and updateBy != ''">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="receivableBillId != null">#{receivableBillId},</if>
<if test="planInvoiceDate != null">#{planInvoiceDate},</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>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
</trim>
</insert>
<update id="updateOmsReceivableInvoicePlan" parameterType="com.ruoyi.sip.domain.OmsReceivableInvoicePlan">
update oms_receivable_invoice_plan
<trim prefix="SET" suffixOverrides=",">
<if test="receivableBillId != null">receivable_bill_id = #{receivableBillId},</if>
<if test="planInvoiceDate != null">plan_invoice_date = #{planInvoiceDate},</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>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOmsReceivableInvoicePlanById" parameterType="Long">
delete from oms_receivable_invoice_plan where id = #{id}
</delete>
<delete id="deleteOmsReceivableInvoicePlanByIds" parameterType="String">
delete from oms_receivable_invoice_plan where id in
<foreach item="id" collection="ids.split(',')" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>