增加分区功能

This commit is contained in:
wuweihua
2026-09-15 10:28:07 +08:00
parent ddbbd73ba2
commit c28b5a2b6e
26 changed files with 1512 additions and 1215 deletions
@@ -0,0 +1,94 @@
<?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.ruoyi.price.mapper.PrcZoneDetailMapper">
<resultMap type="PrcZoneDetail" id="PrcZoneDetailResult">
<id property="detailId" column="detail_id" />
<result property="zoneId" column="zone_id" />
<result property="postcode" column="postcode" />
<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
from prc_zone_detail
</sql>
<select id="selectPrcZoneDetailById" parameterType="Long" resultMap="PrcZoneDetailResult">
<include refid="selectPrcZoneDetailVo"/>
where detail_id = #{detailId}
</select>
<select id="selectPrcZoneDetailList" parameterType="PrcZoneDetail" resultMap="PrcZoneDetailResult">
<include refid="selectPrcZoneDetailVo"/>
<where>
<if test="zoneId != null">
AND zone_id = #{zoneId}
</if>
<if test="postcode != null and postcode != ''">
AND postcode like concat('%', #{postcode}, '%')
</if>
</where>
order by postcode asc, detail_id asc
</select>
<select id="countByZoneId" parameterType="Long" resultType="int">
select count(1) from prc_zone_detail where zone_id = #{zoneId}
</select>
<select id="countByRegionId" parameterType="Long" resultType="int">
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}
</select>
<insert id="insertPrcZoneDetail" parameterType="PrcZoneDetail" useGeneratedKeys="true" keyProperty="detailId">
insert into prc_zone_detail (
<if test="zoneId != null">zone_id,</if>
<if test="postcode != null and postcode != ''">postcode,</if>
create_time
) values (
<if test="zoneId != null">#{zoneId},</if>
<if test="postcode != null and postcode != ''">#{postcode},</if>
sysdate()
)
</insert>
<insert id="insertPrcZoneDetailBatch">
insert into prc_zone_detail (zone_id, postcode, create_time) values
<foreach collection="list" item="item" separator=",">
(#{item.zoneId}, #{item.postcode}, sysdate())
</foreach>
</insert>
<update id="updatePrcZoneDetail" parameterType="PrcZoneDetail">
update prc_zone_detail
<set>
<if test="zoneId != null">zone_id = #{zoneId},</if>
<if test="postcode != null and postcode != ''">postcode = #{postcode},</if>
update_time = sysdate()
</set>
where detail_id = #{detailId}
</update>
<delete id="deletePrcZoneDetailByIds" parameterType="Long">
delete from prc_zone_detail where detail_id in
<foreach item="detailId" collection="array" open="(" separator="," close=")">
#{detailId}
</foreach>
</delete>
<delete id="deletePrcZoneDetailByZoneId" parameterType="Long">
delete from prc_zone_detail where zone_id = #{zoneId}
</delete>
<delete id="deletePrcZoneDetailByRegionId" parameterType="Long">
delete d from prc_zone_detail d
inner join prc_zone z on z.zone_id = d.zone_id
where z.region_id = #{regionId}
</delete>
</mapper>
@@ -0,0 +1,162 @@
<?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.ruoyi.price.mapper.PrcZoneMapper">
<resultMap type="PrcZone" id="PrcZoneResult">
<id property="zoneId" column="zone_id" />
<result property="regionId" column="region_id" />
<result property="countryCode" column="country_code" />
<result property="zoneCode" column="zone_code" />
<result property="zoneName" column="zone_name" />
<result property="zoneSort" column="zone_sort" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="detailCount" column="detail_count" />
<result property="countryNameCn" column="country_name_cn" />
</resultMap>
<resultMap type="PrcZoneRegion" id="PrcZoneRegionResult">
<id property="regionId" column="region_id" />
<result property="countryNameCn" column="country_name_cn" />
<result property="countryNameEn" column="country_name_en" />
<result property="countryCode2" column="country_code_2" />
<result property="status" column="status" />
<result property="zoneCount" column="zone_count" />
<result property="detailCount" column="detail_count" />
</resultMap>
<sql id="selectPrcZoneVo">
select zone_id, region_id, country_code, zone_code, zone_name, zone_sort, remark, create_time, update_time
from prc_zone
</sql>
<select id="selectPrcZoneById" parameterType="Long" resultMap="PrcZoneResult">
<include refid="selectPrcZoneVo"/>
where zone_id = #{zoneId}
</select>
<select id="selectPrcZoneListByRegionId" parameterType="Long" resultMap="PrcZoneResult">
select z.zone_id, z.region_id, z.country_code, z.zone_code, z.zone_name, z.zone_sort, z.remark,
z.create_time, z.update_time,
(select count(1) from prc_zone_detail d where d.zone_id = z.zone_id) as detail_count
from prc_zone z
where z.region_id = #{regionId}
order by z.zone_sort asc, z.zone_id asc
</select>
<select id="selectPrcZoneList" parameterType="PrcZone" resultMap="PrcZoneResult">
select z.zone_id, z.region_id, z.country_code, z.zone_code, z.zone_name, z.zone_sort, z.remark,
z.create_time, z.update_time,
r.country_name_cn,
(select count(1) from prc_zone_detail d where d.zone_id = z.zone_id) as detail_count
from prc_zone z
left join bms_region r on r.region_id = z.region_id
<where>
<if test="regionId != null">
AND z.region_id = #{regionId}
</if>
<if test="countryCode != null and countryCode != ''">
AND z.country_code = #{countryCode}
</if>
<if test="zoneCode != null and zoneCode != ''">
AND z.zone_code like concat('%', #{zoneCode}, '%')
</if>
<if test="zoneName != null and zoneName != ''">
AND z.zone_name like concat('%', #{zoneName}, '%')
</if>
</where>
order by z.zone_sort asc, z.zone_id asc
</select>
<select id="selectZoneRegionList" parameterType="PrcZoneRegion" resultMap="PrcZoneRegionResult">
select r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status,
count(distinct z.zone_id) as zone_count,
count(d.detail_id) as detail_count
from prc_zone z
inner join bms_region r on r.region_id = z.region_id
left join prc_zone_detail d on d.zone_id = z.zone_id
<where>
<if test="countryNameCn != null and countryNameCn != ''">
AND r.country_name_cn like concat('%', #{countryNameCn}, '%')
</if>
<if test="countryCode2 != null and countryCode2 != ''">
AND (r.country_code_2 = #{countryCode2} OR z.country_code = #{countryCode2})
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
</where>
group by r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status
order by r.country_name_cn asc, r.region_id asc
</select>
<select id="selectZoneRegionById" parameterType="Long" resultMap="PrcZoneRegionResult">
select r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status,
(select count(1) from prc_zone z where z.region_id = r.region_id) as zone_count,
(select count(1) from prc_zone_detail d
inner join prc_zone z on z.zone_id = d.zone_id
where z.region_id = r.region_id) as detail_count
from bms_region r
where r.region_id = #{regionId}
</select>
<select id="countByRegionId" parameterType="Long" resultType="int">
select count(1) from prc_zone where region_id = #{regionId}
</select>
<insert id="insertPrcZone" parameterType="PrcZone" useGeneratedKeys="true" keyProperty="zoneId">
insert into prc_zone (
<if test="regionId != null">region_id,</if>
<if test="countryCode != null and countryCode != ''">country_code,</if>
<if test="zoneCode != null and zoneCode != ''">zone_code,</if>
<if test="zoneName != null">zone_name,</if>
<if test="zoneSort != null">zone_sort,</if>
<if test="remark != null">remark,</if>
create_time
) values (
<if test="regionId != null">#{regionId},</if>
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
<if test="zoneCode != null and zoneCode != ''">#{zoneCode},</if>
<if test="zoneName != null">#{zoneName},</if>
<if test="zoneSort != null">#{zoneSort},</if>
<if test="remark != null">#{remark},</if>
sysdate()
)
</insert>
<update id="updatePrcZone" parameterType="PrcZone">
update prc_zone
<set>
<if test="regionId != null">region_id = #{regionId},</if>
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
<if test="zoneCode != null and zoneCode != ''">zone_code = #{zoneCode},</if>
<if test="zoneName != null">zone_name = #{zoneName},</if>
<if test="zoneSort != null">zone_sort = #{zoneSort},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where zone_id = #{zoneId}
</update>
<delete id="deletePrcZoneByIds" parameterType="Long">
delete from prc_zone where zone_id in
<foreach item="zoneId" collection="array" open="(" separator="," close=")">
#{zoneId}
</foreach>
</delete>
<delete id="deletePrcZoneByRegionId" parameterType="Long">
delete from prc_zone where region_id = #{regionId}
</delete>
<delete id="deletePrcZoneByRegionIds" parameterType="Long">
delete from prc_zone where region_id in
<foreach item="regionId" collection="array" open="(" separator="," close=")">
#{regionId}
</foreach>
</delete>
</mapper>
@@ -1,84 +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.ruoyi.price.mapper.XtdZoneCountryMapper">
<resultMap type="XtdZoneCountry" id="XtdZoneCountryResult">
<id property="zcId" column="zc_id" />
<result property="zdId" column="zd_id" />
<result property="countryCode" column="country_code" />
<result property="zcDividekind" column="zc_dividekind" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectXtdZoneCountryVo">
select zc_id, zd_id, country_code, zc_dividekind, create_time, update_time
from xtd_zonecountry
</sql>
<select id="selectXtdZoneCountryById" parameterType="Long" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
where zc_id = #{zcId}
</select>
<select id="selectXtdZoneCountryListByZdId" parameterType="Long" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
where zd_id = #{zdId}
order by zc_id asc
</select>
<select id="selectXtdZoneCountryList" parameterType="XtdZoneCountry" resultMap="XtdZoneCountryResult">
<include refid="selectXtdZoneCountryVo"/>
<where>
<if test="zdId != null">
AND zd_id = #{zdId}
</if>
<if test="countryCode != null and countryCode != ''">
AND country_code = #{countryCode}
</if>
<if test="zcDividekind != null and zcDividekind != ''">
AND zc_dividekind = #{zcDividekind}
</if>
</where>
order by zc_id asc
</select>
<select id="countByZdId" parameterType="Long" resultType="int">
select count(1) from xtd_zonecountry where zd_id = #{zdId}
</select>
<insert id="insertXtdZoneCountry" parameterType="XtdZoneCountry" useGeneratedKeys="true" keyProperty="zcId">
insert into xtd_zonecountry (
<if test="zdId != null">zd_id,</if>
<if test="countryCode != null and countryCode != ''">country_code,</if>
<if test="zcDividekind != null and zcDividekind != ''">zc_dividekind,</if>
create_time
) values (
<if test="zdId != null">#{zdId},</if>
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
<if test="zcDividekind != null and zcDividekind != ''">#{zcDividekind},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneCountry" parameterType="XtdZoneCountry">
update xtd_zonecountry
<set>
<if test="zdId != null">zd_id = #{zdId},</if>
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
<if test="zcDividekind != null and zcDividekind != ''">zc_dividekind = #{zcDividekind},</if>
update_time = sysdate()
</set>
where zc_id = #{zcId}
</update>
<delete id="deleteXtdZoneCountryByIds" parameterType="Long">
delete from xtd_zonecountry where zc_id in
<foreach item="zcId" collection="array" open="(" separator="," close=")">
#{zcId}
</foreach>
</delete>
</mapper>
@@ -1,97 +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.ruoyi.price.mapper.XtdZoneDivisionMapper">
<resultMap type="XtdZoneDivision" id="XtdZoneDivisionResult">
<id property="zdId" column="zd_id" />
<result property="zsId" column="zs_id" />
<result property="zdSort" column="zd_sort" />
<result property="zdCode" column="zd_code" />
<result property="znName" column="zn_name" />
<result property="znEname" column="zn_ename" />
<result property="znNote" column="zn_note" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="countryCount" column="country_count" />
</resultMap>
<sql id="selectXtdZoneDivisionVo">
select zd_id, zs_id, zd_sort, zd_code, zn_name, zn_ename, zn_note, create_time, update_time
from xtd_zone_division
</sql>
<select id="selectXtdZoneDivisionById" parameterType="Long" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
where zd_id = #{zdId}
</select>
<select id="selectXtdZoneDivisionListByZsId" parameterType="Long" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
where zs_id = #{zsId}
order by zd_sort asc, zd_id asc
</select>
<select id="selectXtdZoneDivisionList" parameterType="XtdZoneDivision" resultMap="XtdZoneDivisionResult">
<include refid="selectXtdZoneDivisionVo"/>
<where>
<if test="zsId != null">
AND zs_id = #{zsId}
</if>
<if test="zdCode != null and zdCode != ''">
AND zd_code like concat('%', #{zdCode}, '%')
</if>
<if test="znName != null and znName != ''">
AND zn_name like concat('%', #{znName}, '%')
</if>
</where>
order by zd_sort asc, zd_id asc
</select>
<select id="countByZsId" parameterType="Long" resultType="int">
select count(1) from xtd_zone_division where zs_id = #{zsId}
</select>
<insert id="insertXtdZoneDivision" parameterType="XtdZoneDivision" useGeneratedKeys="true" keyProperty="zdId">
insert into xtd_zone_division (
<if test="zsId != null">zs_id,</if>
<if test="zdSort != null">zd_sort,</if>
<if test="zdCode != null">zd_code,</if>
<if test="znName != null">zn_name,</if>
<if test="znEname != null">zn_ename,</if>
<if test="znNote != null">zn_note,</if>
create_time
) values (
<if test="zsId != null">#{zsId},</if>
<if test="zdSort != null">#{zdSort},</if>
<if test="zdCode != null">#{zdCode},</if>
<if test="znName != null">#{znName},</if>
<if test="znEname != null">#{znEname},</if>
<if test="znNote != null">#{znNote},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneDivision" parameterType="XtdZoneDivision">
update xtd_zone_division
<set>
<if test="zsId != null">zs_id = #{zsId},</if>
<if test="zdSort != null">zd_sort = #{zdSort},</if>
<if test="zdCode != null">zd_code = #{zdCode},</if>
<if test="znName != null">zn_name = #{znName},</if>
<if test="znEname != null">zn_ename = #{znEname},</if>
<if test="znNote != null">zn_note = #{znNote},</if>
update_time = sysdate()
</set>
where zd_id = #{zdId}
</update>
<delete id="deleteXtdZoneDivisionByIds" parameterType="Long">
delete from xtd_zone_division where zd_id in
<foreach item="zdId" collection="array" open="(" separator="," close=")">
#{zdId}
</foreach>
</delete>
</mapper>
@@ -1,99 +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.ruoyi.price.mapper.XtdZoneSchemeMapper">
<resultMap type="XtdZoneScheme" id="XtdZoneSchemeResult">
<id property="zsId" column="zs_id" />
<result property="zsName" column="zs_name" />
<result property="ssCode" column="ss_code" />
<result property="pgCode" column="pg_code" />
<result property="snId" column="sn_id" />
<result property="zsNote" column="zs_note" />
<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="divisionCount" column="division_count" />
</resultMap>
<sql id="selectXtdZoneSchemeVo">
select zs_id, zs_name, ss_code, pg_code, sn_id, zs_note, tms_id,
created_by, create_time, updated_by, update_time
from xtd_zone_scheme
</sql>
<select id="selectXtdZoneSchemeById" parameterType="Long" resultMap="XtdZoneSchemeResult">
<include refid="selectXtdZoneSchemeVo"/>
where zs_id = #{zsId}
</select>
<select id="selectXtdZoneSchemeList" parameterType="XtdZoneScheme" resultMap="XtdZoneSchemeResult">
<include refid="selectXtdZoneSchemeVo"/>
<where>
<if test="zsName != null and zsName != ''">
AND zs_name like concat('%', #{zsName}, '%')
</if>
<if test="ssCode != null and ssCode != ''">
AND ss_code = #{ssCode}
</if>
<if test="pgCode != null and pgCode != ''">
AND pg_code = #{pgCode}
</if>
<if test="snId != null">
AND sn_id = #{snId}
</if>
<if test="tmsId != null">
AND tms_id = #{tmsId}
</if>
</where>
order by zs_id desc
</select>
<insert id="insertXtdZoneScheme" parameterType="XtdZoneScheme" useGeneratedKeys="true" keyProperty="zsId">
insert into xtd_zone_scheme (
<if test="zsName != null and zsName != ''">zs_name,</if>
<if test="ssCode != null and ssCode != ''">ss_code,</if>
<if test="pgCode != null">pg_code,</if>
<if test="snId != null">sn_id,</if>
<if test="zsNote != null">zs_note,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
create_time
) values (
<if test="zsName != null and zsName != ''">#{zsName},</if>
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
<if test="pgCode != null">#{pgCode},</if>
<if test="snId != null">#{snId},</if>
<if test="zsNote != null">#{zsNote},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateXtdZoneScheme" parameterType="XtdZoneScheme">
update xtd_zone_scheme
<set>
<if test="zsName != null and zsName != ''">zs_name = #{zsName},</if>
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
<if test="pgCode != null">pg_code = #{pgCode},</if>
<if test="snId != null">sn_id = #{snId},</if>
<if test="zsNote != null">zs_note = #{zsNote},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
update_time = sysdate()
</set>
where zs_id = #{zsId}
</update>
<delete id="deleteXtdZoneSchemeByIds" parameterType="Long">
delete from xtd_zone_scheme where zs_id in
<foreach item="zsId" collection="array" open="(" separator="," close=")">
#{zsId}
</foreach>
</delete>
</mapper>