Files
BMS/bms-back/bms-system/src/main/resources/mapper/price/PrcWeightSectionDetailMapper.xml
T
2026-09-28 10:02:38 +08:00

106 lines
5.1 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.bms.price.mapper.PrcWeightSectionDetailMapper">
<resultMap type="PrcWeightSectionDetail" id="PrcWeightSectionDetailResult">
<id property="wsdId" column="wsd_id" />
<result property="wstId" column="wst_id" />
<result property="wlTitle" column="wl_title" />
<result property="wlStartweight" column="wl_startweight" />
<result property="wlEndweight" column="wl_endweight" />
<result property="weightBillingCode" column="weight_billing_code" />
<result property="fvUnitweight" column="fv_unitweight" />
<result property="effectiveDate" column="effective_date" />
<result property="expireDate" column="expire_date" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPrcWeightSectionDetailVo">
select wsd_id, wst_id, wl_title, wl_startweight, wl_endweight, weight_billing_code,
fv_unitweight, effective_date, expire_date, create_time, update_time
from prc_weight_section_detail
</sql>
<select id="selectPrcWeightSectionDetailById" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
where wsd_id = #{wsdId}
</select>
<select id="selectPrcWeightSectionDetailListByWstId" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
where wst_id = #{wstId}
order by wl_startweight asc, wsd_id asc
</select>
<select id="selectPrcWeightSectionDetailList" parameterType="PrcWeightSectionDetail" resultMap="PrcWeightSectionDetailResult">
<include refid="selectPrcWeightSectionDetailVo"/>
<where>
<if test="wstId != null">
AND wst_id = #{wstId}
</if>
<if test="wlTitle != null and wlTitle != ''">
AND wl_title like concat('%', #{wlTitle}, '%')
</if>
<if test="weightBillingCode != null and weightBillingCode != ''">
AND weight_billing_code = #{weightBillingCode}
</if>
</where>
order by wl_startweight asc, wsd_id asc
</select>
<select id="countByWstId" parameterType="Long" resultType="int">
select count(1) from prc_weight_section_detail where wst_id = #{wstId}
</select>
<insert id="insertPrcWeightSectionDetail" parameterType="PrcWeightSectionDetail" useGeneratedKeys="true" keyProperty="wsdId">
insert into prc_weight_section_detail (
<if test="wstId != null">wst_id,</if>
<if test="wlTitle != null">wl_title,</if>
<if test="wlStartweight != null">wl_startweight,</if>
<if test="wlEndweight != null">wl_endweight,</if>
<if test="weightBillingCode != null">weight_billing_code,</if>
<if test="fvUnitweight != null">fv_unitweight,</if>
<if test="effectiveDate != null">effective_date,</if>
<if test="expireDate != null">expire_date,</if>
create_time
) values (
<if test="wstId != null">#{wstId},</if>
<if test="wlTitle != null">#{wlTitle},</if>
<if test="wlStartweight != null">#{wlStartweight},</if>
<if test="wlEndweight != null">#{wlEndweight},</if>
<if test="weightBillingCode != null">#{weightBillingCode},</if>
<if test="fvUnitweight != null">#{fvUnitweight},</if>
<if test="effectiveDate != null">#{effectiveDate},</if>
<if test="expireDate != null">#{expireDate},</if>
sysdate()
)
</insert>
<update id="updatePrcWeightSectionDetail" parameterType="PrcWeightSectionDetail">
update prc_weight_section_detail
<set>
<if test="wstId != null">wst_id = #{wstId},</if>
<if test="wlTitle != null">wl_title = #{wlTitle},</if>
<if test="wlStartweight != null">wl_startweight = #{wlStartweight},</if>
<if test="wlEndweight != null">wl_endweight = #{wlEndweight},</if>
<if test="weightBillingCode != null">weight_billing_code = #{weightBillingCode},</if>
<if test="fvUnitweight != null">fv_unitweight = #{fvUnitweight},</if>
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
<if test="expireDate != null">expire_date = #{expireDate},</if>
update_time = sysdate()
</set>
where wsd_id = #{wsdId}
</update>
<delete id="deletePrcWeightSectionDetailByIds" parameterType="Long">
delete from prc_weight_section_detail where wsd_id in
<foreach item="wsdId" collection="array" open="(" separator="," close=")">
#{wsdId}
</foreach>
</delete>
</mapper>