Commit ea03352a by HlQ

feat: 设备入库时,返回重复的设备序列号

1 parent 6548deb6
......@@ -85,6 +85,17 @@ public class IDeviceServiceImpl extends MPJBaseServiceImpl<DeviceMapper, Device>
return "该操作仅支持设备入库";
}
var userId = dtoList.getFirst().getUserId();
// 检查设备序列号是否已存在
var existDevice = this.lambdaQuery()
.in(Device::getSerialNum, dtoList.stream().map(DeviceDTO::getSerialNum).toList())
.list();
if (CollUtil.isNotEmpty(existDevice)) {
return existDevice.stream()
.map(Device::getSerialNum)
.collect(Collectors.joining(",", "设备序列号已存在:", ""));
}
var deviceList = converter.convert(dtoList, Device.class);
if (this.saveBatch(deviceList)) {
var logList = deviceList.stream()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!