xiangpei
2024-08-16 983b100e79431dea9a471168dae451d2f7399b76
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());
        // 为空抛IllegalArgumentException,做全局异常处理
        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());