修改公共组件
This commit is contained in:
@@ -34,4 +34,6 @@ public class BmsProductCountry implements Serializable
|
||||
private Date updatedAt;
|
||||
/** query only: true = expire_date is null */
|
||||
private Boolean openOnly;
|
||||
/** query only: ACTIVE已生效 / PENDING待生效 / EXPIRED已失效(按生效/失效日期与当前日期派生) */
|
||||
private String effectStatus;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="updatedAt" column="updated_at" />
|
||||
<result property="effectStatus" column="effect_status" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 派生状态:已失效(过期) > 待生效(未到生效日) > 已生效 -->
|
||||
<sql id="effectStatusCase">
|
||||
case
|
||||
when expire_date is not null and expire_date <= curdate() then 'EXPIRED'
|
||||
when effective_date is null or effective_date > curdate() then 'PENDING'
|
||||
else 'ACTIVE'
|
||||
end
|
||||
</sql>
|
||||
|
||||
<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, expire_date, created_at, updated_at
|
||||
effective_date, expire_date, created_at, updated_at,
|
||||
<include refid="effectStatusCase"/> as effect_status
|
||||
from bms_product_country
|
||||
</sql>
|
||||
|
||||
@@ -53,6 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="openOnly != null and openOnly">
|
||||
AND expire_date is null
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND (<include refid="effectStatusCase"/>) = #{effectStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by effective_date desc, country_name asc, weight_min asc, detail_id asc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user