1
0

3 Commits

Author SHA1 Message Date
f2921ff12f 分页查询设备-设备类型 2025-07-19 09:17:14 +08:00
ec89dd8c1e 新增设备 校验 2025-07-18 18:12:36 +08:00
57322c9c87 蓝牙名称 2025-07-18 17:57:58 +08:00
2 changed files with 19 additions and 1 deletions

View File

@ -58,7 +58,9 @@ public class DeviceExcelImportDTO {
private String remark;
@ExcelProperty("设备类型名称")
@ColumnWidth(20)
private String typeName;
@ExcelProperty("蓝牙名称")
private String bluetoothName;
}

View File

@ -101,6 +101,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
public TableDataInfo<Device> queryAll(DeviceQueryCriteria criteria, Page<Device> page) throws IOException {
criteria.setCurrentOwnerId(LoginHelper.getUserId());
if (criteria.getDeviceType() != null) {
DeviceTypeGrants deviceTypeGrant = deviceTypeGrantsMapper.selectById(criteria.getDeviceType());
if (deviceTypeGrant != null) {
criteria.setDeviceType(deviceTypeGrant.getDeviceTypeId());
}
}
IPage<Device> devices = deviceMapper.findAll(criteria, page);
List<Device> records = devices.getRecords();
@ -142,6 +148,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Override
@Transactional(rollbackFor = Exception.class)
public void addDevice(DeviceForm deviceForm) throws Exception {
Device device1 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_mac", deviceForm.getDeviceMac()));
if (device1 != null) {
throw new BadRequestException("设备MAC已存在");
}
Device device2 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_imei", deviceForm.getDeviceImei()));
if (device2 != null) {
throw new BadRequestException("设备IMEI已存在");
}
DeviceTypeQueryCriteria queryCriteria = new DeviceTypeQueryCriteria();
queryCriteria.setDeviceTypeId(deviceForm.getDeviceType());
queryCriteria.setCustomerId(LoginHelper.getUserId());