Commit be1663db by 吕明尚

Merge branch 'dev' into test

parents 6cefa550 5ba32614
......@@ -18,6 +18,7 @@ import share.common.core.page.TableSupport;
import share.common.enums.DeviceOpSourceEnum;
import share.common.enums.DeviceType;
import share.common.enums.OpTypeEnum;
import share.common.exception.base.BaseException;
import share.common.utils.DateUtils;
import share.common.utils.SecurityUtils;
import share.system.domain.*;
......@@ -89,6 +90,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
*/
@Override
public int insertDevice(Device device) {
if (!device.getDevMac().equals(device.getDevId())) throw new BaseException("设备MAC和设备ID不一致");
//设备唯一性校验
if (ObjectUtil.isNotEmpty(deviceMapper.selectDeviceByDevId(device.getDevId()))) {
throw new BaseException("设备已存在,请更换设备");
}
device.setCreateTime(DateUtils.getNowDate());
device.setCreateBy(SecurityUtils.getUsername());
return deviceMapper.insertDevice(device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment