| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @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(); |
| | |
| | | @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()); |