fix: 优化用户审核分页查询

This commit is contained in:
tangwei 2026-05-11 17:27:59 +08:00
parent d4250a304a
commit 148fffe2d0
4 changed files with 96 additions and 51 deletions

View File

@ -2,6 +2,7 @@ package com.yfd.platform.env.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.env.domain.SdEngInfoBH; import com.yfd.platform.env.domain.SdEngInfoBH;
import com.yfd.platform.env.domain.StationBasinInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -37,4 +38,7 @@ public interface SdEngInfoBHMapper extends BaseMapper<SdEngInfoBH> {
* 根据基地流域编码列表批量查询电站 * 根据基地流域编码列表批量查询电站
*/ */
List<SdEngInfoBH> selectByHbrvcdList(@Param("hbrvcdList") List<String> hbrvcdList); List<SdEngInfoBH> selectByHbrvcdList(@Param("hbrvcdList") List<String> hbrvcdList);
List<StationBasinInfo> selectStationBasinInfo();
} }

View File

@ -14,6 +14,7 @@ import com.yfd.platform.data.domain.SysUserDataScope;
import com.yfd.platform.data.mapper.SysUserDataScopeMapper; import com.yfd.platform.data.mapper.SysUserDataScopeMapper;
import com.yfd.platform.env.domain.SdEngInfoBH; import com.yfd.platform.env.domain.SdEngInfoBH;
import com.yfd.platform.env.domain.SdHbrvDic; import com.yfd.platform.env.domain.SdHbrvDic;
import com.yfd.platform.env.domain.StationBasinInfo;
import com.yfd.platform.env.mapper.SdEngInfoBHMapper; import com.yfd.platform.env.mapper.SdEngInfoBHMapper;
import com.yfd.platform.env.mapper.SdHbrvDicMapper; import com.yfd.platform.env.mapper.SdHbrvDicMapper;
import com.yfd.platform.system.domain.LoginUser; import com.yfd.platform.system.domain.LoginUser;
@ -239,7 +240,6 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
* 返回值说明: 是否更新成功 * 返回值说明: 是否更新成功
************************************/ ************************************/
// ... existing code ... // ... existing code ...
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map updateById(SysUser sysUser, String roleids) { public Map updateById(SysUser sysUser, String roleids) {
@ -324,6 +324,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
/** /**
* 处理用户角色分配增量更新 * 处理用户角色分配增量更新
*
* @param userId 用户 ID * @param userId 用户 ID
* @param roleIds 角色 ID 字符串逗号分隔 * @param roleIds 角色 ID 字符串逗号分隔
*/ */
@ -694,31 +695,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
userScopeMap.computeIfAbsent(scope.getUserId(), k -> new ArrayList<>()).add(scope); userScopeMap.computeIfAbsent(scope.getUserId(), k -> new ArrayList<>()).add(scope);
} }
} }
List<SdHbrvDic> allHbrvDicts = sdHbrvDicMapper.selectList(null); List<StationBasinInfo> stationBasinInfos = sdEngInfoBHMapper.selectStationBasinInfo();
Map<String, String> basinCodeToNameMap = new HashMap<>();
if (allHbrvDicts != null) {
for (SdHbrvDic hbrv : allHbrvDicts) {
if (hbrv.getHbrvcd() != null && hbrv.getHbrvnm() != null) {
basinCodeToNameMap.put(hbrv.getHbrvcd(), hbrv.getHbrvnm());
}
}
}
List<SdEngInfoBH> allStations = sdEngInfoBHMapper.selectList(null);
Map<String, List<SdEngInfoBH>> basinToStationsMap = new HashMap<>();
Map<String, String> stationCodeToNameMap = new HashMap<>();
if (allStations != null) {
for (SdEngInfoBH station : allStations) {
if (station.getStcd() != null && station.getEnnm() != null) {
stationCodeToNameMap.put(station.getStcd(), station.getEnnm());
}
if (station.getHbrvcd() != null) {
basinToStationsMap.computeIfAbsent(station.getHbrvcd(), k -> new ArrayList<>()).add(station);
}
}
}
for (SysUser record : records) { for (SysUser record : records) {
String userId = record.getId(); String userId = record.getId();
@ -739,13 +716,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
basinNameSet.add(orgName); basinNameSet.add(orgName);
} }
if (orgId != null) { if (orgId != null) {
List<SdEngInfoBH> stations = basinToStationsMap.get(orgId); if (stationBasinInfos != null) {
if (stations != null) { List<String> stcdList = stationBasinInfos.stream().filter(info -> info.getHbrvcd().equals(orgId)).map(StationBasinInfo::getEnnm).toList();
for (SdEngInfoBH station : stations) { stationNameSet.addAll(stcdList);
if (station.getEnnm() != null) {
stationNameSet.add(station.getEnnm());
}
}
} }
} }
} else if ("STATION".equals(orgType)) { } else if ("STATION".equals(orgType)) {
@ -753,9 +726,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
stationNameSet.add(orgName); stationNameSet.add(orgName);
} }
if (orgId != null) { if (orgId != null) {
String stationName = stationCodeToNameMap.get(orgId); if (stationBasinInfos != null) {
if (stationName != null) { String hbrbcd = stationBasinInfos.stream().filter(info -> info.getStcd().equals(orgId)).map(StationBasinInfo::getHbrvnm).findFirst().orElse(null);
stationNameSet.add(stationName); basinNameSet.add(hbrbcd);
} }
} }
} }

View File

@ -16,11 +16,15 @@ spring:
initial-size: 5 initial-size: 5
min-idle: 5 min-idle: 5
max-active: 20 max-active: 20
max-wait: 60000 max-wait: 30000
async-init: true
keep-alive-between-time-millis: 120000 keep-alive-between-time-millis: 120000
time-between-eviction-runs-millis: 60000 time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000 min-evictable-idle-time-millis: 180000
max-evictable-idle-time-millis: 300000
phy-timeout-millis: 25200000
validation-query: SELECT 1 FROM DUAL validation-query: SELECT 1 FROM DUAL
validation-query-timeout: 3
test-while-idle: true test-while-idle: true
test-on-borrow: false test-on-borrow: false
test-on-return: false test-on-return: false
@ -28,7 +32,12 @@ spring:
remove-abandoned: true remove-abandoned: true
remove-abandoned-timeout: 1800 remove-abandoned-timeout: 1800
log-abandoned: true log-abandoned: true
connection-properties: oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=30000 break-after-acquire-failure: true
time-between-connect-error-millis: 300000
pool-prepared-statements: true
max-open-prepared-statements: 100
max-pool-prepared-statement-per-connection-size: 100
connection-properties: oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=60000;oracle.net.READ_TIMEOUT=60000
slave: slave:
driverClassName: oracle.jdbc.OracleDriver driverClassName: oracle.jdbc.OracleDriver
url: "${DB_SLAVE_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}" url: "${DB_SLAVE_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}"
@ -37,19 +46,61 @@ spring:
initial-size: 5 initial-size: 5
min-idle: 5 min-idle: 5
max-active: 20 max-active: 20
max-wait: 60000 max-wait: 30000
min-evictable-idle-time-millis: 300000 async-init: true
keep-alive-between-time-millis: 120000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 180000
max-evictable-idle-time-millis: 300000
phy-timeout-millis: 25200000
validation-query: SELECT 1 FROM DUAL validation-query: SELECT 1 FROM DUAL
validation-query-timeout: 3
test-while-idle: true test-while-idle: true
test-on-borrow: false test-on-borrow: false
test-on-return: false test-on-return: false
keep-alive: true keep-alive: true
keep-alive-between-time-millis: 120000
time-between-eviction-runs-millis: 60000
remove-abandoned: true remove-abandoned: true
remove-abandoned-timeout: 1800 remove-abandoned-timeout: 1800
log-abandoned: true log-abandoned: true
connection-properties: oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=30000 break-after-acquire-failure: true
time-between-connect-error-millis: 300000
pool-prepared-statements: true
max-open-prepared-statements: 100
max-pool-prepared-statement-per-connection-size: 100
connection-properties: oracle.net.CONNECT_TIMEOUT=10000;oracle.jdbc.ReadTimeout=60000;oracle.net.READ_TIMEOUT=60000
filter:
stat:
enabled: true
log-slow-sql: true
slow-sql-millis: 3000
merge-sql: true
slf4j:
enabled: true
wall:
enabled: true
log-violation: true
throw-exception: true
config:
select-where-alway-true-check: true
select-having-alway-true-check: true
delete-where-alway-true-check: true
update-where-alay-true-check: true
update-where-alway-true-check: true
update-where-none-check: true
multi-statement-allow: false
web-stat-filter:
enabled: true
url-pattern: /*
exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
session-stat-enable: true
principal-session-name: admin
profile-enable: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
login-username: admin
login-password: admin
reset-enable: false
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
@ -154,6 +205,6 @@ attachment:
token: ${ATTACHMENT_TOKEN:qgcBkod25ngBa4wu8BtfCPYsJ7lQGVDoexH} token: ${ATTACHMENT_TOKEN:qgcBkod25ngBa4wu8BtfCPYsJ7lQGVDoexH}
upload-url: ${ATTACHMENT_UPLOAD_URL:http://172.16.31.185:18200/upload} upload-url: ${ATTACHMENT_UPLOAD_URL:http://172.16.31.185:18200/upload}
video-url: ${ATTACHMENT_VIDEO_URL:http://172.16.31.185:18200/upload} video-url: ${ATTACHMENT_VIDEO_URL:http://172.16.31.185:18200/upload}
delete-url: ${ATTACHMENT_DELETE_URL:http://172.16.31.185:18200/delete} delete-url: ${ATTACHMENT_DELETE_URL:http://172.16.31.185:18200/FileDelete}
# upload-url: ${ATTACHMENT_UPLOAD_URL:https://211.99.26.225:12125/upload} # upload-url: ${ATTACHMENT_UPLOAD_URL:https://211.99.26.225:12125/upload}
# video-url: ${ATTACHMENT_VIDEO_URL:https://211.99.26.225:12125/upload} # video-url: ${ATTACHMENT_VIDEO_URL:https://211.99.26.225:12125/upload}

View File

@ -231,6 +231,23 @@
<result column="VLSRTM" property="vlsrTm"/> <result column="VLSRTM" property="vlsrTm"/>
</resultMap> </resultMap>
<resultMap id="StationBasinInfoResultMap" type="com.yfd.platform.env.domain.StationBasinInfo">
<result column="STCD" property="stcd"/>
<result column="ENNM" property="ennm"/>
<result column="HBRVCD" property="hbrvcd"/>
<result column="HBRVNM" property="hbrvnm"/>
</resultMap>
<select id="selectStationBasinInfo" resultMap="StationBasinInfoResultMap">
SELECT
e.STCD,
e.ENNM,
e.HBRVCD,
h.HBRVNM
FROM SD_ENGINFO_B_H e
LEFT JOIN SD_HBRV_DIC h ON e.HBRVCD = h.HBRVCD
</select>
<select id="selectByBaseId" resultMap="BaseResultMap"> <select id="selectByBaseId" resultMap="BaseResultMap">
SELECT * FROM SD_ENGINFO_B_H SELECT * FROM SD_ENGINFO_B_H
WHERE BASE_ID = #{baseId} WHERE BASE_ID = #{baseId}