fix: 优化用户审核分页查询
This commit is contained in:
parent
d4250a304a
commit
148fffe2d0
@ -2,6 +2,7 @@ package com.yfd.platform.env.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.env.domain.SdEngInfoBH;
|
||||
import com.yfd.platform.env.domain.StationBasinInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -37,4 +38,7 @@ public interface SdEngInfoBHMapper extends BaseMapper<SdEngInfoBH> {
|
||||
* 根据基地流域编码列表批量查询电站
|
||||
*/
|
||||
List<SdEngInfoBH> selectByHbrvcdList(@Param("hbrvcdList") List<String> hbrvcdList);
|
||||
|
||||
|
||||
List<StationBasinInfo> selectStationBasinInfo();
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import com.yfd.platform.data.domain.SysUserDataScope;
|
||||
import com.yfd.platform.data.mapper.SysUserDataScopeMapper;
|
||||
import com.yfd.platform.env.domain.SdEngInfoBH;
|
||||
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.SdHbrvDicMapper;
|
||||
import com.yfd.platform.system.domain.LoginUser;
|
||||
@ -239,7 +240,6 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
* 返回值说明: 是否更新成功
|
||||
************************************/
|
||||
// ... existing code ...
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map updateById(SysUser sysUser, String roleids) {
|
||||
@ -324,6 +324,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
|
||||
/**
|
||||
* 处理用户角色分配(增量更新)
|
||||
*
|
||||
* @param userId 用户 ID
|
||||
* @param roleIds 角色 ID 字符串(逗号分隔)
|
||||
*/
|
||||
@ -445,9 +446,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id
|
||||
String level = sysUserMapper.getMaxLevel(id);
|
||||
//判断是否获取级别
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername())||StrUtil.isNotEmpty(level)) {
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername()) || StrUtil.isNotEmpty(level)) {
|
||||
//判断当前用户级别 管理员及以上权限
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername())||Integer.parseInt(level) <= 2) {
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername()) || Integer.parseInt(level) <= 2) {
|
||||
SysUser sysUser = sysUserMapper.selectById(id);
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
String password = PasswordGenerator.generateRandomPassword(sysUser.getUsername());
|
||||
@ -480,7 +481,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
//根据当前用户id 查询角色表的级别 currentUser.getUser() 获取当前用户id
|
||||
String level = sysUserMapper.getMaxLevel(id);
|
||||
//判断当前用户级别 管理员及以上权限
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername())||Integer.parseInt(level) <= 2) {
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername()) || Integer.parseInt(level) <= 2) {
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
//根据id修改用户状态,最近修改人,最近修改时间
|
||||
updateWrapper.eq("id", id).set("status", status).set(
|
||||
@ -694,31 +695,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
userScopeMap.computeIfAbsent(scope.getUserId(), k -> new ArrayList<>()).add(scope);
|
||||
}
|
||||
}
|
||||
List<SdHbrvDic> allHbrvDicts = sdHbrvDicMapper.selectList(null);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<StationBasinInfo> stationBasinInfos = sdEngInfoBHMapper.selectStationBasinInfo();
|
||||
for (SysUser record : records) {
|
||||
String userId = record.getId();
|
||||
|
||||
@ -739,13 +716,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
basinNameSet.add(orgName);
|
||||
}
|
||||
if (orgId != null) {
|
||||
List<SdEngInfoBH> stations = basinToStationsMap.get(orgId);
|
||||
if (stations != null) {
|
||||
for (SdEngInfoBH station : stations) {
|
||||
if (station.getEnnm() != null) {
|
||||
stationNameSet.add(station.getEnnm());
|
||||
}
|
||||
}
|
||||
if (stationBasinInfos != null) {
|
||||
List<String> stcdList = stationBasinInfos.stream().filter(info -> info.getHbrvcd().equals(orgId)).map(StationBasinInfo::getEnnm).toList();
|
||||
stationNameSet.addAll(stcdList);
|
||||
}
|
||||
}
|
||||
} else if ("STATION".equals(orgType)) {
|
||||
@ -753,9 +726,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
stationNameSet.add(orgName);
|
||||
}
|
||||
if (orgId != null) {
|
||||
String stationName = stationCodeToNameMap.get(orgId);
|
||||
if (stationName != null) {
|
||||
stationNameSet.add(stationName);
|
||||
if (stationBasinInfos != null) {
|
||||
String hbrbcd = stationBasinInfos.stream().filter(info -> info.getStcd().equals(orgId)).map(StationBasinInfo::getHbrvnm).findFirst().orElse(null);
|
||||
basinNameSet.add(hbrbcd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,11 +16,15 @@ spring:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
max-active: 20
|
||||
max-wait: 60000
|
||||
max-wait: 30000
|
||||
async-init: true
|
||||
keep-alive-between-time-millis: 120000
|
||||
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-timeout: 3
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
@ -28,7 +32,12 @@ spring:
|
||||
remove-abandoned: true
|
||||
remove-abandoned-timeout: 1800
|
||||
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:
|
||||
driverClassName: oracle.jdbc.OracleDriver
|
||||
url: "${DB_SLAVE_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}"
|
||||
@ -37,19 +46,61 @@ spring:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
max-active: 20
|
||||
max-wait: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
max-wait: 30000
|
||||
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-timeout: 3
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
keep-alive: true
|
||||
keep-alive-between-time-millis: 120000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
remove-abandoned: true
|
||||
remove-abandoned-timeout: 1800
|
||||
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:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
@ -154,6 +205,6 @@ attachment:
|
||||
token: ${ATTACHMENT_TOKEN:qgcBkod25ngBa4wu8BtfCPYsJ7lQGVDoexH}
|
||||
upload-url: ${ATTACHMENT_UPLOAD_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}
|
||||
# video-url: ${ATTACHMENT_VIDEO_URL:https://211.99.26.225:12125/upload}
|
||||
@ -231,6 +231,23 @@
|
||||
<result column="VLSRTM" property="vlsrTm"/>
|
||||
</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 * FROM SD_ENGINFO_B_H
|
||||
WHERE BASE_ID = #{baseId}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user