|
|
@ -88,6 +88,17 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
public int insertHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
|
|
|
|
//判断同一场景下模型名称是否重复
|
|
|
|
|
|
|
|
String deviceModeName = hwDeviceMode.getDeviceModeName();
|
|
|
|
|
|
|
|
Long sceneId = hwDeviceMode.getSceneId();
|
|
|
|
|
|
|
|
HwDeviceMode queryDeviceMode = new HwDeviceMode();
|
|
|
|
|
|
|
|
queryDeviceMode.setDeviceModeName(deviceModeName);
|
|
|
|
|
|
|
|
queryDeviceMode.setSceneId(sceneId);
|
|
|
|
|
|
|
|
List<HwDeviceMode> deviceModes = hwDeviceModeMapper.selectHwDeviceModeList(queryDeviceMode);
|
|
|
|
|
|
|
|
if (deviceModes != null && !deviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此场景下设备模型名称重复");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//先判断是否有重复的标识符
|
|
|
|
//先判断是否有重复的标识符
|
|
|
|
List<HwDeviceModeFunction> hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList();
|
|
|
|
List<HwDeviceModeFunction> hwDeviceModeFunctionList = hwDeviceMode.getHwDeviceModeFunctionList();
|
|
|
|
|
|
|
|
|
|
|
@ -135,6 +146,22 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
public int updateHwDeviceMode(HwDeviceMode hwDeviceMode) {
|
|
|
|
|
|
|
|
String deviceModeName = hwDeviceMode.getDeviceModeName();
|
|
|
|
|
|
|
|
Long sceneId = hwDeviceMode.getSceneId();
|
|
|
|
|
|
|
|
HwDeviceMode queryDeviceMode = new HwDeviceMode();
|
|
|
|
|
|
|
|
queryDeviceMode.setDeviceModeName(deviceModeName);
|
|
|
|
|
|
|
|
queryDeviceMode.setSceneId(sceneId);
|
|
|
|
|
|
|
|
List<HwDeviceMode> deviceModes = hwDeviceModeMapper.selectHwDeviceModeList(queryDeviceMode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (deviceModes != null && !deviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
List<HwDeviceMode> filterDeviceModes = deviceModes.stream().filter(hwDm -> !hwDm.getDeviceModeId().equals(hwDeviceMode.getDeviceModeId())
|
|
|
|
|
|
|
|
&& hwDm.getDeviceModeName().equals(hwDeviceMode.getDeviceModeName())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (filterDeviceModes != null && !filterDeviceModes.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此场景下设备模型名称重复");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hwDeviceMode.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
hwDeviceMode.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
hwDeviceMode.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
hwDeviceMode.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
// hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId());
|
|
|
|
// hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeId(hwDeviceMode.getDeviceModeId());
|
|
|
@ -364,7 +391,7 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 重建所有设备模型的超级表
|
|
|
|
* 重建所有设备模型的超级表(创建超级表,将所有设备模型中没有创建超级表的创建一下,已经创建过的不需要再创建)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @description
|
|
|
|
* @description
|
|
|
|
* @author xins
|
|
|
|
* @author xins
|
|
|
|