优化邮编分区管理,新增匹配类型字段及相关逻辑
This commit is contained in:
@@ -8,12 +8,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<id property="detailId" column="detail_id" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="postcode" column="postcode" />
|
||||
<result property="matchType" column="match_type" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcZoneDetailVo">
|
||||
select detail_id, zone_id, postcode, create_time, update_time
|
||||
select detail_id, zone_id, postcode, match_type, create_time, update_time
|
||||
from prc_zone_detail
|
||||
</sql>
|
||||
|
||||
@@ -51,18 +52,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into prc_zone_detail (
|
||||
<if test="zoneId != null">zone_id,</if>
|
||||
<if test="postcode != null and postcode != ''">postcode,</if>
|
||||
match_type,
|
||||
create_time
|
||||
) values (
|
||||
<if test="zoneId != null">#{zoneId},</if>
|
||||
<if test="postcode != null and postcode != ''">#{postcode},</if>
|
||||
#{matchType},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrcZoneDetailBatch">
|
||||
insert into prc_zone_detail (zone_id, postcode, create_time) values
|
||||
insert into prc_zone_detail (zone_id, postcode, match_type, create_time) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.zoneId}, #{item.postcode}, sysdate())
|
||||
(#{item.zoneId}, #{item.postcode}, #{item.matchType}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -71,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<set>
|
||||
<if test="zoneId != null">zone_id = #{zoneId},</if>
|
||||
<if test="postcode != null and postcode != ''">postcode = #{postcode},</if>
|
||||
<if test="matchType != null and matchType != ''">match_type = #{matchType},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where detail_id = #{detailId}
|
||||
@@ -120,8 +124,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and z.product_id is null
|
||||
and upper(ifnull(z.country_code,'')) = upper(#{countryCode})
|
||||
and (
|
||||
replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '')
|
||||
or replace(upper(#{postcode}), ' ', '') like concat(replace(upper(ifnull(d.postcode,'')), ' ', ''), '%')
|
||||
(
|
||||
upper(ifnull(d.match_type, 'FULL')) = 'FULL'
|
||||
and replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '')
|
||||
)
|
||||
or
|
||||
(
|
||||
upper(ifnull(d.match_type, 'FULL')) = 'PREFIX'
|
||||
and replace(upper(#{postcode}), ' ', '') like concat(replace(upper(ifnull(d.postcode,'')), ' ', ''), '%')
|
||||
)
|
||||
)
|
||||
order by
|
||||
case when replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '') then 0 else 1 end,
|
||||
@@ -147,8 +158,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where z.zone_type = 'LABEL'
|
||||
and z.product_id = #{productId}
|
||||
and (
|
||||
replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '')
|
||||
or replace(upper(#{postcode}), ' ', '') like concat(replace(upper(ifnull(d.postcode,'')), ' ', ''), '%')
|
||||
(
|
||||
upper(ifnull(d.match_type, 'FULL')) = 'FULL'
|
||||
and replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '')
|
||||
)
|
||||
or
|
||||
(
|
||||
upper(ifnull(d.match_type, 'FULL')) = 'PREFIX'
|
||||
and replace(upper(#{postcode}), ' ', '') like concat(replace(upper(ifnull(d.postcode,'')), ' ', ''), '%')
|
||||
)
|
||||
)
|
||||
order by
|
||||
case when replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '') then 0 else 1 end,
|
||||
|
||||
Reference in New Issue
Block a user