Files
his/debug_api_return.md

1.1 KiB
Raw Blame History

检查后端API返回数据结构

问题分析

尽管我们更新了DTO和SQL查询前端仍然没有显示创建时间可能的原因

  1. API响应中没有包含createTime字段
  2. SQL查询没有正确返回createTime字段
  3. 数据库中createTime字段本身为null
  4. JSON序列化问题

检查步骤

1. 检查数据库中数据

首先检查数据库中sys_user表的createTime字段是否正确填充

SELECT user_id, user_name, nick_name, create_time 
FROM sys_user 
WHERE create_time IS NOT NULL 
LIMIT 10;

2. 检查API端点

API端点是GET /base-data-manage/practitioner/user-practitioner-page 这个端点在PractitionerController中定义调用practitionerAppService.getUserPractitionerPage()

3. 检查SQL查询

在PractitionerAppMapper.xml中我们已经添加了createTime字段

T2.create_time

4. 验证DTO映射

UserAndPractitionerDto中已添加createTime字段

private Date createTime;

5. 检查JSON序列化

检查是否有@JsonFormat注解或其他序列化配置问题