修改公共配置字典

This commit is contained in:
wuweihua
2026-09-08 10:51:20 +08:00
parent 647be14d66
commit 38796d8683
25 changed files with 389 additions and 80 deletions
@@ -17,15 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<select id="selectBmsProductCountryList" parameterType="BmsProductCountry" resultMap="BmsProductCountryResult">
<sql id="selectVo">
select detail_id, product_code, country_name, country_code, weight_min, weight_max,
freight_price, registration_fee, size_limit, last_mile, lead_time,
effective_date, created_at, updated_at
effective_date, expire_date, created_at, updated_at
from bms_product_country
</sql>
<select id="selectBmsProductCountryList" parameterType="BmsProductCountry" resultMap="BmsProductCountryResult">
<include refid="selectVo"/>
<where>
<if test="productCode != null and productCode != ''">
AND product_code = #{productCode}
@@ -42,19 +47,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightMax != null">
AND weight_max = #{weightMax}
</if>
<if test="effectiveDate != null">
AND effective_date = #{effectiveDate}
</if>
<if test="openOnly != null and openOnly">
AND expire_date is null
</if>
</where>
order by country_name asc, weight_min asc, detail_id asc
order by effective_date desc, country_name asc, weight_min asc, detail_id asc
</select>
<insert id="insertBmsProductCountry" parameterType="BmsProductCountry" useGeneratedKeys="true" keyProperty="detailId">
insert into bms_product_country (
product_code, country_name, country_code, weight_min, weight_max,
freight_price, registration_fee, size_limit, last_mile, lead_time,
effective_date, created_at
effective_date, expire_date, created_at
) values (
#{productCode}, #{countryName}, #{countryCode}, #{weightMin}, #{weightMax},
#{freightPrice}, #{registrationFee}, #{sizeLimit}, #{lastMile}, #{leadTime},
#{effectiveDate}, sysdate()
#{effectiveDate}, #{expireDate}, sysdate()
)
</insert>
@@ -69,11 +80,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectMaxOpenEffectiveDate" resultType="java.util.Date">
select max(effective_date) from bms_product_country
where product_code = #{productCode}
and expire_date is null
</select>
<update id="expireOpenByProductCode">
update bms_product_country
set expire_date = #{newEffectiveDate},
updated_at = sysdate()
where product_code = #{productCode}
and expire_date is null
and (effective_date is null or effective_date &lt; #{newEffectiveDate})
</update>
<delete id="deleteOpenByProductCodeAndEffectiveDate">
delete from bms_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>
<select id="selectMatchByProductCountryWeight" resultMap="BmsProductCountryResult">
select detail_id, product_code, country_name, country_code, weight_min, weight_max,
freight_price, registration_fee, size_limit, last_mile, lead_time,
effective_date, created_at, updated_at
from bms_product_country
<include refid="selectVo"/>
where product_code = #{productCode}
and weight_min &lt;= #{weight}
and weight_max &gt;= #{weight}
@@ -89,7 +122,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</otherwise>
</choose>
<if test="bizDate != null">
and effective_date &lt;= #{bizDate}
and (effective_date is null or effective_date &lt;= #{bizDate})
and (expire_date is null or expire_date &gt; #{bizDate})
</if>
<if test="bizDate == null">
and expire_date is null
</if>
order by effective_date desc, weight_min asc, detail_id asc
limit 1
@@ -58,6 +58,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND p.status = #{status}
</if>
<if test="effectStatus != null and effectStatus != ''">
<choose>
<when test="effectStatus == 'EXPIRED'">
AND p.status = '1'
</when>
<when test="effectStatus == 'PENDING'">
AND p.status = '0'
AND (p.effective_date is null or p.effective_date &gt; curdate())
</when>
<when test="effectStatus == 'ACTIVE'">
AND p.status = '0'
AND p.effective_date is not null
AND p.effective_date &lt;= curdate()
</when>
</choose>
</if>
<if test="cargoAttr != null and cargoAttr != ''">
AND p.cargo_attr like concat('%', #{cargoAttr}, '%')
</if>