|
@@ -1,13 +1,35 @@
|
|
|
package com.sky.ioc.service.device.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.sky.ioc.entity.domain.device.DeviceType;
|
|
|
+import com.sky.ioc.mapper.device.DeviceTypeMapper;
|
|
|
import com.sky.ioc.service.device.DeviceTypeService;
|
|
|
import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Service
|
|
|
public class DeviceTypeServiceImpl implements DeviceTypeService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ DeviceTypeMapper deviceTypeMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public ReturnMsg batchDel(String device_ids, String device_type_id) {
|
|
|
- return null;
|
|
|
+ if (StringUtils.isNotBlank(device_ids)&&StringUtils.isNotBlank(device_type_id)){
|
|
|
+ DeviceType deviceType = deviceTypeMapper.selectById(device_type_id);
|
|
|
+ if(deviceType!=null){
|
|
|
+ String res = deviceType.getDevice_ids();
|
|
|
+ JSONArray ids = JSON.parseArray(device_ids);
|
|
|
+ JSONArray array = JSON.parseArray(res);
|
|
|
+ array.removeAll(ids);
|
|
|
+ deviceTypeMapper.updateById(deviceType);
|
|
|
+ }
|
|
|
+ return ReturnMsg.ok();
|
|
|
+ }else{
|
|
|
+ return ReturnMsg.fail("设备id和设备类别不能为空");
|
|
|
+ }
|
|
|
}
|
|
|
}
|