添加递归查询全国行政区域功能,优化数据库查询性能

1. 新增`getAllChildren`和`getAllChildrenTree`接口,支持根据ID递归查询所有下级区域数据。
2. 实现SQL递归查询和Java递归查询的双重策略,提升查询效率。
3. 新增`DictRegionTreeVO`类,构建树形结构以便于展示层级关系。
4. 更新相关控制器和服务层,完善接口文档和注释。

影响范围:全国行政区域模块,提升数据查询的灵活性和性能。
This commit is contained in:
刘倡
2025-06-21 14:52:53 +08:00
parent 3bf1bda674
commit 71efb5cf0b
19 changed files with 988 additions and 104 deletions

View File

@ -13,8 +13,8 @@ spring:
writeTimeout: 35000
nacos:
discovery:
server-addr: 127.0.0.1:18848
group: EBTP_GROUP # 例如EBTP_GROUP
server-addr: 10.60.161.59:8848
aop:
auto: true #开启spring的aop配置
proxy-target-class: true
@ -22,30 +22,29 @@ spring:
application:
name: sys-manager-ebtp-project
shardingsphere:
datasource:
names: ds0
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: Unicom@2024
jdbc-url: jdbc:mysql://59.110.10.99:53306/ebtp_sys_manager?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://59.110.10.99:53306/ebtp_sys_manager?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
filters: stat,wall,log4j
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: root@test
# username: root
password: Unicom@2024
# url: jdbc:mysql://59.110.10.99:53306/ebtp_sys_manager?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:2881/ebtp_sys_manager?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
druid:
# filters: stat,wall,log4j
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
props:
sql:
show: true
@ -83,7 +82,8 @@ spring:
redis:
sentinel:
master: mymaster
nodes: 10.60.161.59:26379, 10.60.161.59:26380, 10.60.161.59:26381
# nodes: 10.60.161.59:26379, 10.60.161.59:26380, 10.60.161.59:26381
nodes: localhost:26379
password: pass
database:
sharding: 1
@ -91,6 +91,14 @@ spring:
idempotent: 3
userinfo: 4
thymeleaf:
prefix: classpath:/templates/
suffix: .html
cache: false
mode: HTML
encoding: UTF-8
servlet:
content-type: text/html
mybatis-plus:
@ -99,7 +107,7 @@ mybatis-plus:
map-underscore-to-camel-case: true
auto-mapping-behavior: full
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath*:com/coscoshipping/ebtp/**/mapper/*Mapper.xml,com/chinaunicom/mall/ebtp/**/mapper/*Mapper.xml
global-config:
# 逻辑删除配置