From b3221701c387ab536adf66cf315c75d3b429fe04 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期四, 17 九月 2026 09:38:06 +0800
Subject: [PATCH] feat&bug:文档问题修改及优化
---
cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
index 0f07197..d90d463 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
@@ -73,6 +73,14 @@
}
/**
+ * MyBatis-Plus 会将空集合拼成 IN (),ShardingSphere 无法解析该 SQL。
+ * 空集合按无匹配用户处理,使用不可能的 ID 进行查询。
+ */
+ private List<Integer> normalizeQueryIds(List<Integer> ids) {
+ return ids == null || ids.isEmpty() ? Collections.singletonList(-1) : ids;
+ }
+
+ /**
* 查询玩湃惠民卡绑定学员列表信息
*
* @return
@@ -312,10 +320,35 @@
return studentService.listOne(id);
}
+ /** 仅供管理端超级管理员经受控接口查看学员完整敏感信息。 */
+ @PostMapping("/internal/sensitive/student/{id}")
+ public Map<String, Object> sensitiveStudent(@PathVariable("id") Integer id,
+ @RequestHeader(value = "X-Internal-Sensitive-Access", required = false) String access) {
+ if (!"true".equalsIgnoreCase(access)) {
+ throw new IllegalStateException("Sensitive data access is restricted to the management service");
+ }
+ TStudent student = studentService.getById(id);
+ if (student == null) return null;
+ Map<String, Object> result = new HashMap<String, Object>();
+ result.put("id", student.getId());
+ result.put("appUserId", student.getAppUserId());
+ result.put("name", student.getName());
+ result.put("phone", student.getPhone());
+ result.put("idCard", student.getIdCard());
+ return result;
+ }
+
@ResponseBody
@PostMapping("/student/update")
public void update(@RequestBody TStudent tStudent) {
System.out.println("======tStudent======" + tStudent);
+ // 管理端不会回显加密手机号;空值代表未修改,必须保留数据库中的原始值。
+ if (StringUtils.isEmpty(tStudent.getPhone()) && tStudent.getId() != null) {
+ TStudent originalStudent = studentService.getById(tStudent.getId());
+ if (originalStudent != null) {
+ tStudent.setPhone(originalStudent.getPhone());
+ }
+ }
studentService.updateById(tStudent);
}
@@ -835,6 +868,7 @@
@ResponseBody
@PostMapping("/student/userAndVipYys")
public HashMap<String, Object> userAndVipYys(@RequestBody List<Integer> ids) {
+ ids = normalizeQueryIds(ids);
HashMap<String, Object> map = new HashMap<>();
// 所有的
@@ -1230,6 +1264,7 @@
@PostMapping("/student/queryUserAgeYys")
public HashMap<String, Object> queryUserAgeYys(@RequestBody List<Integer> ids) {
+ ids = normalizeQueryIds(ids);
HashMap<String, Object> map = new HashMap<>();
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids)
.isNotNull(TAppUser::getPhone)
@@ -1396,6 +1431,7 @@
@PostMapping("/student/queryUserAgeYys1")
public HashMap<String, Object> queryUserAgeYys1(@RequestBody List<Integer> ids) {
+ ids = normalizeQueryIds(ids);
HashMap<String, Object> map = new HashMap<>();
List<TAppUser> list = appUserService.list(new LambdaQueryWrapper<TAppUser>().in(TAppUser::getId, ids));
List<Integer> collect = list.stream().map(TAppUser::getId).collect(Collectors.toList());
--
Gitblit v1.7.1