2021年全国省市区街道代码自动同步(包含解决方案)

Posted 程序工厂

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2021年全国省市区街道代码自动同步(包含解决方案)相关的知识,希望对你有一定的参考价值。

本教程提供了二种解决方案,都提供同步文件下载,数据更新自20210525号数据

 

方案一

来源

国家统计局官网

http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/

数据下载

CSDN

关注微信公众号:程序工厂

回复:国家统计局省市区 获取下载链接

方式

从国家统计局网站爬取数据

缺点

数据更新慢,一年更新一次

参考代码

package org.jeecg.modules.ls;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;


/**
 * 从国家统计局网站爬取省级到村级别的行政区划代码
 */
public class Area {
    public static final String baseUrl = "http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/";
    //设置utf-8发现有部分字符有乱码
    public static final String CHARSET = "GBK";

    public static StringBuffer result = new StringBuffer();


    /**
     * 读省的信息
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        String url = baseUrl + "index.html";
        //如果需要设置代理
        //initProxy("10.10.13.200", "80");
        String str = getContent(url).toUpperCase();
        String[] arrs = str.split("<A");

        for (String s : arrs) {
            if (s.indexOf("HREF") != -1 && s.indexOf(".HTML") != -1) {
                String a = s.substring(7, s.indexOf("'>"));
                String name = s.substring(s.indexOf("'>")+2, s.indexOf("<BR/>"));
                System.out.println(name);
                if(!"浙江省".equals(name)){
                    continue;
                }

                System.out.println("爬取:"+name);
                boolean success = false;
                while(!success) {
                    try {
                        readShi(a,name);
                        success = true;
                    } catch (IOException e) {
                        e.printStackTrace();
                        success = false;
                        Thread.sleep(60000);
                    }
                }

            }
        }
    }

    /**
     * 读市的数据
     * @param -list
     * @throws Exception
     */
    public static void readShi(String url,String paretid) throws Exception{
        String content = getContent(baseUrl+url).toUpperCase();
        String[] citys = content.split("CITYTR");
        //'><TD><A HREF='11/1101.HTML'>110100000000</A></TD><TD><A HREF='11/1101.HTML'>市辖区</A></TD></td><TR CLASS='
        for(int c=1,len=citys.length; c<len; c++){
            String[] strs = citys[c].split("<A HREF='");
            String cityUrl = null;
            String areaid = "";
            String areaname = "";
            for(int si = 1; si < 3; si++){
                if(si==1){//取链接和编码
                    cityUrl = strs[si].substring(0, strs[si].indexOf("'>"));
                    areaid = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));
                }else{
                    areaname = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));
                    System.out.println("爬取:"+strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>")));
                }
            }
            saveCity(areaid, areaname, paretid, 2);
            boolean success = false;
            while(!success) {
                try {
                    readXian(cityUrl.substring(0, cityUrl.indexOf("/")+1),cityUrl,areaid);
                    success = true;
                } catch (IOException e) {
                    e.printStackTrace();
                    success = false;
                    Thread.sleep(60000);
                }
            }
        }
    }

    /**
     * 读县的数据
     * @param url
     * @throws Exception
     */
    public static void readXian(String prix,String url,String paretid) throws Exception{
        String content = getContent(baseUrl+url).toUpperCase();
        String[] citys = content.split("COUNTYTR");
        for(int i=1; i<citys.length; i++){
            String cityUrl = null;
            String areaid = "";
            String areaname = "";
            //发现石家庄有一个县居然没超链接,特殊处理
            if(citys[i].indexOf("<A HREF='")==-1){
                areaid = citys[i].substring(6, 18);
                areaname = citys[i].substring(citys[i].indexOf("</TD><TD>")+9,citys[i].lastIndexOf("</TD>"));
            }else{
                String[] strs = citys[i].split("<A HREF='");
                for(int si = 1; si<3; si++){
                    if(si==1){//取链接和编码
                        cityUrl = strs[si].substring(0, strs[si].indexOf("'>"));
                        areaid = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));
                    }else{
                        areaname = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));
                    }
                }
            }
            saveCity(areaid, areaname, paretid, 3);
            boolean success = false;
            while(!success) {
                try {
                    if(null!=cityUrl){
                        readZhen(prix,cityUrl,areaid);
                    }
                    success = true;
                } catch (IOException e) {
                    e.printStackTrace();
                    success = false;
                    Thread.sleep(60000);
                }
            }
        }
    }

    /**
     * 读镇的数据
     * @param url
     * @throws Exception
     */
    public static void readZhen(String prix,String url,String paretid) throws Exception{
        String content = getContent(baseUrl+prix+url).toUpperCase();
        String myPrix = (prix+url).substring(0, (prix+url).lastIndexOf("/")+1);
        String[] citys = content.split("TOWNTR");
        for(int i=1; i<citys.length; i++){
            String[] strs = citys[i].split("<A HREF='");
            String cityUrl = null;
            String areaid = "";
            String areaname = "";
            for(int si = 1; si<3; si++){
                if(si==1){//取链接和编码
                    cityUrl = strs[si].substring(0, strs[si].indexOf("'>"));
                    areaid = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));

                }else{
                    areaname = strs[si].substring(strs[si].indexOf("'>")+2, strs[si].indexOf("</A>"));
                }
            }
            saveCity(areaid, areaname, paretid, 4);
        }
    }

    /**
     * 读村/街道的数据
     * @param url
     * @throws Exception
     */
    public static void readCun(String prix,String url,BufferedWriter bw) throws Exception{
        String content = getContent(baseUrl+prix+url).toUpperCase();
        String[] citys = content.split("VILLAGETR");
        for(int i=1; i<citys.length; i++){
            String[] strs = citys[i].split("<TD>");

            bw.write("<tr><td>");
            bw.write(strs[1].substring(0, strs[1].indexOf("</TD>")));
            bw.write("</td>");

            bw.write("<td></td><td></td><td></td><td></td>");
            bw.write("<td>");
            bw.write(strs[2].substring(0, strs[2].indexOf("</TD>")));
            bw.write("</td><td>");
            bw.write(strs[3].substring(0, strs[3].indexOf("</TD>")));
            bw.write("</td></tr>");
        }
    }


    //设置代理
    public static void initProxy(String host, String port) {
        System.setProperty("http.proxyType", "4");
        System.setProperty("http.proxyPort", port);
        System.setProperty("http.proxyHost", host);
        System.setProperty("http.proxySet", "true");
    }


    //获取网页的内容
    public static String getContent(String strUrl) throws Exception {
        try {
            URL url = new URL(strUrl);
            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream(),Charset.forName(CHARSET)));
            String s = "";
            StringBuffer sb = new StringBuffer("");
            while ((s = br.readLine()) != null) {
                sb.append(s);
            }
            br.close();
            return sb.toString();
        } catch (Exception e) {
            System.out.println("can't open url:"+strUrl);
            throw e;
        }
    }


    public static void saveCity(String areaid, String areaname, String paretid, int level) {
        try {
            String URL="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC";
            String USER="root";
            String PASSWORD="123456";
            //1.加载驱动程序
            Class.forName("com.mysql.jdbc.Driver");
            //2.获得数据库链接
            Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
            //3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
            String s = "insert into area(areacode,areaname,p_areacode, level) values(?,?,?,?)";
            PreparedStatement pst = conn.prepareStatement(s);

            pst.setString(1, areaid.substring(0,9));
            pst.setString(2, areaname);
            pst.setString(3, paretid);
            pst.setInt(4, level);

            pst.execute();
            //关闭资源
            pst.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

方案二

来源

高德地图

https://lbs.amap.com/api/webservice/guide/api/district

数据下载

CSDN

关注微信公众号:程序工厂

回复:高德地图省市区 获取下载链接

方式

通过高德地图接口获取数据

参考代码
 

代码省市区街道数据更新一次大约二分钟左右

我代码写在动态定时任务里,然后创建一个每月执行一次的定时任务,每一个月和高德地图同步一次数据,维持数据准确率

动态定时任务可以看我另外一篇博客

https://blog.csdn.net/tangcv/article/details/109206837


import cn.hutool.core.convert.Convert;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.job.ThreadPoolUtil;
import org.jeecg.modules.job.entity.District;
import org.jeecg.modules.job.entity.DistrictGD;
import org.jeecg.modules.ls.Util.BadRequestException;
import org.jeecg.modules.masterData.entity.ZsjDictionaryDetail;
import org.jeecg.modules.masterData.service.IZsjDictionaryDetailService;
import org.jeecg.modules.masterData.service.IZsjPublicDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 高德地图 省市区街道数据数据更新
 * @author 唐正锋
 * @Date 2021/05/25 14:38
 */
@Slf4j
@Component
public class RegionTask {

    @Autowired
    private IZsjDictionaryDetailService zsjDictionaryDetailService;

    @Autowired
    private IZsjPublicDictionaryService zsjPublicDictionaryService;

    //采集地址接口 key地址需要在高德地图申请,申请地址 https://console.amap.com/dev/key/app
    public static final String url = "https://restapi.amap.com/v3/config/district?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&subdistrict=4";

    public static final String SZZQZXSTQ = "H10331";//省自治区直辖市特区
    public static final String DQZ = "H12890";//地区州
    public static final String XSQ = "H11279";//县市区
    public static final String XZJDBSC = "H12892";//乡镇街道办事处
    public void run() {
        try {
            long start = System.currentTimeMillis();

            String result= HttpUtil.get(url);
            long end = System.currentTimeMillis();
            log.info("-------请求文件用时---{}ms-------",(start - end));
            DistrictGD districtGD = new DistrictGD();
            districtGD = Convert.toList(DistrictGD.class,JSONObject.parseObject(result)).get(0);
            if(!"OK".equals(districtGD.getInfo())){
                throw new BadRequestException("查询出错");
            }
            //第一层国家 第二层 省
            List<District> districts = districtGD.getDistricts().get(0).getDistricts();
            Integer maxNumber = zsjDictionaryDetailService.getMaxNumber(SZZQZXSTQ);
            maxNumber = maxNumber == null || "".equals(maxNumber) ? 1 : maxNumber + 1;
            String publicDictionaryId = zsjPublicDictionaryService.getIdOnCategoryCoding(SZZQZXSTQ);
            ZsjDictionaryDetail zsjDictionaryDetail = new ZsjDictionaryDetail();
            for (District district: districts ) {
                List<ZsjDictionaryDetail> zsjDictionaryDetails = zsjDictionaryDetailService.getDictionaryDetailList(district.getAdcode(),SZZQZXSTQ);
                zsjDictionaryDetail = new ZsjDictionaryDetail();
                if(zsjDictionaryDetails.size() == 0 ){//新增
                    zsjDictionaryDetail = new ZsjDictionaryDetail(publicDictionaryId,district.getAdcode(),district.getName(),district.getCenter(),maxNumber,district.getLevel());
                    zsjDictionaryDetailService.saveTo(zsjDictionaryDetail);
                    maxNumber += 1;
                }else if(zsjDictionaryDetails.size() != 0 ){//编辑
                    zsjDictionaryDetail = zsjDictionaryDetails.get(0);
                    ZsjDictionaryDetail update = new ZsjDictionaryDetail(publicDictionaryId,district.getAdcode(),district.getName(),district.getCenter(),district.getLevel());
                    zsjDictionaryDetail.copy(update);
                    zsjDictionaryDetailService.updateById(zsjDictionaryDetail);
                }
                //市
                addressCity(district.getDistricts(),DQZ,zsjDictionaryDetail.getId(),zsjDictionaryDetail.getNationalStandardValues());
            }
        }catch (Exception e){
            log.info("----------同步失败-----{}------",e.getMessage());
        }
    }
    //市
    private void addressCity(List<District> districts,String dictCode,String pidA,String codeA) {
        Integer maxNumber = zsjDictionaryDetailService.getMaxNumber(dictCode);
        maxNumber = maxNumber == null || "".equals(maxNumber) ? 1 : maxNumber + 1;
        String publicDictionaryId = zsjPublicDictionaryService.getIdOnCategoryCoding(dictCode);
        for (District district: districts ) {
            List<ZsjDictionaryDetail> zsjDictionaryDetails = zsjDictionaryDetailService.getDictionaryDetailList(district.getAdcode(),dictCode);
            ZsjDictionaryDetail zsjDictionaryDetail = new ZsjDictionaryDetail();
            if(zsjDictionaryDetails.size() == 0 ){//新增
                zsjDictionaryDetail = new ZsjDictionaryDetail(publicDictionaryId,pidA,district.getAdcode(),district.getName(),district.getCenter(),maxNumber,district.getLevel(),
                        pidA,null,null,null,codeA,null,null,null);
                zsjDictionaryDetailService.saveTo(zsjDictionaryDetail);
                maxNumber += 1;
            }else if(zsjDictionaryDetails.size() != 0 ){//编辑
                zsjDictionaryDetail = zsjDictionaryDetails.get(0);
                ZsjDictionaryDetail update = new ZsjDictionaryDetail(publicDictionaryId,pidA,district.getAdcode(),district.getName(),district.getCenter(),district.getLevel(),
                        pidA,null,null,null,codeA,null,null,null);
                zsjDictionaryDetail.copy(update);
                zsjDictionaryDetailService.updateById(zsjDictionaryDetail);
            }
            final String id = zsjDictionaryDetail.getId();
            final String code = zsjDictionaryDetail.getNationalStandardValues();
            //hutool 多线程执行,
            ThreadUtil.concurrencyTest(200, () -> {
                addressArea(district.getDistricts(),XSQ,pidA,codeA,id,code);
            });
            //也可以替换成单线程执行
            // addressArea(district.getDistricts(),XSQ,pidA,codeA,id,code);
        }
    }
    //区
    public void addressArea(List<District> districts,String dictCode,String pidA,String codeA,String pidB,String codeB) {
        Integer maxNumber = zsjDictionaryDetailService.getMaxNumber(dictCode);
        maxNumber = maxNumber == null || "".equals(maxNumber) ? 1 : maxNumber + 1;
        String publicDictionaryId = zsjPublicDictionaryService.getIdOnCategoryCoding(dictCode);
        for (District district: districts ) {
            List<ZsjDictionaryDetail> zsjDictionaryDetails = zsjDictionaryDetailService.getDictionaryDetailList(district.getAdcode(),dictCode);
            ZsjDictionaryDetail zsjDictionaryDetail = new ZsjDictionaryDetail();
            if(zsjDictionaryDetails.size() == 0 ){//新增
                zsjDictionaryDetail = new ZsjDictionaryDetail(publicDictionaryId,pidB,district.getAdcode(),district.getName(),district.getCenter(),maxNumber,district.getLevel(),
                        pidA,pidB,null,null,codeA,codeB,null,null);
                zsjDictionaryDetailService.saveTo(zsjDictionaryDetail);
                maxNumber += 1;
            }else if(zsjDictionaryDetails.size() != 0 ){//编辑
                zsjDictionaryDetail = zsjDictionaryDetails.get(0);
                ZsjDictionaryDetail update = new ZsjDictionaryDetail(publicDictionaryId,pidB,district.getAdcode(),district.getName(),district.getCenter(),district.getLevel(),
                        pidA,pidB,null,null,codeA,codeB,null,null);
                zsjDictionaryDetail.copy(update);
                zsjDictionaryDetailService.updateById(zsjDictionaryDetail);
            }
            final String id = zsjDictionaryDetail.getId();
            final String code = zsjDictionaryDetail.getNationalStandardValues();
            addressStreet(district.getDistricts(),XZJDBSC,pidA,codeA,pidB,codeB,id,code);
        }
    }
    //街道
    public void addressStreet(List<District> districts,String dictCode,String pidA,String codeA,String pidB,String codeB,String pidC,String codeC) {
        Integer maxNumber = zsjDictionaryDetailService.getMaxNumberPid(pidC);
        maxNumber = maxNumber == null || "".equals(maxNumber) ? 1 : maxNumber + 1;
        String publicDictionaryId = zsjPublicDictionaryService.getIdOnCategoryCoding(dictCode);
        for (District district: districts ) {
            //名称和pid查询是否存在
            List<ZsjDictionaryDetail> zsjDictionaryDetails = zsjDictionaryDetailService.getDictionaryPidList(district.getName(),pidC);
            ZsjDictionaryDetail zsjDictionaryDetail = new ZsjDictionaryDetail();
            String code = maxNumber + "";
            code = code.length() == 1 ? codeC + "000" + code :
                   code.length() == 2 ? codeC + "00" + code :
                   code.length() == 3 ? codeC + "0" + code : codeC + code;
            if(zsjDictionaryDetails.size() == 0 ){//新增
                zsjDictionaryDetail = new ZsjDictionaryDetail(publicDictionaryId,pidC,code,district.getName(),district.getCenter(),maxNumber,district.getLevel(),
                        pidA,pidB,pidC,null,codeA,codeB,codeC,null);
                zsjDictionaryDetailService.saveTo(zsjDictionaryDetail);
                maxNumber += 1;
            }else if(zsjDictionaryDetails.size() != 0 ){//编辑
                zsjDictionaryDetail = zsjDictionaryDetails.get(0);
                ZsjDictionaryDetail update = new ZsjDictionaryDetail(publicDictionaryId,pidC,code,district.getName(),district.getCenter(),district.getLevel(),
                        pidA,pidB,pidC,null,codeA,codeB,codeC,null);
                zsjDictionaryDetail.copy(update);
                zsjDictionaryDetailService.updateById(zsjDictionaryDetail);
            }
        }
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        //key地址需要在高德地图申请,申请地址 https://console.amap.com/dev/key/app
        String result = HttpUtil.get("https://restapi.amap.com/v3/config/district?key=XXXXXXXXXXXXXXXXX&subdistrict=4");
        long end = System.currentTimeMillis();
        log.info("-------返回内容---{}-------",result);
        log.info("-------请求文件用时---{}ms-------",(start - end));
        DistrictGD districtGD = new DistrictGD();
        districtGD = Convert.toList(DistrictGD.class,JSONObject.parseObject(result)).get(0);
        log.info("-------状态---{}-------",districtGD.getInfo());
    }
}

高德地图返回参数格式,我转化成自己写的类方便我读取处理

DistrictGD
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class DistrictGD {

    @ApiModelProperty(value = "状态值 值为0或1,0表示失败;1表示成功")
    private String status;

    @ApiModelProperty(value = "状态说明 status为0时,info返回错误原因,否则返回“OK” ")
    private String info;

    @ApiModelProperty(value = "状态码  返回状态说明,10000代表正确,详情参阅info状态表 ")
    private String infocode;

    @ApiModelProperty(value = "count")
    private String count;

    @ApiModelProperty(value = "建议结果列表")
    private Object suggestion;

    @ApiModelProperty(value = "行政区列表")
    private List<District> districts = new ArrayList<>();

}
District


import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;

/**
 * 行政区列表
 */
@Data
public class District {

    @ApiModelProperty(value = "城市编码")
    private String citycode;

    @ApiModelProperty(value = "区域编码 街道没有独有的adcode,均继承父类(区县)的adcode ")
    private String adcode;

    @ApiModelProperty(value = "行政区名称")
    private String name;

    @ApiModelProperty(value = "行政区边界坐标点 \\n" +
            "当一个行政区范围,由完全分隔两块或者多块的地块组成,每块地的 polyline 坐标串以 | 分隔 。如北京 的 朝阳区")
    private String polyline;

    @ApiModelProperty(value = "区域中心点")
    private String center;

    @ApiModelProperty(value = "行政区划级别 \\n" +
            "country:国家 \\n" +
            "province:省份(直辖市会在province和city显示)\\n" +
            "city:市(直辖市会在province和city显示)\\n" +
            "district:区县\\n" +
            "street:街道")
    private String level;

    @ApiModelProperty(value = "下级行政区列表,包含district元素")
    private ArrayList<District> districts = new ArrayList<>();


}

校验查询,不用的可以省略

实体类 ZsjDictionaryDetail、ZsjPublicDictionary

package org.jeecg.modules.masterData.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @Description: 公共字典明细
 * @Author: 唐正锋
 * @Date:   2021-05-07
 * @Version: V1.0
 */
@Data
@TableName("zsj_dictionary_detail")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="zsj_dictionary_detail对象", description="公共字典明细")
public class ZsjDictionaryDetail implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
	/**公共字典维护表id*/
	@Excel(name = "公共字典维护表id", width = 15)
    @ApiModelProperty(value = "公共字典维护表id")
    private String publicDictionaryId;
    /**上级id*/
    @ApiModelProperty(value = "上级id【新增编辑 前段不用传递】")
    private String pid;
	/**国标值*/
	@Excel(name = "国标值", width = 15)
    @ApiModelProperty(value = "国标值")
    private String nationalStandardValues;
	/**国标值含义*/
	@Excel(name = "国标值含义", width = 15)
    @ApiModelProperty(value = "国标值含义")
    private String nationalStandardMeaning;
	/**拼音码*/
	@Excel(name = "拼音码", width = 15)
    @ApiModelProperty(value = "拼音码")
    private String pinyinCode;
	/**五笔码*/
	@Excel(name = "五笔码", width = 15)
    @ApiModelProperty(value = "五笔码")
    private String wubiCode;
	/**数据元标识符*/
	@Excel(name = "数据元标识符", width = 15)
    @ApiModelProperty(value = "数据元标识符")
    private String dataElementIdentifier;
	/**排列序号*/
	@Excel(name = "排列序号", width = 15)
    @ApiModelProperty(value = "排列序号")
    private Integer arrangeSerialNumber;
	/**备注*/
	@Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String remark;
	/**状态*/
	@Excel(name = "状态", width = 15)
    @ApiModelProperty(value = "状态")
    private Integer status;

    /**动态Id*/
    @Excel(name = "动态Id1", width = 15)
    @ApiModelProperty(value = "动态Id1")
    private String dynamicIdA;

    /**动态参数*/
    @Excel(name = "动态参数1", width = 15)
    @ApiModelProperty(value = "动态参数1")
    private String dynamicValueA;

    @Excel(name = "动态Id2", width = 15)
    @ApiModelProperty(value = "动态Id2")
    private String dynamicIdB;

    @Excel(name = "动态参数2", width = 15)
    @ApiModelProperty(value = "动态参数2")
    private String dynamicValueB;

    @Excel(name = "动态Id3", width = 15)
    @ApiModelProperty(value = "动态Id3")
    private String dynamicIdC;

    @Excel(name = "动态参数3", width = 15)
    @ApiModelProperty(value = "动态参数3")
    private String dynamicValueC;

    @Excel(name = "动态Id4", width = 15)
    @ApiModelProperty(value = "动态Id4")
    private String dynamicIdD;

    @Excel(name = "动态参数4", width = 15)
    @ApiModelProperty(value = "动态参数4")
    private String dynamicValueD;

    @Excel(name = "动态Id5", width = 15)
    @ApiModelProperty(value = "动态Id5")
    private String dynamicIdE;

    @Excel(name = "动态参数5", width = 15)
    @ApiModelProperty(value = "动态参数5")
    private String dynamicValueE;

    @Excel(name = "动态Id6", width = 15)
    @ApiModelProperty(value = "动态Id6")
    private String dynamicIdF;

    @Excel(name = "动态参数6", width = 15)
    @ApiModelProperty(value = "动态Id6")
    private String dynamicValueF;


    public void copy(ZsjDictionaryDetailFind source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public void copy(DictDetailImport source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public void copy(ZsjDictionaryDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    /**
     * 新增
     * @param nationalStandardValues 国标值
     * @param nationalStandardMeaning 国标值含义
     * @param dataElementIdentifier 数据元标识符 存坐标
     * @param arrangeSerialNumber 排列序号
     * @param remark 备注
     */
    public ZsjDictionaryDetail(String publicDictionaryId,String nationalStandardValues,String nationalStandardMeaning,String dataElementIdentifier,
                                 Integer arrangeSerialNumber,String remark){
        this.publicDictionaryId = publicDictionaryId;
        this.nationalStandardValues = nationalStandardValues;
        this.nationalStandardMeaning = nationalStandardMeaning;
        this.dataElementIdentifier = dataElementIdentifier;
        this.arrangeSerialNumber = arrangeSerialNumber;
        this.remark = remark;
    }
    /**
     * 编辑
     * @param nationalStandardValues 国标值
     * @param nationalStandardMeaning 国标值含义
     * @param dataElementIdentifier 数据元标识符 存坐标
     * @param remark 备注
     */
    public ZsjDictionaryDetail(String publicDictionaryId,String nationalStandardValues,String nationalStandardMeaning,
                               String dataElementIdentifier,String remark){
        this.publicDictionaryId = publicDictionaryId;
        this.nationalStandardValues = nationalStandardValues;
        this.nationalStandardMeaning = nationalStandardMeaning;
        this.dataElementIdentifier = dataElementIdentifier;
        this.remark = remark;
    }
    /**
     * 新增
     * @param pid 上级id
     * @param nationalStandardValues 国标值
     * @param nationalStandardMeaning 国标值含义
     * @param dataElementIdentifier 数据元标识符 存坐标
     * @param arrangeSerialNumber 排列序号
     * @param remark 备注
     */
    public ZsjDictionaryDetail(String publicDictionaryId,String pid,String nationalStandardValues,String nationalStandardMeaning,String dataElementIdentifier,
                               Integer arrangeSerialNumber,String remark,String dynamicIdA,String dynamicIdB,String dynamicIdC,String dynamicIdD,
                               String dynamicValueA,String dynamicValueB,String dynamicValueC,String dynamicValueD){
        this.publicDictionaryId = publicDictionaryId;
        this.pid = pid;
        this.nationalStandardValues = nationalStandardValues;
        this.nationalStandardMeaning = nationalStandardMeaning;
        this.dataElementIdentifier = dataElementIdentifier;
        this.arrangeSerialNumber = arrangeSerialNumber;
        this.remark = remark;
        this.dynamicIdA = dynamicIdA;
        this.dynamicIdB = dynamicIdB;
        this.dynamicIdC = dynamicIdC;
        this.dynamicIdD = dynamicIdD;
        this.dynamicValueA = dynamicValueA;
        this.dynamicValueB = dynamicValueB;
        this.dynamicValueC = dynamicValueC;
        this.dynamicValueD = dynamicValueD;
    }
    /**
     * 编辑
     * @param pid 上级id
     * @param nationalStandardValues 国标值
     * @param nationalStandardMeaning 国标值含义
     * @param dataElementIdentifier 数据元标识符 存坐标
     * @param remark 备注
     */
    public ZsjDictionaryDetail(String publicDictionaryId,String pid,String nationalStandardValues,String nationalStandardMeaning,String dataElementIdentifier,
                               String remark,String dynamicIdA,String dynamicIdB,String dynamicIdC,String dynamicIdD,
                               String dynamicValueA,String dynamicValueB,String dynamicValueC,String dynamicValueD){
        this.publicDictionaryId = publicDictionaryId;
        this.pid = pid;
        this.nationalStandardValues = nationalStandardValues;
        this.nationalStandardMeaning = nationalStandardMeaning;
        this.dataElementIdentifier = dataElementIdentifier;
        this.remark = remark;
        this.dynamicIdA = dynamicIdA;
        this.dynamicIdB = dynamicIdB;
        this.dynamicIdC = dynamicIdC;
        this.dynamicIdD = dynamicIdD;
        this.dynamicValueA = dynamicValueA;
        this.dynamicValueB = dynamicValueB;
        this.dynamicValueC = dynamicValueC;
        this.dynamicValueD = dynamicValueD;
    }
    public ZsjDictionaryDetail(){
    }
}
package org.jeecg.modules.masterData.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.modules.ls.entity.LsWechatCustomer;
import org.jeecg.modules.masterData.entityTool.ZsjPublicDictionaryAdd;
import org.jeecg.modules.masterData.entityTool.ZsjPublicDictionaryUpdate;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @Description: 公共字典维护
 * @Author: 唐正锋
 * @Date:   2021-05-07
 * @Version: V1.0
 */
@Data
@TableName("zsj_public_dictionary")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="zsj_public_dictionary对象", description="公共字典维护")
public class ZsjPublicDictionary implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
	/**类别编码*/
	@Excel(name = "类别编码", width = 15)
    @ApiModelProperty(value = "类别编码")
    private String categoryCoding;
	/**类别含义*/
	@Excel(name = "类别含义", width = 15)
    @ApiModelProperty(value = "类别含义")
    private String categoryMeaning;
	/**拼音码*/
	@Excel(name = "拼音码", width = 15)
    @ApiModelProperty(value = "拼音码")
    private String pinyinCode;
	/**五笔码*/
	@Excel(name = "五笔码", width = 15)
    @ApiModelProperty(value = "五笔码")
    private String wubiCode;
	/**数据元标识符*/
	@Excel(name = "数据元标识符", width = 15)
    @ApiModelProperty(value = "数据元标识符")
    private String dataElementIdentifier;
	/**排列序号*/
	@Excel(name = "排列序号", width = 15)
    @ApiModelProperty(value = "排列序号")
    private Integer arrangeSerialNumber;
	/**备注*/
	@Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String remark;
	/**状态*/
	@Excel(name = "状态", width = 15)
    @ApiModelProperty(value = "状态")
    private Integer status;

    public void copy(ZsjPublicDictionaryAdd source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }

    public void copy(ZsjPublicDictionaryUpdate source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}

IZsjPublicDictionaryService

package org.jeecg.modules.masterData.service;

import org.jeecg.modules.masterData.entity.ZsjPublicDictionary;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.masterData.entityTool.ZsjPublicDictionaryAdd;
import org.jeecg.modules.masterData.entityTool.ZsjPublicDictionaryUpdate;

import java.util.List;

public interface IZsjPublicDictionaryService extends IService<ZsjPublicDictionary> {
    
    /**
     * 根据Code查询ID
     * @return
     */
    String getIdOnCategoryCoding(String code);

}

....省略Impl

ZsjPublicDictionaryMapper

 /**
     * 根据CODE查询Id
     * @param code
     * @return
     */
    @Select(" SELECT id  FROM zsj_public_dictionary WHERE status = 1 and category_coding = #{code}  ")
    String getIdOnCategoryCoding(String code);
IZsjDictionaryDetailService 有些多余的方法自己删除


import org.jeecg.modules.ls.Util.UtilsExcel.ErrorExcel;
import org.jeecg.modules.masterData.entity.ZsjDictionaryDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.masterData.entity.ZsjPublicDictionary;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description: 公共字典明细
 * @Author: 唐正锋
 * @Date:   2021-05-07
 * @Version: V1.0
 */
public interface IZsjDictionaryDetailService extends IService<ZsjDictionaryDetail> {

    void saveTo(ZsjDictionaryDetail zsjDictionaryDetail);

    void updateTo(ZsjDictionaryDetail zsjDictionaryDetail);

    /**
     * 查询最大排序值
     * @param categoryCoding
     * @return
     */
    Integer getMaxNumber(String categoryCoding);

    Integer getMaxNumberPid(String pid);

    /**
     * 查询是否存在
     * @param nationalStandardValues 字典明细编码
     * @param categoryCoding 字典编码
     * @return
     */
    List<ZsjDictionaryDetail> getDictionaryDetailList(String nationalStandardValues,String categoryCoding);

    /**
     * 查询是否存在
     * @param meaning 字典明细含义
     * @param pid 上级编码
     * @return
     */
    List<ZsjDictionaryDetail> getDictionaryPidList(String meaning,String pid);

    /**
     * 查询是否存在
     * @param nationalStandardValues 字典明细编码
     * @param publicDictionaryId 公共字典维护表id
     * @return
     */
    List<ZsjDictionaryDetail> getDictionaryDetailIdList(String nationalStandardValues,String publicDictionaryId);


}
ZsjDictionaryDetailServiceImpl


import cn.hutool.core.convert.Convert;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.ls.Util.BadRequestException;
import org.jeecg.modules.ls.Util.SecurityUtils;
import org.jeecg.modules.ls.Util.StringUtils;
import org.jeecg.modules.ls.Util.UtilsExcel.ErrorExcel;
import org.jeecg.modules.ls.Util.UtilsExcel.ImplExcel;
import org.jeecg.modules.ls.Util.UtilsExcel.ImportEnum;
import org.jeecg.modules.ls.Util.UtilsExcel.ImportExcelUtil;
import org.jeecg.modules.masterData.entity.DictDetailImport;
import org.jeecg.modules.masterData.entity.ZsjDictionaryDetail;
import org.jeecg.modules.masterData.entity.ZsjEmployee;
import org.jeecg.modules.masterData.entity.ZsjPublicDictionary;
import org.jeecg.modules.masterData.mapper.ZsjDictionaryDetailMapper;
import org.jeecg.modules.masterData.service.IZsjDictionaryDetailService;
import org.jeecg.modules.masterData.service.IZsjPublicDictionaryService;
import org.jeecg.modules.util.CnToWBUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @Description: 公共字典明细
 * @Author: 唐正锋
 * @Date:   2021-05-07
 * @Version: V1.0
 */
@Slf4j
@Service
public class ZsjDictionaryDetailServiceImpl extends ServiceImpl<ZsjDictionaryDetailMapper, ZsjDictionaryDetail> implements IZsjDictionaryDetailService {

    @Autowired
    private ZsjDictionaryDetailMapper zsjDictionaryDetailMapper;

    @Autowired
    private IZsjPublicDictionaryService zsjPublicDictionaryService;

    @Override
    public void saveTo(ZsjDictionaryDetail zsjDictionaryDetail) {
        if(zsjDictionaryDetail.getWubiCode() == null || "".equals(zsjDictionaryDetail.getWubiCode())) {
            zsjDictionaryDetail.setWubiCode(CnToWBUtil.getWBCode(zsjDictionaryDetail.getNationalStandardMeaning()));
        }
        if(zsjDictionaryDetail.getPinyinCode() == null || "".equals(zsjDictionaryDetail.getPinyinCode())) {
            zsjDictionaryDetail.setPinyinCode(CnToWBUtil.getPinyinCode(zsjDictionaryDetail.getNationalStandardMeaning()));
        }
        String pid = "";
        if(zsjDictionaryDetail.getDynamicIdA() != null && !"".equals(zsjDictionaryDetail.getDynamicIdA())){
            pid = zsjDictionaryDetail.getDynamicIdA();
            zsjDictionaryDetail.setDynamicValueA(getById(zsjDictionaryDetail.getDynamicIdA()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdB() != null && !"".equals(zsjDictionaryDetail.getDynamicIdB())){
            pid = zsjDictionaryDetail.getDynamicIdB();
            zsjDictionaryDetail.setDynamicValueB(getById(zsjDictionaryDetail.getDynamicIdB()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdC() != null && !"".equals(zsjDictionaryDetail.getDynamicIdC())){
            pid = zsjDictionaryDetail.getDynamicIdC();
            zsjDictionaryDetail.setDynamicValueC(getById(zsjDictionaryDetail.getDynamicIdC()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdD() != null && !"".equals(zsjDictionaryDetail.getDynamicIdD())){
            pid = zsjDictionaryDetail.getDynamicIdD();
            zsjDictionaryDetail.setDynamicValueD(getById(zsjDictionaryDetail.getDynamicIdD()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdE() != null && !"".equals(zsjDictionaryDetail.getDynamicIdE())){
            pid = zsjDictionaryDetail.getDynamicIdE();
            zsjDictionaryDetail.setDynamicValueE(getById(zsjDictionaryDetail.getDynamicIdE()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdF() != null && !"".equals(zsjDictionaryDetail.getDynamicIdF())){
            pid = zsjDictionaryDetail.getDynamicIdF();
            zsjDictionaryDetail.setDynamicValueF(getById(zsjDictionaryDetail.getDynamicIdF()).getNationalStandardValues());
        }
        zsjDictionaryDetail.setPid(pid);
        zsjDictionaryDetail.setStatus(1);
        save(zsjDictionaryDetail);
    }

    @Override
    public void updateTo(ZsjDictionaryDetail zsjDictionaryDetail) {
        if(zsjDictionaryDetail.getWubiCode() == null || "".equals(zsjDictionaryDetail.getWubiCode())) {
            zsjDictionaryDetail.setWubiCode(CnToWBUtil.getWBCode(zsjDictionaryDetail.getNationalStandardMeaning()));
        }
        if(zsjDictionaryDetail.getPinyinCode() == null || "".equals(zsjDictionaryDetail.getPinyinCode())) {
            zsjDictionaryDetail.setPinyinCode(CnToWBUtil.getPinyinCode(zsjDictionaryDetail.getNationalStandardMeaning()));
        }
        String pid = "";
        if(zsjDictionaryDetail.getDynamicIdA() != null && !"".equals(zsjDictionaryDetail.getDynamicIdA())){
            pid = zsjDictionaryDetail.getDynamicIdA();
            zsjDictionaryDetail.setDynamicValueA(getById(zsjDictionaryDetail.getDynamicIdA()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdB() != null && !"".equals(zsjDictionaryDetail.getDynamicIdB())){
            pid = zsjDictionaryDetail.getDynamicIdB();
            zsjDictionaryDetail.setDynamicValueB(getById(zsjDictionaryDetail.getDynamicIdB()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdC() != null && !"".equals(zsjDictionaryDetail.getDynamicIdC())){
            pid = zsjDictionaryDetail.getDynamicIdC();
            zsjDictionaryDetail.setDynamicValueC(getById(zsjDictionaryDetail.getDynamicIdC()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdD() != null && !"".equals(zsjDictionaryDetail.getDynamicIdD())){
            pid = zsjDictionaryDetail.getDynamicIdD();
            zsjDictionaryDetail.setDynamicValueD(getById(zsjDictionaryDetail.getDynamicIdD()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdE() != null && !"".equals(zsjDictionaryDetail.getDynamicIdE())){
            pid = zsjDictionaryDetail.getDynamicIdE();
            zsjDictionaryDetail.setDynamicValueE(getById(zsjDictionaryDetail.getDynamicIdE()).getNationalStandardValues());
        }
        if(zsjDictionaryDetail.getDynamicIdF() != null && !"".equals(zsjDictionaryDetail.getDynamicIdF())){
            pid = zsjDictionaryDetail.getDynamicIdF();
            zsjDictionaryDetail.setDynamicValueF(getById(zsjDictionaryDetail.getDynamicIdF()).getNationalStandardValues());
        }
        zsjDictionaryDetail.setPid(pid);
        zsjDictionaryDetail.setStatus(1);
        updateById(zsjDictionaryDetail);
    }

    @Override
    public List<ZsjDictionaryDetail> getDictionaryDetailList(String nationalStandardValues,String categoryCoding) {
        return zsjDictionaryDetailMapper.getCategoryCodingList(nationalStandardValues,categoryCoding);
    }

    @Override
    public List<ZsjDictionaryDetail> getDictionaryDetailIdList(String nationalStandardValues,String publicDictionaryId) {
        return zsjDictionaryDetailMapper.getDictionaryDetailIdList(nationalStandardValues,publicDictionaryId);
    }


    @Override
    public Integer getMaxNumber(String categoryCoding) {
        return zsjDictionaryDetailMapper.getMaxNumber(categoryCoding);
    }

    @Override
    public Integer getMaxNumberPid(String pid) {
        return zsjDictionaryDetailMapper.getMaxNumberPid(pid);
    }


    @Override
    public List<ZsjDictionaryDetail> getDictionaryPidList(String meaning,String pid) {
        return zsjDictionaryDetailMapper.getDictionaryPidList(meaning,pid);
    }

}
ZsjDictionaryDetailMapper
package org.jeecg.modules.masterData.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.masterData.entity.ZsjDictionaryDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.masterData.entity.ZsjPublicDictionary;

/**
 * @Description: 公共字典明细
 * @Author: 唐正锋
 * @Date:   2021-05-07
 * @Version: V1.0
 */
public interface ZsjDictionaryDetailMapper extends BaseMapper<ZsjDictionaryDetail> {

    @Select(" SELECT zsj_dictionary_detail.* FROM zsj_dictionary_detail  " +
            " LEFT JOIN zsj_public_dictionary ON zsj_public_dictionary.id = public_dictionary_id  " +
            " WHERE national_standard_values = #{nationalStandardValues} AND category_coding = #{categoryCoding} " +
            " and zsj_dictionary_detail.status = 1 and zsj_public_dictionary.status = 1 ")
    List<ZsjDictionaryDetail> getCategoryCodingList(String nationalStandardValues,String categoryCoding);


    @Select(" SELECT * FROM zsj_dictionary_detail  " +
            " WHERE national_standard_values = #{nationalStandardValues} AND public_dictionary_id = #{publicDictionaryId} " +
            " and status = 1 ")
    List<ZsjDictionaryDetail> getDictionaryDetailIdList(String nationalStandardValues,String publicDictionaryId);

    /**
     * 查询最大id
     * @param categoryCoding
     * @return
     */
    @Select(" SELECT MAX(zsj_dictionary_detail.arrange_serial_number) FROM zsj_dictionary_detail   " +
            " LEFT JOIN zsj_public_dictionary ON zsj_public_dictionary.id = public_dictionary_id  " +
            " WHERE zsj_public_dictionary.`status` = 1 AND zsj_dictionary_detail.`status` = 1   " +
            " and category_coding = #{categoryCoding}  ")
    Integer getMaxNumber(String categoryCoding);

    /**
     * 查询最大id
     * @param pid
     * @return
     */
    @Select(" SELECT MAX(arrange_serial_number) FROM zsj_dictionary_detail   " +
            " WHERE status = 1 and pid = #{pid}  ")
    Integer getMaxNumberPid(String pid);

    @Select(" SELECT * FROM zsj_dictionary_detail " +
            " WHERE status = 1 " +
            " and national_standard_meaning = #{meaning} and pid = #{pid}  ")
    List<ZsjDictionaryDetail> getDictionaryPidList(String meaning,String pid);


}

关注微信公众号: 回复:“高德地图省市区”获取省市区街道数据

图片

 

以上是关于2021年全国省市区街道代码自动同步(包含解决方案)的主要内容,如果未能解决你的问题,请参考以下文章

全国官方最新省市区街道详细邮编物流选用

2021年全国水体分布(按省市县)矢量数据的制作与分享

获取国家2019年最新的省市区/县街道小区/居委会信息 包括港澳台

Jsoup获取全国地区数据(省市县镇村)

省市区县街道四级联动下拉菜单

2017 年 8 月最新中国行政区划代码省市区数据库