设备修改

This commit is contained in:
周俊杰
2023-03-21 20:35:03 +08:00
parent 8b49295639
commit 6fe15cf71d

View File

@@ -53,16 +53,6 @@ public class DeviceServiceImpl implements DeviceService {
return null;
}
@Override
public DeviceDto findById(String device_code) {
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
JSONObject json = wo.query("device_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)){
return json.toJavaObject( DeviceDto.class);
}
return null;
}
@Override
public DeviceDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
@@ -94,7 +84,7 @@ public class DeviceServiceImpl implements DeviceService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(DeviceDto dto) {
DeviceDto entity = this.findById(dto.getDevice_code());
DeviceDto entity = this.findByCode(dto.getDevice_code());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUserId = SecurityUtils.getCurrentUserId();
@@ -121,19 +111,9 @@ public class DeviceServiceImpl implements DeviceService {
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
for (String device_code: ids) {
JSONObject param = new JSONObject();
param.put("device_code", String.valueOf(device_code));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", DateUtil.now());
wo.update(param);
wo.delete("device_code = '" + device_code + "'");
}
}