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