新增打单产品分区管理功能,优化常规分区逻辑
This commit is contained in:
@@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.region_id = #{regionId}
|
||||
and z.zone_type = 'REGULAR'
|
||||
and z.product_id is null
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcZoneDetail" parameterType="PrcZoneDetail" useGeneratedKeys="true" keyProperty="detailId">
|
||||
@@ -89,11 +91,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete d from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.region_id = #{regionId}
|
||||
and z.zone_type = 'REGULAR'
|
||||
and z.product_id is null
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcZoneDetailByProductId" parameterType="Long">
|
||||
delete d from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.product_id = #{productId}
|
||||
and z.zone_type = 'LABEL'
|
||||
</delete>
|
||||
|
||||
<select id="selectZoneByCountryPostcode" resultType="com.bms.price.domain.PrcZone">
|
||||
select z.zone_id as zoneId,
|
||||
z.zone_type as zoneType,
|
||||
z.region_id as regionId,
|
||||
z.product_id as productId,
|
||||
z.country_code as countryCode,
|
||||
z.zone_code as zoneCode,
|
||||
z.zone_name as zoneName,
|
||||
@@ -103,7 +116,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
z.update_time as updateTime
|
||||
from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where upper(ifnull(z.country_code,'')) = upper(#{countryCode})
|
||||
where z.zone_type = 'REGULAR'
|
||||
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,'')), ' ', ''), '%')
|
||||
)
|
||||
order by
|
||||
case when replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '') then 0 else 1 end,
|
||||
char_length(replace(ifnull(d.postcode,''), ' ', '')) desc,
|
||||
d.detail_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectZoneByProductPostcode" resultType="com.bms.price.domain.PrcZone">
|
||||
select z.zone_id as zoneId,
|
||||
z.zone_type as zoneType,
|
||||
z.region_id as regionId,
|
||||
z.product_id as productId,
|
||||
z.country_code as countryCode,
|
||||
z.zone_code as zoneCode,
|
||||
z.zone_name as zoneName,
|
||||
z.zone_sort as zoneSort,
|
||||
z.remark as remark,
|
||||
z.create_time as createTime,
|
||||
z.update_time as updateTime
|
||||
from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
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,'')), ' ', ''), '%')
|
||||
|
||||
Reference in New Issue
Block a user