新增 区划代码信息实体类、Service

This commit is contained in:
Lemon
2024-12-20 15:50:57 +08:00
parent bd59654994
commit 87eb7a3977
7 changed files with 566 additions and 25 deletions

View File

@@ -0,0 +1,106 @@
<?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.jsowell.pile.mapper.AreaCodeInfoMapper">
<resultMap type="com.jsowell.pile.domain.AreaCodeInfo" id="AreaCodeInfoResult">
<result property="id" column="id" />
<result property="level" column="level" />
<result property="parentCode" column="parent_code" />
<result property="areaCode" column="area_code" />
<result property="zipCode" column="zip_code" />
<result property="cityCode" column="city_code" />
<result property="name" column="name" />
<result property="shortName" column="short_name" />
<result property="mergerName" column="merger_name" />
<result property="pinyin" column="pinyin" />
<result property="lng" column="lng" />
<result property="lat" column="lat" />
</resultMap>
<sql id="selectAreaCodeInfoVo">
select id, level, parent_code, area_code, zip_code, city_code, name, short_name, merger_name, pinyin, lng, lat from area_code_info
</sql>
<select id="selectAreaCodeInfoList" parameterType="com.jsowell.pile.domain.AreaCodeInfo" resultMap="AreaCodeInfoResult">
<include refid="selectAreaCodeInfoVo"/>
<where>
<if test="level != null "> and level = #{level}</if>
<if test="parentCode != null "> and parent_code = #{parentCode}</if>
<if test="areaCode != null "> and area_code = #{areaCode}</if>
<if test="zipCode != null "> and zip_code = #{zipCode}</if>
<if test="cityCode != null and cityCode != ''"> and city_code = #{cityCode}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="shortName != null and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
<if test="mergerName != null and mergerName != ''"> and merger_name like concat('%', #{mergerName}, '%')</if>
<if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
<if test="lng != null "> and lng = #{lng}</if>
<if test="lat != null "> and lat = #{lat}</if>
</where>
</select>
<select id="selectAreaCodeInfoById" parameterType="Integer" resultMap="AreaCodeInfoResult">
<include refid="selectAreaCodeInfoVo"/>
where id = #{id}
</select>
<insert id="insertAreaCodeInfo" parameterType="com.jsowell.pile.domain.AreaCodeInfo" useGeneratedKeys="true" keyProperty="id">
insert into area_code_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="level != null">level,</if>
<if test="parentCode != null">parent_code,</if>
<if test="areaCode != null">area_code,</if>
<if test="zipCode != null">zip_code,</if>
<if test="cityCode != null and cityCode != ''">city_code,</if>
<if test="name != null and name != ''">name,</if>
<if test="shortName != null and shortName != ''">short_name,</if>
<if test="mergerName != null and mergerName != ''">merger_name,</if>
<if test="pinyin != null and pinyin != ''">pinyin,</if>
<if test="lng != null">lng,</if>
<if test="lat != null">lat,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="level != null">#{level},</if>
<if test="parentCode != null">#{parentCode},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="zipCode != null">#{zipCode},</if>
<if test="cityCode != null and cityCode != ''">#{cityCode},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="shortName != null and shortName != ''">#{shortName},</if>
<if test="mergerName != null and mergerName != ''">#{mergerName},</if>
<if test="pinyin != null and pinyin != ''">#{pinyin},</if>
<if test="lng != null">#{lng},</if>
<if test="lat != null">#{lat},</if>
</trim>
</insert>
<update id="updateAreaCodeInfo" parameterType="com.jsowell.pile.domain.AreaCodeInfo">
update area_code_info
<trim prefix="SET" suffixOverrides=",">
<if test="level != null">level = #{level},</if>
<if test="parentCode != null">parent_code = #{parentCode},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="zipCode != null">zip_code = #{zipCode},</if>
<if test="cityCode != null and cityCode != ''">city_code = #{cityCode},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
<if test="mergerName != null and mergerName != ''">merger_name = #{mergerName},</if>
<if test="pinyin != null and pinyin != ''">pinyin = #{pinyin},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="lat != null">lat = #{lat},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAreaCodeInfoById" parameterType="Integer">
delete from area_code_info where id = #{id}
</delete>
<delete id="deleteAreaCodeInfoByIds" parameterType="String">
delete from area_code_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>