Merge branch 'master' of http://git.lionquexpress.com/wuweihua/BMS
This commit is contained in:
@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sourceSheet" column="source_sheet" />
|
||||
<result property="pefId" column="pef_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<sql id="selectBmsProductVo">
|
||||
select p.product_id, p.product_code, p.product_name, p.service_level, p.cargo_attr,
|
||||
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.expire_date, p.status,
|
||||
p.source_sheet, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
|
||||
p.source_sheet, p.pef_id, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
|
||||
(select count(distinct c.country_name) from product_country c
|
||||
where c.product_id = p.product_id
|
||||
or (c.product_id is null and c.product_code = p.product_code
|
||||
@@ -39,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
or c.effective_date = p.effective_date
|
||||
))
|
||||
) as country_count,
|
||||
(select count(*) from prc_surcharge_rel r where r.product_id = p.product_id) as surcharge_count
|
||||
(select count(*) from prc_surcharge_rel r where r.product_id = p.product_id and r.price_type = 'PRODUCT') as surcharge_count
|
||||
from product p
|
||||
</sql>
|
||||
|
||||
@@ -139,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="sourceSheet != null">source_sheet,</if>
|
||||
<if test="pefId != null">pef_id,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
@@ -155,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="sourceSheet != null">#{sourceSheet},</if>
|
||||
<if test="pefId != null">#{pefId},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
@@ -176,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
expire_date = #{expireDate},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
|
||||
<if test="pefId != null">pef_id = #{pefId},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
|
||||
+312
@@ -0,0 +1,312 @@
|
||||
<?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.BmsRedlineProductCountryMapper">
|
||||
|
||||
<resultMap type="BmsRedlineProductCountry" id="BmsRedlineProductCountryResult">
|
||||
<id property="detailId" column="detail_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="zoneCode" column="zone_code" />
|
||||
<result property="zoneName" column="zone_name" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="freightPrice" column="freight_price" />
|
||||
<result property="registrationFee" column="registration_fee" />
|
||||
<result property="sizeLimit" column="size_limit" />
|
||||
<result property="lastMile" column="last_mile" />
|
||||
<result property="leadTime" column="lead_time" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="effectStatus" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select c.detail_id, c.product_id, c.product_code, c.country_name, c.country_code,
|
||||
c.zone_id, c.zone_code, c.zone_name,
|
||||
c.weight_min, c.weight_max,
|
||||
c.freight_price, c.registration_fee, c.size_limit, c.last_mile, c.lead_time,
|
||||
c.effective_date, c.expire_date, c.status, c.create_time, c.update_time
|
||||
from redline_product_country c
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsRedlineProductCountryList" parameterType="BmsRedlineProductCountry" resultMap="BmsRedlineProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
<if test="productId != null">
|
||||
AND c.product_id = #{productId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND c.product_code = #{productCode}
|
||||
</if>
|
||||
<if test="countryName != null and countryName != ''">
|
||||
AND c.country_name like concat('%', #{countryName}, '%')
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND c.country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="zoneId != null">
|
||||
AND c.zone_id = #{zoneId}
|
||||
</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">
|
||||
AND c.zone_code = #{zoneCode}
|
||||
</if>
|
||||
<if test="weightMin != null">
|
||||
AND c.weight_min = #{weightMin}
|
||||
</if>
|
||||
<if test="weightMax != null">
|
||||
AND c.weight_max = #{weightMax}
|
||||
</if>
|
||||
<if test="effectiveDate != null">
|
||||
AND c.effective_date = #{effectiveDate}
|
||||
</if>
|
||||
<if test="openOnly != null and openOnly">
|
||||
AND c.expire_date is null
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND c.status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND c.status = #{effectStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by c.effective_date desc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsRedlineProductCountry" parameterType="BmsRedlineProductCountry" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into redline_product_country (
|
||||
product_id, product_code, country_name, country_code, zone_id, zone_code, zone_name,
|
||||
weight_min, weight_max,
|
||||
freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, status, create_time
|
||||
) values (
|
||||
#{productId}, #{productCode}, #{countryName}, #{countryCode}, #{zoneId}, #{zoneCode}, #{zoneName},
|
||||
#{weightMin}, #{weightMax},
|
||||
#{freightPrice}, #{registrationFee}, #{sizeLimit}, #{lastMile}, #{leadTime},
|
||||
#{effectiveDate}, #{expireDate}, IFNULL(#{status}, '0'), sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- Detail edit dialog: frontend submits full editable fields;
|
||||
weight_max / expire_date may be null (= open-ended) -->
|
||||
<update id="updateBmsRedlineProductCountry" parameterType="BmsRedlineProductCountry">
|
||||
update redline_product_country
|
||||
set weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
freight_price = #{freightPrice},
|
||||
registration_fee = #{registrationFee},
|
||||
size_limit = #{sizeLimit},
|
||||
last_mile = #{lastMile},
|
||||
lead_time = #{leadTime},
|
||||
effective_date = #{effectiveDate},
|
||||
expire_date = #{expireDate},
|
||||
update_time = sysdate()
|
||||
where detail_id = #{detailId}
|
||||
</update>
|
||||
|
||||
<update id="updateBmsRedlineProductCountryImport" parameterType="BmsRedlineProductCountry">
|
||||
update redline_product_country
|
||||
set product_id = #{productId},
|
||||
country_code = #{countryCode},
|
||||
zone_id = #{zoneId},
|
||||
zone_code = #{zoneCode},
|
||||
zone_name = #{zoneName},
|
||||
weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
freight_price = #{freightPrice},
|
||||
registration_fee = #{registrationFee},
|
||||
size_limit = #{sizeLimit},
|
||||
last_mile = #{lastMile},
|
||||
lead_time = #{leadTime},
|
||||
effective_date = #{effectiveDate},
|
||||
expire_date = #{expireDate},
|
||||
status = IFNULL(#{status}, status),
|
||||
update_time = sysdate()
|
||||
where detail_id = #{detailId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByProductId" parameterType="Long">
|
||||
delete from redline_product_country where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCode" parameterType="String">
|
||||
delete from redline_product_country where product_code = #{productCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCodes">
|
||||
delete from redline_product_country where product_code in
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCodeAndEffectiveDate">
|
||||
delete from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="selectMaxOpenEffectiveDate" resultType="java.util.Date">
|
||||
select max(effective_date) from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
</select>
|
||||
|
||||
<update id="expireOpenByProductCode">
|
||||
update redline_product_country
|
||||
set expire_date = #{newEffectiveDate},
|
||||
update_time = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
</update>
|
||||
|
||||
<update id="expireOpenByProductCodeAndCountry">
|
||||
update redline_product_country
|
||||
set expire_date = #{newEffectiveDate},
|
||||
update_time = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(ifnull(country_code,'')) = upper(#{countryCode})
|
||||
</when>
|
||||
<otherwise>
|
||||
and country_name = #{countryName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update redline_product_country
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= now() then '2'
|
||||
when effective_date is null or effective_date > now() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
<delete id="deleteOpenByProductCodeAndEffectiveDate">
|
||||
delete from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOpenByProductCodeAndCountryOnDate">
|
||||
delete from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(ifnull(country_code,'')) = upper(#{countryCode})
|
||||
</when>
|
||||
<otherwise>
|
||||
and country_name = #{countryName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</delete>
|
||||
|
||||
<select id="selectMatchByProductCountryWeight" resultMap="BmsRedlineProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
where c.product_code = #{productCode}
|
||||
and c.weight_min <= #{weight}
|
||||
and c.weight_max >= #{weight}
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(c.country_code) = upper(#{countryCode})
|
||||
</when>
|
||||
<when test="countryName != null and countryName != ''">
|
||||
and c.country_name = #{countryName}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1 = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="zoneCode != null and zoneCode != ''">
|
||||
and upper(ifnull(c.zone_code,'')) = upper(#{zoneCode})
|
||||
</when>
|
||||
<otherwise>
|
||||
and (c.zone_code is null or c.zone_code = '')
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="bizDate != null">
|
||||
and (c.effective_date is null or c.effective_date <= #{bizDate})
|
||||
and (c.expire_date is null or c.expire_date > #{bizDate})
|
||||
</if>
|
||||
<if test="bizDate == null">
|
||||
and c.expire_date is null
|
||||
</if>
|
||||
order by c.effective_date desc, c.weight_min asc, c.detail_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="countZonedByProductCountry" resultType="int">
|
||||
select count(1)
|
||||
from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and zone_code is not null and zone_code <> ''
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(country_code) = upper(#{countryCode})
|
||||
</when>
|
||||
<when test="countryName != null and countryName != ''">
|
||||
and country_name = #{countryName}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1 = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="bizDate != null">
|
||||
and (effective_date is null or effective_date <= #{bizDate})
|
||||
and (expire_date is null or expire_date > #{bizDate})
|
||||
</if>
|
||||
<if test="bizDate == null">
|
||||
and expire_date is null
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectOpenByProductCode" resultMap="BmsRedlineProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
where c.product_code = #{productCode}
|
||||
and c.expire_date is null
|
||||
order by c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="copyOpenCountries">
|
||||
insert into redline_product_country (
|
||||
product_id, product_code, country_name, country_code, zone_id, zone_code, zone_name,
|
||||
weight_min, weight_max, freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, status, create_time
|
||||
)
|
||||
select
|
||||
#{productId}, product_code, country_name, country_code, zone_id, zone_code, zone_name,
|
||||
weight_min, weight_max, freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
#{effectiveDate}, null, IFNULL(#{status}, '0'), sysdate()
|
||||
from redline_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{effectiveDate})
|
||||
order by detail_id asc
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,219 @@
|
||||
<?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.BmsRedlineProductMapper">
|
||||
|
||||
<resultMap type="BmsRedlineProduct" id="BmsRedlineProductResult">
|
||||
<id property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="serviceLevel" column="service_level" />
|
||||
<result property="cargoAttr" column="cargo_attr" />
|
||||
<result property="destRegion" column="dest_region" />
|
||||
<result property="updateNote" column="update_note" />
|
||||
<result property="taxMode" column="tax_mode" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sourceSheet" column="source_sheet" />
|
||||
<result property="pefId" column="pef_id" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="countryCount" column="country_count" />
|
||||
<result property="surchargeCount" column="surcharge_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmsRedlineProductVo">
|
||||
select p.product_id, p.product_code, p.product_name, p.service_level, p.cargo_attr,
|
||||
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.expire_date, p.status,
|
||||
p.source_sheet, p.pef_id, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
|
||||
(select count(distinct c.country_name) from redline_product_country c
|
||||
where c.product_id = p.product_id
|
||||
or (c.product_id is null and c.product_code = p.product_code
|
||||
and (
|
||||
(p.effective_date is null and c.effective_date is null)
|
||||
or c.effective_date = p.effective_date
|
||||
))
|
||||
) as country_count,
|
||||
(select count(*) from prc_surcharge_rel r where r.product_id = p.product_id and r.price_type = 'REDLINE') as surcharge_count
|
||||
from redline_product p
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsRedlineProductById" parameterType="Long" resultMap="BmsRedlineProductResult">
|
||||
<include refid="selectBmsRedlineProductVo"/>
|
||||
where p.product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectBmsRedlineProductByCode" parameterType="String" resultMap="BmsRedlineProductResult">
|
||||
<include refid="selectBmsRedlineProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsRedlineProductByCodeAndDate" resultMap="BmsRedlineProductResult">
|
||||
<include refid="selectBmsRedlineProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
<choose>
|
||||
<when test="effectiveDate != null">
|
||||
AND p.effective_date = #{effectiveDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND p.effective_date is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectEffectiveBmsRedlineProductByCode" resultMap="BmsRedlineProductResult">
|
||||
<include refid="selectBmsRedlineProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
and (p.effective_date is null or #{bizDate} is null or p.effective_date <= #{bizDate})
|
||||
and (p.expire_date is null or #{bizDate} is null or p.expire_date > #{bizDate})
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsRedlineProductList" parameterType="BmsRedlineProduct" resultMap="BmsRedlineProductResult">
|
||||
<include refid="selectBmsRedlineProductVo"/>
|
||||
<where>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND p.product_code like concat('%', #{productCode}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND p.product_name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="taxMode != null and taxMode != ''">
|
||||
AND p.tax_mode = #{taxMode}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND p.status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND p.status = #{effectStatus}
|
||||
</if>
|
||||
<if test="statusGroup != null and statusGroup == 'active'">
|
||||
AND p.status in ('0', '1')
|
||||
</if>
|
||||
<if test="statusGroup != null and statusGroup == 'expired'">
|
||||
AND p.status = '2'
|
||||
<if test="params != null and params.beginTime != null and params.beginTime != ''">
|
||||
AND p.expire_date >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params != null and params.endTime != null and params.endTime != ''">
|
||||
AND p.expire_date <= #{params.endTime}
|
||||
</if>
|
||||
</if>
|
||||
<if test="cargoAttr != null and cargoAttr != ''">
|
||||
AND p.cargo_attr like concat('%', #{cargoAttr}, '%')
|
||||
</if>
|
||||
<if test="params != null and params.keyword != null and params.keyword != ''">
|
||||
AND (p.product_code like concat('%', #{params.keyword}, '%')
|
||||
OR p.product_name like concat('%', #{params.keyword}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="statusGroup != null and statusGroup == 'expired'">
|
||||
order by p.expire_date desc, p.product_code asc, p.product_id desc
|
||||
</when>
|
||||
<otherwise>
|
||||
order by p.product_code asc, p.effective_date desc, p.product_id desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsRedlineProduct" parameterType="BmsRedlineProduct" useGeneratedKeys="true" keyProperty="productId">
|
||||
insert into redline_product (
|
||||
<if test="productCode != null and productCode != ''">product_code,</if>
|
||||
<if test="productName != null and productName != ''">product_name,</if>
|
||||
<if test="serviceLevel != null">service_level,</if>
|
||||
<if test="cargoAttr != null">cargo_attr,</if>
|
||||
<if test="destRegion != null">dest_region,</if>
|
||||
<if test="updateNote != null">update_note,</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="sourceSheet != null">source_sheet,</if>
|
||||
<if test="pefId != null">pef_id,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="productCode != null and productCode != ''">#{productCode},</if>
|
||||
<if test="productName != null and productName != ''">#{productName},</if>
|
||||
<if test="serviceLevel != null">#{serviceLevel},</if>
|
||||
<if test="cargoAttr != null">#{cargoAttr},</if>
|
||||
<if test="destRegion != null">#{destRegion},</if>
|
||||
<if test="updateNote != null">#{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">#{taxMode},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="sourceSheet != null">#{sourceSheet},</if>
|
||||
<if test="pefId != null">#{pefId},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateBmsRedlineProduct" parameterType="BmsRedlineProduct">
|
||||
update product
|
||||
<set>
|
||||
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
|
||||
<if test="productName != null and productName != ''">product_name = #{productName},</if>
|
||||
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
|
||||
<if test="cargoAttr != null">cargo_attr = #{cargoAttr},</if>
|
||||
<if test="destRegion != null">dest_region = #{destRegion},</if>
|
||||
<if test="updateNote != null">update_note = #{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
|
||||
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
|
||||
expire_date = #{expireDate},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
|
||||
<if test="pefId != null">pef_id = #{pefId},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsRedlineProductByIds" parameterType="Long">
|
||||
delete from redline_product where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="expireOpenByProductCode">
|
||||
update product
|
||||
set expire_date = #{newEffectiveDate},
|
||||
update_time = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
<if test="excludeId != null">
|
||||
and product_id <> #{excludeId}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update product
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= now() then '2'
|
||||
when effective_date is null or effective_date > now() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -180,4 +180,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_income_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAutoFeesByBillId" parameterType="String">
|
||||
delete from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
and (manual_flag is null or manual_flag <> '1')
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<?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.PrcPriceExcelFileMapper">
|
||||
|
||||
<resultMap type="PrcPriceExcelFile" id="PrcPriceExcelFileResult">
|
||||
<id property="pefId" column="pef_id" />
|
||||
<result property="excelType" column="excel_type" />
|
||||
<result property="effectiveTime" column="effective_time" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="filePath" column="file_path" />
|
||||
<result property="fileSize" column="file_size" />
|
||||
<result property="contentType" column="content_type" />
|
||||
<result property="fileExtension" column="file_extension" />
|
||||
<result property="ossId" column="oss_id" />
|
||||
<result property="sheetNames" column="sheet_names" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="selectPrcPriceExcelFileVo">
|
||||
select pef_id, excel_type, effective_time, file_name, file_path, file_size, content_type,
|
||||
file_extension, oss_id, sheet_names, remark, created_by, create_time, updated_by, update_time
|
||||
from prc_price_excel_file
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceExcelFileById" parameterType="Long" resultMap="PrcPriceExcelFileResult">
|
||||
<include refid="selectPrcPriceExcelFileVo"/>
|
||||
where pef_id = #{pefId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceExcelFileList" parameterType="PrcPriceExcelFile" resultMap="PrcPriceExcelFileResult">
|
||||
<include refid="selectPrcPriceExcelFileVo"/>
|
||||
<where>
|
||||
<if test="excelType != null and excelType != ''">
|
||||
AND excel_type = #{excelType}
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
AND file_name like concat('%', #{fileName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by pef_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectByProductCode" resultMap="PrcPriceExcelFileResult">
|
||||
select distinct f.pef_id, f.excel_type, f.effective_time, f.file_name, f.file_path, f.file_size,
|
||||
f.content_type, f.file_extension, f.oss_id, f.sheet_names, f.remark,
|
||||
f.created_by, f.create_time, f.updated_by, f.update_time
|
||||
from prc_price_excel_file f
|
||||
inner join product p on p.pef_id = f.pef_id
|
||||
where p.product_code = #{productCode}
|
||||
and p.pef_id is not null
|
||||
order by f.effective_time desc, f.pef_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPriceExcelFile" parameterType="PrcPriceExcelFile" useGeneratedKeys="true" keyProperty="pefId">
|
||||
insert into prc_price_excel_file (
|
||||
<if test="excelType != null and excelType != ''">excel_type,</if>
|
||||
<if test="effectiveTime != null">effective_time,</if>
|
||||
<if test="fileName != null and fileName != ''">file_name,</if>
|
||||
<if test="filePath != null and filePath != ''">file_path,</if>
|
||||
<if test="fileSize != null">file_size,</if>
|
||||
<if test="contentType != null">content_type,</if>
|
||||
<if test="fileExtension != null">file_extension,</if>
|
||||
<if test="ossId != null">oss_id,</if>
|
||||
<if test="sheetNames != null">sheet_names,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="excelType != null and excelType != ''">#{excelType},</if>
|
||||
<if test="effectiveTime != null">#{effectiveTime},</if>
|
||||
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
||||
<if test="fileSize != null">#{fileSize},</if>
|
||||
<if test="contentType != null">#{contentType},</if>
|
||||
<if test="fileExtension != null">#{fileExtension},</if>
|
||||
<if test="ossId != null">#{ossId},</if>
|
||||
<if test="sheetNames != null">#{sheetNames},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceExcelFile" parameterType="PrcPriceExcelFile">
|
||||
update prc_price_excel_file
|
||||
<set>
|
||||
<if test="excelType != null and excelType != ''">excel_type = #{excelType},</if>
|
||||
<if test="effectiveTime != null">effective_time = #{effectiveTime},</if>
|
||||
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
|
||||
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
|
||||
<if test="fileSize != null">file_size = #{fileSize},</if>
|
||||
<if test="contentType != null">content_type = #{contentType},</if>
|
||||
<if test="fileExtension != null">file_extension = #{fileExtension},</if>
|
||||
<if test="ossId != null">oss_id = #{ossId},</if>
|
||||
<if test="sheetNames != null">sheet_names = #{sheetNames},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where pef_id = #{pefId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceExcelFileByIds" parameterType="Long">
|
||||
delete from prc_price_excel_file where pef_id in
|
||||
<foreach item="pefId" collection="array" open="(" separator="," close=")">
|
||||
#{pefId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectByRedlineProductCode" resultMap="PrcPriceExcelFileResult">
|
||||
select distinct f.pef_id, f.excel_type, f.effective_time, f.file_name, f.file_path, f.file_size,
|
||||
f.content_type, f.file_extension, f.oss_id, f.sheet_names, f.remark,
|
||||
f.created_by, f.create_time, f.updated_by, f.update_time
|
||||
from prc_price_excel_file f
|
||||
inner join redline_product p on p.pef_id = f.pef_id
|
||||
where p.product_code = #{productCode}
|
||||
and p.pef_id is not null
|
||||
order by f.effective_time desc, f.pef_id desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -17,13 +17,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="taxMode" column="tax_mode" />
|
||||
<result property="sourceProductId" column="source_product_id" />
|
||||
<result property="sourceSheet" column="source_sheet" />
|
||||
<result property="pefId" column="pef_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select psp_id, price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time, update_time
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id,
|
||||
create_time, update_time
|
||||
from prc_price_set_product
|
||||
</sql>
|
||||
|
||||
@@ -52,10 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertPrcPriceSetProduct" parameterType="PrcPriceSetProduct" useGeneratedKeys="true" keyProperty="pspId">
|
||||
insert into prc_price_set_product (
|
||||
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, create_time
|
||||
) values (
|
||||
#{priceSetId}, #{psvId}, #{productCode}, #{productName}, #{serviceLevel}, #{cargoAttr},
|
||||
#{destRegion}, #{updateNote}, #{taxMode}, #{sourceProductId}, #{sourceSheet}, sysdate()
|
||||
#{destRegion}, #{updateNote}, #{taxMode}, #{sourceProductId}, #{sourceSheet}, #{pefId}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -70,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
|
||||
<if test="sourceProductId != null">source_product_id = #{sourceProductId},</if>
|
||||
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
|
||||
<if test="pefId != null">pef_id = #{pefId},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where psp_id = #{pspId}
|
||||
@@ -88,11 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="copyFromVersion">
|
||||
insert into prc_price_set_product (
|
||||
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, create_time
|
||||
)
|
||||
select
|
||||
price_set_id, #{newPsvId}, product_code, product_name, service_level, cargo_attr,
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, sysdate()
|
||||
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, sysdate()
|
||||
from prc_price_set_product
|
||||
where psv_id = #{srcPsvId}
|
||||
order by psp_id asc
|
||||
@@ -159,4 +162,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and (d.psp_id is null or d.psp_id <> sp.psp_id)
|
||||
</update>
|
||||
|
||||
<update id="updatePefIdByPsvId">
|
||||
update prc_price_set_product
|
||||
set pef_id = #{pefId}, update_time = sysdate()
|
||||
where psv_id = #{psvId}
|
||||
<if test="productCodes != null and productCodes.size() > 0">
|
||||
and product_code in
|
||||
<foreach item="code" collection="productCodes" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
-208
@@ -1,208 +0,0 @@
|
||||
<?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.PrcPriceSetVersionSurchargeMapper">
|
||||
|
||||
<resultMap type="PrcPriceSetVersionSurcharge" id="PrcPriceSetVersionSurchargeResult">
|
||||
<id property="psvsId" column="psvs_id" />
|
||||
<result property="psvId" column="psv_id" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="psdId" column="psd_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="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<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="selectPrcPriceSetVersionSurchargeVo">
|
||||
select psvs_id, psv_id, sc_id, product_code, psd_id, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_price_set_version_surcharge
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceSetVersionSurchargeById" parameterType="Long" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
where psvs_id = #{psvsId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceSetVersionSurchargeList" parameterType="PrcPriceSetVersionSurcharge" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
<where>
|
||||
<if test="psvId != null">
|
||||
AND psv_id = #{psvId}
|
||||
</if>
|
||||
<if test="scId != null">
|
||||
AND sc_id = #{scId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code = #{productCode}
|
||||
</if>
|
||||
<if test="psdId != null">
|
||||
AND psd_id = #{psdId}
|
||||
</if>
|
||||
</where>
|
||||
order by psvs_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPriceSetVersionSurcharge" parameterType="PrcPriceSetVersionSurcharge" useGeneratedKeys="true" keyProperty="psvsId">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
<if test="psvId != null">psv_id,</if>
|
||||
<if test="psdId != null">psd_id,</if>
|
||||
<if test="scId != null">sc_id,</if>
|
||||
<if test="productCode != null">product_code,</if>
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type,</if>
|
||||
<if test="chargeValue != null">charge_value,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="psvId != null">#{psvId},</if>
|
||||
<if test="psdId != null">#{psdId},</if>
|
||||
<if test="scId != null">#{scId},</if>
|
||||
<if test="productCode != null">#{productCode},</if>
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceSetVersionSurcharge" parameterType="PrcPriceSetVersionSurcharge">
|
||||
update prc_price_set_version_surcharge
|
||||
<set>
|
||||
<if test="psdId != null">psd_id = #{psdId},</if>
|
||||
<if test="scId != null">sc_id = #{scId},</if>
|
||||
product_code = #{productCode},
|
||||
<if test="scName != null and scName != ''">sc_name = #{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type = #{chargeType},</if>
|
||||
<if test="chargeValue != null">charge_value = #{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode = #{roundMode},</if>
|
||||
country_code = #{countryCode},
|
||||
sc_note = #{scNote},
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where psvs_id = #{psvsId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceSetVersionSurchargeByIds" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psvs_id in
|
||||
<foreach item="psvsId" collection="array" open="(" separator="," close=")">
|
||||
#{psvsId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByPsvId" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psv_id = #{psvId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByPsdId" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psd_id = #{psdId}
|
||||
</delete>
|
||||
|
||||
<select id="selectByPsdIds" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
where psd_id in
|
||||
<foreach item="id" collection="psdIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by psvs_id asc
|
||||
</select>
|
||||
|
||||
<!-- Join detail x surcharge_rel x surcharge; skip OF fuel; product-level or same detail_id -->
|
||||
<insert id="insertFromLibraryRels">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
psv_id, psd_id, sc_id, product_code, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time
|
||||
)
|
||||
select
|
||||
d.psv_id,
|
||||
d.psd_id,
|
||||
r.sc_id,
|
||||
d.product_code,
|
||||
s.sc_name,
|
||||
ifnull(nullif(s.fee_type, ''), 'SURCHARGE'),
|
||||
ifnull(nullif(s.charge_type, ''), 'FIXED'),
|
||||
s.charge_value,
|
||||
ifnull(nullif(s.currency, ''), 'CNY'),
|
||||
ifnull(nullif(s.round_mode, ''), 'HALF_UP'),
|
||||
s.country_code,
|
||||
s.sc_note,
|
||||
#{createBy},
|
||||
sysdate()
|
||||
from prc_price_set_detail d
|
||||
inner join prc_surcharge_rel r on r.product_code = d.product_code
|
||||
inner join prc_surcharge s on s.sc_id = r.sc_id
|
||||
where d.psv_id = #{psvId}
|
||||
and ifnull(s.sc_name, '') <> ''
|
||||
and s.charge_value is not null
|
||||
and lower(ifnull(s.ss_code, '')) not in ('of', 'vd')
|
||||
and (r.detail_id is null or r.detail_id = d.product_country_id)
|
||||
and (
|
||||
s.country_code is null or s.country_code = ''
|
||||
or d.country_code is null or d.country_code = ''
|
||||
or upper(s.country_code) = upper(d.country_code)
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="copySurchargesFromVersion">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
psv_id, psd_id, sc_id, product_code, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time
|
||||
)
|
||||
select
|
||||
#{newPsvId},
|
||||
nd.psd_id,
|
||||
sc.sc_id,
|
||||
sc.product_code,
|
||||
sc.sc_name,
|
||||
sc.fee_type,
|
||||
sc.charge_type,
|
||||
sc.charge_value,
|
||||
sc.currency,
|
||||
sc.round_mode,
|
||||
sc.country_code,
|
||||
sc.sc_note,
|
||||
#{createBy},
|
||||
sysdate()
|
||||
from prc_price_set_version_surcharge sc
|
||||
inner join prc_price_set_detail od
|
||||
on od.psd_id = sc.psd_id and od.psv_id = #{srcPsvId}
|
||||
inner join prc_price_set_detail nd
|
||||
on nd.psv_id = #{newPsvId}
|
||||
and nd.product_code = od.product_code
|
||||
and ifnull(nd.country_code, '') = ifnull(od.country_code, '')
|
||||
and ifnull(nd.zone_code, '') = ifnull(od.zone_code, '')
|
||||
and ifnull(nd.weight_label, '') = ifnull(od.weight_label, '')
|
||||
and ifnull(nd.product_country_id, 0) = ifnull(od.product_country_id, 0)
|
||||
and ifnull(nd.discount_value, -1) = ifnull(od.discount_value, -1)
|
||||
where sc.psv_id = #{srcPsvId}
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -10,6 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="detailId" column="detail_id" />
|
||||
<result property="priceType" column="price_type" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
@@ -17,7 +19,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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" />
|
||||
@@ -30,13 +31,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectPrcSurchargeRelVo">
|
||||
select r.rel_id, r.sc_id, r.product_id, r.product_code, r.detail_id,
|
||||
r.price_type, r.country_code,
|
||||
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
|
||||
s.round_mode, s.ss_code, s.sc_note,
|
||||
ifnull(c.country_name, rc.country_name) as country_name, ifnull(c.weight_min, rc.weight_min) as weight_min, ifnull(c.weight_max, rc.weight_max) as 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
|
||||
left join product_country c on c.detail_id = r.detail_id and r.price_type = 'PRODUCT'
|
||||
left join redline_product_country rc on rc.detail_id = r.detail_id and r.price_type = 'REDLINE'
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcSurchargeRelList" parameterType="PrcSurchargeRel" resultMap="PrcSurchargeRelResult">
|
||||
@@ -51,17 +54,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scId != null">
|
||||
AND r.sc_id = #{scId}
|
||||
</if>
|
||||
<if test="detailId != null">
|
||||
AND r.detail_id = #{detailId}
|
||||
</if>
|
||||
<if test="priceType != null and priceType != ''">
|
||||
AND r.price_type = #{priceType}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND r.country_code = #{countryCode}
|
||||
</if>
|
||||
</where>
|
||||
order by r.detail_id is not null, r.rel_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectByDetailIdsAndPriceType" resultMap="PrcSurchargeRelResult">
|
||||
<include refid="selectPrcSurchargeRelVo"/>
|
||||
where r.price_type = #{priceType}
|
||||
and r.detail_id in
|
||||
<foreach item="id" collection="detailIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by 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,
|
||||
sc_id, product_id, product_code, detail_id, price_type, country_code,
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
#{scId}, #{productId}, #{productCode}, #{detailId},
|
||||
#{priceType}, #{countryCode},
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
@@ -79,6 +102,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
and price_type = 'PRODUCT'
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByDetailIdsAndPriceType">
|
||||
delete from prc_surcharge_rel
|
||||
where price_type = #{priceType}
|
||||
and detail_id in
|
||||
<foreach item="id" collection="detailIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductIdsAndPriceType">
|
||||
delete from prc_surcharge_rel
|
||||
where price_type = #{priceType}
|
||||
and product_id in
|
||||
<foreach item="id" collection="productIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 附加费版本化编辑后,产品关联重指向新记录 -->
|
||||
|
||||
Reference in New Issue
Block a user