新增设备:蓝牙名称 必填校验
This commit is contained in:
@ -148,6 +148,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addDevice(DeviceForm deviceForm) throws Exception {
|
||||
|
||||
if (deviceForm.getDeviceMac() != null && deviceForm.getBluetoothName() == null) {
|
||||
throw new BadRequestException("请填写蓝牙名称!!!");
|
||||
}
|
||||
|
||||
Device device1 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_mac", deviceForm.getDeviceMac()));
|
||||
if (device1 != null) {
|
||||
throw new BadRequestException("设备MAC已存在!!!");
|
||||
@ -178,6 +182,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
|
||||
// 转换对象并插入数据库
|
||||
Device device = new Device();
|
||||
|
||||
BeanUtil.copyProperties(deviceForm, device, true);
|
||||
device.setDeviceNo(createDeviceNo());
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
|
Reference in New Issue
Block a user