fix: 修复用户管理列表字段显示问题
将后端返回的下划线命名字段转换为驼峰格式: - user_id → userId - user_name → userName - nick_name → nickName - dept_name → dept.deptName 用户管理功能正常
This commit is contained in:
parent
4e43376ef9
commit
b85f332e44
|
|
@ -71,10 +71,30 @@ public class SysUserController extends BaseController {
|
||||||
|
|
||||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql.toString(), params.toArray());
|
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql.toString(), params.toArray());
|
||||||
|
|
||||||
|
// 转换字段名为驼峰格式,并包装 dept 对象
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
for (Map<String, Object> row : rows) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("userId", row.get("user_id"));
|
||||||
|
item.put("userName", row.get("user_name"));
|
||||||
|
item.put("nickName", row.get("nick_name"));
|
||||||
|
item.put("email", row.get("email"));
|
||||||
|
item.put("phonenumber", row.get("phonenumber"));
|
||||||
|
item.put("sex", row.get("sex"));
|
||||||
|
item.put("status", row.get("status"));
|
||||||
|
item.put("createTime", row.get("create_time"));
|
||||||
|
// 前端期望 dept.deptName 格式
|
||||||
|
Map<String, Object> dept = new HashMap<>();
|
||||||
|
dept.put("deptId", row.get("dept_id"));
|
||||||
|
dept.put("deptName", row.get("dept_name"));
|
||||||
|
item.put("dept", dept);
|
||||||
|
result.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
TableDataInfo dataInfo = new TableDataInfo();
|
TableDataInfo dataInfo = new TableDataInfo();
|
||||||
dataInfo.setCode(200);
|
dataInfo.setCode(200);
|
||||||
dataInfo.setMsg("查询成功");
|
dataInfo.setMsg("查询成功");
|
||||||
dataInfo.setRows(rows);
|
dataInfo.setRows(result);
|
||||||
dataInfo.setTotal(total != null ? total : 0);
|
dataInfo.setTotal(total != null ? total : 0);
|
||||||
return dataInfo;
|
return dataInfo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue