Browse Source

优化销售区域填报

dev
xiaoyu 1 month ago
parent
commit
6afd2cbab2
  1. 46
      ruoyi-system/src/main/resources/mapper/system/Iso3166CountryMapper.xml
  2. 18
      sql/gss/iso3166国家.sql

46
ruoyi-system/src/main/resources/mapper/system/Iso3166CountryMapper.xml

@ -5,37 +5,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -5,37 +5,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.system.mapper.Iso3166CountryMapper">
<resultMap type="Iso3166Country" id="Iso3166CountryResult">
<result property="id" column="id" />
<result property="alpha2" column="alpha_2" />
<result property="alpha3" column="alpha_3" />
<result property="numeric" column="numeric" />
<result property="nameZh" column="name_zh" />
<result property="nameEn" column="name_en" />
<result property="region" column="region" />
<result property="subRegion" column="sub_region" />
<result property="isIndependent" column="is_independent" />
<result property="isEnabled" column="is_enabled" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="id" column="id" />
<result property="alpha2" column="alpha_2" />
<result property="alpha3" column="alpha_3" />
<result property="numeric" column="`numeric`" />
<result property="nameZh" column="name_zh" />
<result property="nameEn" column="name_en" />
<result property="region" column="region" />
<result property="subRegion" column="sub_region" />
<result property="isIndependent" column="is_independent" />
<result property="isEnabled" column="is_enabled" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectIso3166CountryVo">
select id, alpha_2, alpha_3, numeric, name_zh, name_en, region, sub_region, is_independent, is_enabled, create_time, update_time
select id, alpha_2, alpha_3, `numeric`, name_zh, name_en, region, sub_region, is_independent, is_enabled, create_time, update_time
from iso3166_country
</sql>
<select id="selectIso3166CountryList" parameterType="Iso3166Country" resultMap="Iso3166CountryResult">
<include refid="selectIso3166CountryVo"/>
<where>
<if test="alpha2 != null and alpha2 != ''"> and alpha_2 = #{alpha2}</if>
<if test="alpha3 != null and alpha3 != ''"> and alpha_3 = #{alpha3}</if>
<if test="numeric != null and numeric != ''"> and numeric = #{numeric}</if>
<if test="nameZh != null and nameZh != ''"> and name_zh like concat('%', #{nameZh}, '%')</if>
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
<if test="region != null and region != ''"> and region = #{region}</if>
<if test="subRegion != null and subRegion != ''"> and sub_region = #{subRegion}</if>
<if test="isIndependent != null "> and is_independent = #{isIndependent}</if>
<if test="isEnabled != null "> and is_enabled = #{isEnabled}</if>
<where>
<if test="alpha2 != null and alpha2 != ''"> and alpha_2 = #{alpha2}</if>
<if test="alpha3 != null and alpha3 != ''"> and alpha_3 = #{alpha3}</if>
<if test="numeric != null and numeric != ''"> and `numeric` = #{numeric}</if>
<if test="nameZh != null and nameZh != ''"> and name_zh like concat('%', #{nameZh}, '%')</if>
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
<if test="region != null and region != ''"> and region = #{region}</if>
<if test="subRegion != null and subRegion != ''"> and sub_region = #{subRegion}</if>
<if test="isIndependent != null"> and is_independent = #{isIndependent}</if>
<if test="isEnabled != null"> and is_enabled = #{isEnabled}</if>
</where>
order by id asc
</select>

18
sql/gss/iso3166国家.sql

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
CREATE TABLE `iso3166_country` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`alpha_2` char(2) NOT NULL COMMENT 'ISO 3166-1 二位字母代码',
`alpha_3` char(3) NOT NULL COMMENT 'ISO 3166-1 三位字母代码',
`numeric` char(3) NOT NULL COMMENT 'ISO 3166-1 三位数字代码',
`name_zh` varchar(100) NOT NULL COMMENT '中文名称',
`name_en` varchar(100) NOT NULL COMMENT '英文名称',
`region` varchar(50) DEFAULT NULL COMMENT '地理区域',
`sub_region` varchar(50) DEFAULT NULL COMMENT '子区域',
`is_independent` tinyint(1) DEFAULT '1' COMMENT '是否独立国家:1-是,0-否',
`is_enabled` tinyint(1) DEFAULT '1' COMMENT '是否启用:1-启用,0-禁用',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_alpha_2` (`alpha_2`),
UNIQUE KEY `uk_alpha_3` (`alpha_3`),
UNIQUE KEY `uk_numeric` (`numeric`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='国家信息表 (ISO 3166-1)';
Loading…
Cancel
Save