fix(api): 修复用户审核相关接口及查询逻辑
- 新增 GET /api/system/user/audit/{userId} 查询用户审核信息接口
- 修改前端 auditUser API 请求为 PUT,调整请求参数和字段映射
- UserMapper.xml 中增加 auditStatus 和 auditPending 查询条件支持
- UserParam.java 新增 auditStatus 字段及 auditPending 标记用于待处理审核用户查询
- 删除用户表新增审核字段的数据库脚本,避免重复添加
This commit is contained in:
@@ -4,3 +4,8 @@
|
||||
- **问题**:`GET /api/system/user/audit/{userId}` 返回404,接口不存在
|
||||
- **原因**:只有 `PUT /api/system/user/audit`(执行审核操作),缺少查询用户审核信息的GET接口
|
||||
- **修复**:在 `UserController.java` 中新增 `getAuditInfo` 方法,返回 userId、auditStatus、rejectReason
|
||||
|
||||
## 修复前端审核接口请求方法不匹配
|
||||
- **问题**:`Request method 'POST' not supported` 报错
|
||||
- **原因**:前端 `auditUser` API 用 POST + 路径参数 `/audit/{id}`,后端是 PUT + body 参数 `/audit`
|
||||
- **修复**:修改 `guilixu-admin/src/api/system/user/index.ts`,改为 PUT 请求、去掉路径参数、字段名映射(status→auditStatus, remark→rejectReason)、userId 放入 body
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
-- 注册审核功能:用户表新增审核状态字段
|
||||
-- 执行前请备份数据库
|
||||
-- 执行时间: 2026-07-11
|
||||
|
||||
ALTER TABLE sys_user
|
||||
ADD COLUMN audit_status INT DEFAULT NULL COMMENT '审核状态: 0待审核, 1已通过, 2已拒绝',
|
||||
ADD COLUMN reject_reason VARCHAR(500) DEFAULT NULL COMMENT '审核驳回原因',
|
||||
ADD COLUMN shop_name VARCHAR(100) DEFAULT NULL COMMENT '店名';
|
||||
@@ -110,6 +110,12 @@
|
||||
<if test="param.status != null">
|
||||
AND a.`status` = #{param.status}
|
||||
</if>
|
||||
<if test="param.auditStatus != null">
|
||||
AND a.`audit_status` = #{param.auditStatus}
|
||||
</if>
|
||||
<if test="param.auditPending != null and param.auditPending">
|
||||
AND a.`audit_status` IN (0, 2)
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
|
||||
@@ -111,8 +111,13 @@ public class UserParam extends BaseParam {
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "审核状态: 0待审核, 1已通过, 2已拒绝(前端传值决定注册是否走审核流程)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer auditStatus;
|
||||
|
||||
@Schema(description = "是否查询待处理审核用户(待审核0/被驳回2)")
|
||||
@TableField(exist = false)
|
||||
private Boolean auditPending;
|
||||
|
||||
@Schema(description = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
Reference in New Issue
Block a user