Commit 3ed67bfb by chamberone

fix: 修复时间字段为空问题

1 parent bc637c23
...@@ -56,7 +56,7 @@ public class MapBlockInfoEntity { ...@@ -56,7 +56,7 @@ public class MapBlockInfoEntity {
@Column(name = "create_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP") @Column(name = "create_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createTime; private LocalDateTime createTime;
@Column(name = "update_time", nullable = false, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") @Column(name = "update_time", nullable = true, columnDefinition = "datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
private LocalDateTime updateTime; private LocalDateTime updateTime;
// Getters and Setters // Getters and Setters
......
...@@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -199,6 +201,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -199,6 +201,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
block.setLayer(layerName); block.setLayer(layerName);
block.setStatus(true); block.setStatus(true);
block.setArea(0L); block.setArea(0L);
block.setCreateTime(LocalDateTime.now());
entityManager.persist(block); entityManager.persist(block);
return Result.success(null); return Result.success(null);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!