新增 区划代码信息实体类、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,203 @@
package com.jsowell.pile.domain;
import java.math.BigDecimal;
import com.jsowell.common.annotation.Excel;
import com.jsowell.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 中国行政地区对象 area_code_info
*
* @author jsowell
* @date 2024-12-20
*/
public class AreaCodeInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Integer id;
/**
* 层级
*/
@Excel(name = "层级")
private Integer level;
/**
* 父级行政代码
*/
@Excel(name = "父级行政代码")
private Long parentCode;
/**
* 行政代码
*/
@Excel(name = "行政代码")
private Long areaCode;
/**
* 邮政编码
*/
@Excel(name = "邮政编码")
private Integer zipCode;
/**
* 区号
*/
@Excel(name = "区号")
private String cityCode;
/**
* 名称
*/
@Excel(name = "名称")
private String name;
/**
* 简称
*/
@Excel(name = "简称")
private String shortName;
/**
* 组合名
*/
@Excel(name = "组合名")
private String mergerName;
/**
* 拼音
*/
@Excel(name = "拼音")
private String pinyin;
/**
* 经度
*/
@Excel(name = "经度")
private BigDecimal lng;
/**
* 纬度
*/
@Excel(name = "纬度")
private BigDecimal lat;
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getLevel() {
return level;
}
public void setParentCode(Long parentCode) {
this.parentCode = parentCode;
}
public Long getParentCode() {
return parentCode;
}
public void setAreaCode(Long areaCode) {
this.areaCode = areaCode;
}
public Long getAreaCode() {
return areaCode;
}
public void setZipCode(Integer zipCode) {
this.zipCode = zipCode;
}
public Integer getZipCode() {
return zipCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getCityCode() {
return cityCode;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
public String getShortName() {
return shortName;
}
public void setMergerName(String mergerName) {
this.mergerName = mergerName;
}
public String getMergerName() {
return mergerName;
}
public void setPinyin(String pinyin) {
this.pinyin = pinyin;
}
public String getPinyin() {
return pinyin;
}
public void setLng(BigDecimal lng) {
this.lng = lng;
}
public BigDecimal getLng() {
return lng;
}
public void setLat(BigDecimal lat) {
this.lat = lat;
}
public BigDecimal getLat() {
return lat;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId())
.append("level", getLevel())
.append("parentCode", getParentCode())
.append("areaCode", getAreaCode())
.append("zipCode", getZipCode())
.append("cityCode", getCityCode())
.append("name", getName())
.append("shortName", getShortName())
.append("mergerName", getMergerName())
.append("pinyin", getPinyin())
.append("lng", getLng())
.append("lat", getLat())
.toString();
}
}

View File

@@ -0,0 +1,63 @@
package com.jsowell.pile.mapper;
import java.util.List;
import com.jsowell.pile.domain.AreaCodeInfo;
import org.springframework.stereotype.Repository;
/**
* 中国行政地区Mapper接口
*
* @author jsowell
* @date 2024-12-20
*/
@Repository
public interface AreaCodeInfoMapper {
/**
* 查询中国行政地区
*
* @param id 中国行政地区主键
* @return 中国行政地区
*/
public AreaCodeInfo selectAreaCodeInfoById(Integer id);
/**
* 查询中国行政地区列表
*
* @param areaCodeInfo 中国行政地区
* @return 中国行政地区集合
*/
public List<AreaCodeInfo> selectAreaCodeInfoList(AreaCodeInfo areaCodeInfo);
/**
* 新增中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
public int insertAreaCodeInfo(AreaCodeInfo areaCodeInfo);
/**
* 修改中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
public int updateAreaCodeInfo(AreaCodeInfo areaCodeInfo);
/**
* 删除中国行政地区
*
* @param id 中国行政地区主键
* @return 结果
*/
public int deleteAreaCodeInfoById(Integer id);
/**
* 批量删除中国行政地区
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAreaCodeInfoByIds(Integer[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.jsowell.pile.service;
import java.util.List;
import com.jsowell.pile.domain.AreaCodeInfo;
/**
* 中国行政地区Service接口
*
* @author jsowell
* @date 2024-12-20
*/
public interface IAreaCodeInfoService {
/**
* 查询中国行政地区
*
* @param id 中国行政地区主键
* @return 中国行政地区
*/
public AreaCodeInfo selectAreaCodeInfoById(Integer id);
/**
* 查询中国行政地区列表
*
* @param areaCodeInfo 中国行政地区
* @return 中国行政地区集合
*/
public List<AreaCodeInfo> selectAreaCodeInfoList(AreaCodeInfo areaCodeInfo);
/**
* 新增中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
public int insertAreaCodeInfo(AreaCodeInfo areaCodeInfo);
/**
* 修改中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
public int updateAreaCodeInfo(AreaCodeInfo areaCodeInfo);
/**
* 批量删除中国行政地区
*
* @param ids 需要删除的中国行政地区主键集合
* @return 结果
*/
public int deleteAreaCodeInfoByIds(Integer[] ids);
/**
* 删除中国行政地区信息
*
* @param id 中国行政地区主键
* @return 结果
*/
public int deleteAreaCodeInfoById(Integer id);
}

View File

@@ -0,0 +1,87 @@
package com.jsowell.pile.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jsowell.pile.mapper.AreaCodeInfoMapper;
import com.jsowell.pile.domain.AreaCodeInfo;
import com.jsowell.pile.service.IAreaCodeInfoService;
/**
* 中国行政地区Service业务层处理
*
* @author jsowell
* @date 2024-12-20
*/
@Service
public class AreaCodeInfoServiceImpl implements IAreaCodeInfoService {
@Autowired
private AreaCodeInfoMapper areaCodeInfoMapper;
/**
* 查询中国行政地区
*
* @param id 中国行政地区主键
* @return 中国行政地区
*/
@Override
public AreaCodeInfo selectAreaCodeInfoById(Integer id) {
return areaCodeInfoMapper.selectAreaCodeInfoById(id);
}
/**
* 查询中国行政地区列表
*
* @param areaCodeInfo 中国行政地区
* @return 中国行政地区
*/
@Override
public List<AreaCodeInfo> selectAreaCodeInfoList(AreaCodeInfo areaCodeInfo) {
return areaCodeInfoMapper.selectAreaCodeInfoList(areaCodeInfo);
}
/**
* 新增中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
@Override
public int insertAreaCodeInfo(AreaCodeInfo areaCodeInfo) {
return areaCodeInfoMapper.insertAreaCodeInfo(areaCodeInfo);
}
/**
* 修改中国行政地区
*
* @param areaCodeInfo 中国行政地区
* @return 结果
*/
@Override
public int updateAreaCodeInfo(AreaCodeInfo areaCodeInfo) {
return areaCodeInfoMapper.updateAreaCodeInfo(areaCodeInfo);
}
/**
* 批量删除中国行政地区
*
* @param ids 需要删除的中国行政地区主键
* @return 结果
*/
@Override
public int deleteAreaCodeInfoByIds(Integer[] ids) {
return areaCodeInfoMapper.deleteAreaCodeInfoByIds(ids);
}
/**
* 删除中国行政地区信息
*
* @param id 中国行政地区主键
* @return 结果
*/
@Override
public int deleteAreaCodeInfoById(Integer id) {
return areaCodeInfoMapper.deleteAreaCodeInfoById(id);
}
}

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>