1、指令新建时插入日志表增加uuid

This commit is contained in:
PushM
2024-06-26 02:16:11 +08:00
parent a2d836b137
commit a71c4376d9
3 changed files with 21 additions and 9 deletions

View File

@@ -53,7 +53,7 @@ public interface CommandMapper {
void updateCommandHistoryExpireTime(@Param("command_id") String commandUUID);
void insertCommandHistory(@Param("command_id") String commandUUID);
void insertCommandHistory(@Param("command_id") String commandUUID, @Param("log_id") String logUUID);
void updateCommandHistoryExpireTimeBatch(@Param("commandIds")List<String> commandIds);

View File

@@ -238,15 +238,23 @@ public class CommandService {
}
public void insertCommandHistory(String commandUUID) {
commandMapper.updateCommandHistoryExpireTime(commandUUID);
commandMapper.insertCommandHistory(commandUUID);
//todo: 不update insert加入uuid
// commandMapper.updateCommandHistoryExpireTime(commandUUID);
String logId = UUID.randomUUID().toString();
commandMapper.insertCommandHistory(commandUUID, logId);
}
public void insertCommandHistoryBatch(List<TaskCommandInfo> commandIdList) {
List<String> commandIds = ListUtils.newArrayListWithExpectedSize(commandIdList.size());
commandIdList.forEach(item -> commandIds.add(item.getUUID()));
commandMapper.updateCommandHistoryExpireTimeBatch(commandIds);
//todo: 不update insert加入uuid
// commandMapper.updateCommandHistoryExpireTimeBatch(commandIds);
// List<String> logIds;
// logIds = ListUtils.newArrayListWithExpectedSize(commandIds.size());
// for (int i = 0; i < commandIds.size(); i++) {
// logIds.add(UUID.randomUUID().toString());
// }
//新建的loguuid拿commannd_id来定顶一会吧
commandMapper.insertCommandHistoryBatch(commandIds);
}
}