[301]
设备编码 没做唯一性校验,可以新增相同编码的设备
This commit is contained in:
parent
fc7297cbc3
commit
0faf0601ff
@ -8,6 +8,7 @@ import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.utils.BeanCopyUtils;
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
import com.das.common.utils.PageQuery;
|
||||
@ -64,7 +65,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
// 判断设备编码是否存在
|
||||
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
|
||||
throw new RuntimeException("设备编码已存在");
|
||||
throw new ServiceException("设备编码已存在");
|
||||
}
|
||||
sysEquipment.setCreatedTime(new Date());
|
||||
sysEquipment.setUpdatedTime(new Date());
|
||||
@ -94,7 +95,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
public void deleteSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
||||
// 设备下面有子设备则不能删除
|
||||
if (sysEquipmentMapper.queryChildEquipmentCount(sysEquipmentDto.getId()) > 0) {
|
||||
throw new RuntimeException("该设备下有子设备,不能删除");
|
||||
throw new ServiceException("该设备下有子设备,不能删除");
|
||||
}
|
||||
sysEquipmentMapper.deleteById(sysEquipmentDto.getId());
|
||||
}
|
||||
@ -168,7 +169,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
// 此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("文件下载失败==" + e);
|
||||
throw new ServiceException("文件下载失败==" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user