From c16ca04b474d445cde54332045db19458863709e Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 26 八月 2024 19:42:11 +0800
Subject: [PATCH] 设备增加厂商类型
---
ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
index dd9e350..1fc62ca 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwUnitServiceImpl.java
@@ -29,10 +29,7 @@
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -59,6 +56,9 @@
@Transactional(rollbackFor = Exception.class)
public Result add(YwUnitForm form) {
YwUnit entity = YwUnitForm.getEntityByForm(form, null);
+ Date now = new Date();
+ entity.setCreateTime(now);
+ entity.setUpdateTime(now);
if(baseMapper.insert(entity) > 0) {
// 鏂板杩愮淮浜哄憳璐﹀彿
SysUser sysUser = new SysUser();
@@ -90,10 +90,11 @@
@Transactional(rollbackFor = Exception.class)
public Result update(YwUnitForm form) {
YwUnit entity = baseMapper.selectById(form.getId());
-
// 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
BeanUtils.copyProperties(form, entity);
+ Date now = new Date();
+ entity.setUpdateTime(now);
if (baseMapper.updateById(entity) > 0) {
// 淇敼杩愮淮鍗曚綅璐﹀彿淇℃伅
SysUser sysUser = sysUserMapper.selectUserByUserName(entity.getUnitAdminAccount());
--
Gitblit v1.8.0