92 lines
4.0 KiB
XML
92 lines
4.0 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.PrcSurchargeRelMapper">
|
|
|
|
<resultMap type="PrcSurchargeRel" id="PrcSurchargeRelResult">
|
|
<id property="relId" column="rel_id" />
|
|
<result property="scId" column="sc_id" />
|
|
<result property="productId" column="product_id" />
|
|
<result property="productCode" column="product_code" />
|
|
<result property="detailId" column="detail_id" />
|
|
<result property="scName" column="sc_name" />
|
|
<result property="feeType" column="fee_type" />
|
|
<result property="chargeType" column="charge_type" />
|
|
<result property="chargeValue" column="charge_value" />
|
|
<result property="currency" column="currency" />
|
|
<result property="roundMode" column="round_mode" />
|
|
<result property="ssCode" column="ss_code" />
|
|
<result property="countryCode" column="country_code" />
|
|
<result property="scNote" column="sc_note" />
|
|
<result property="countryName" column="country_name" />
|
|
<result property="weightMin" column="weight_min" />
|
|
<result property="weightMax" column="weight_max" />
|
|
<result property="createBy" column="created_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="updated_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectPrcSurchargeRelVo">
|
|
select r.rel_id, r.sc_id, r.product_id, r.product_code, r.detail_id,
|
|
r.created_by, r.create_time, r.updated_by, r.update_time,
|
|
s.sc_name, s.fee_type, s.charge_type, s.charge_value, s.currency,
|
|
s.round_mode, s.ss_code, s.country_code, s.sc_note,
|
|
c.country_name, c.weight_min, c.weight_max
|
|
from prc_surcharge_rel r
|
|
join prc_surcharge s on s.sc_id = r.sc_id
|
|
left join product_country c on c.detail_id = r.detail_id
|
|
</sql>
|
|
|
|
<select id="selectPrcSurchargeRelList" parameterType="PrcSurchargeRel" resultMap="PrcSurchargeRelResult">
|
|
<include refid="selectPrcSurchargeRelVo"/>
|
|
<where>
|
|
<if test="productId != null">
|
|
AND r.product_id = #{productId}
|
|
</if>
|
|
<if test="productCode != null and productCode != ''">
|
|
AND r.product_code = #{productCode}
|
|
</if>
|
|
<if test="scId != null">
|
|
AND r.sc_id = #{scId}
|
|
</if>
|
|
</where>
|
|
order by r.detail_id is not null, r.rel_id asc
|
|
</select>
|
|
|
|
<insert id="insertPrcSurchargeRel" parameterType="PrcSurchargeRel" useGeneratedKeys="true" keyProperty="relId">
|
|
insert into prc_surcharge_rel (
|
|
sc_id, product_id, product_code, detail_id,
|
|
<if test="createBy != null and createBy != ''">created_by,</if>
|
|
create_time
|
|
) values (
|
|
#{scId}, #{productId}, #{productCode}, #{detailId},
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
sysdate()
|
|
)
|
|
</insert>
|
|
|
|
<delete id="deletePrcSurchargeRelByIds" parameterType="Long">
|
|
delete from prc_surcharge_rel where rel_id in
|
|
<foreach item="relId" collection="array" open="(" separator="," close=")">
|
|
#{relId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteRelByProductCodes">
|
|
delete from prc_surcharge_rel where product_code in
|
|
<foreach item="code" collection="array" open="(" separator="," close=")">
|
|
#{code}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 附加费版本化编辑后,产品关联重指向新记录 -->
|
|
<update id="rebindRelScId">
|
|
update prc_surcharge_rel
|
|
set sc_id = #{newScId}, updated_by = #{operator}, update_time = sysdate()
|
|
where sc_id = #{oldScId}
|
|
</update>
|
|
|
|
</mapper>
|