feat(后台管理): 实体管理列表统一展示创建时间/更新时间
用户管理、菜单管理、不符合ASIN、数据去重总数据、查询ASIN、最低价ASIN、 商品类目、密钥管理共 8 个实体管理列表补齐两列。分组管理/店铺密钥/店铺管理 此前已带创建+修改时间,任务列表与统计报表(撞款监控、密钥用量、日志、 记录与版本)不含实体更新语义,均未改动。 关键点——时间列必须由数据库维护,否则新列是假的: 这些表的更新走 selectById → 改字段 → updateById,实体带着读出的旧 updated_at 一起写回。MySQL 规则是「UPDATE 显式给某列赋值时不触发该列的 ON UPDATE 自动更新」,不禁写就会把旧值写回去,更新时间永远冻结在首次写入 时刻。按 V125(biz_file_result)既有样板,给 7 个实体标注 @TableField(insertStrategy=NEVER, updateStrategy=NEVER)。 - V131:users / columns 补 updated_at(幂等 ADD COLUMN,仿 V125 写法)。 存量行被回填为迁移执行时刻,非真实历史变更时间(历史上无记录,无法还原) - 实体/VO:AdminUserEntity、PermissionMenuEntity、InvalidAsinDataEntity、 DedupeTotalDataEntity、ProductCategoryEntity、QueryAsinEntity、 SkipPriceAsinEntity 加/改写 updatedAt;AdminUserItemVo、PermissionMenuItemVo、 InvalidAsinDataItemVo、DedupeTotalDataItemVo 补 updatedAt; AdminUserSecretRowVo 补 createdAt(行级首次配置时间 = 三模块最早) - 查询ASIN/最低价ASIN 后端 VO 与前端 model 本就有两字段,仅补渲染 - 前端 8 页表格加列,同步修正空态/加载行的 colspan(手写表格,不同步会错位) - 测试:align-query-asin / align-skip-price 原断言「不允许有更新时间列」 (像素复刻旧版),按新需求改为断言两列存在;新增 e2e list-time-columns 覆盖 8 页表头与真实时间值渲染
This commit is contained in:
+3
@@ -37,6 +37,9 @@ public class AdminUserSecretRowVo {
|
||||
@Schema(description = "行级状态说明")
|
||||
private String statusMessage;
|
||||
|
||||
@Schema(description = "首次配置时间(三模块中最早)")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "最近更新时间(三模块中最晚)")
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
|
||||
+14
@@ -41,6 +41,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -607,6 +608,7 @@ public class UserApiSecretService implements UserSecretCleanupPort {
|
||||
vo.setStatus(summarizeRowStatus(modules));
|
||||
vo.setStatusMessage(summarizeRowMessage(modules, vo.getStatus()));
|
||||
vo.setUpdatedAt(latestUpdatedAt(modules));
|
||||
vo.setCreatedAt(earliestCreatedAt(moduleRows.values()));
|
||||
AdminUserEntity user = adminUserMapper.selectById(userId);
|
||||
vo.setUsername(user == null ? "" : user.getUsername());
|
||||
vo.setGroups(List.of());
|
||||
@@ -673,6 +675,18 @@ public class UserApiSecretService implements UserSecretCleanupPort {
|
||||
return latest;
|
||||
}
|
||||
|
||||
/** 行级创建时间:该用户已配置模块中最早的一条 created_at;一条都没有则为 null。 */
|
||||
private LocalDateTime earliestCreatedAt(Collection<UserApiSecretEntity> rows) {
|
||||
LocalDateTime earliest = null;
|
||||
for (UserApiSecretEntity row : rows) {
|
||||
LocalDateTime value = row.getCreatedAt();
|
||||
if (value != null && (earliest == null || value.isBefore(earliest))) {
|
||||
earliest = value;
|
||||
}
|
||||
}
|
||||
return earliest;
|
||||
}
|
||||
|
||||
private void upsert(Long userId, String moduleKey, String plainValue, String source) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
UserApiSecretEntity existing = selectOne(userId, moduleKey);
|
||||
|
||||
Reference in New Issue
Block a user