|
@@ -266,18 +266,15 @@ public class TDeviceListServiceImpl implements ITDeviceListService {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public int deleteTDeviceListByIds(Integer[] ids) {
|
|
|
- List<TDeviceList> tDeviceLists = tDeviceListMapper.selectTDeviceList();
|
|
|
- if (StringUtils.isNotEmpty(ids)) {
|
|
|
- for (Integer id : ids) {
|
|
|
- for (TDeviceList tDevice : tDeviceLists) {
|
|
|
- if (tDevice.getId().equals(id)) {
|
|
|
- TFacility tFacility = tFacilityMapper.selectTFacilityByCode(tDevice.getDeviceId());
|
|
|
- if (StringUtils.isNotNull(tFacility)) {
|
|
|
- tFacilityMapper.deleteTFacilityById(tFacility.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (ids == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ for (Integer id : ids) {
|
|
|
+ TDeviceList deviceList = tDeviceListMapper.selectTDeviceListById(id);
|
|
|
+ if (deviceList != null && deviceList.getDeviceId() != null && !StringUtils.isEmpty(deviceList.getDeviceId())) {
|
|
|
+ tFacilityMapper.deleteTFacilityByCode(deviceList.getDeviceId());
|
|
|
}
|
|
|
}
|
|
|
return tDeviceListMapper.deleteTDeviceListByIds(ids);
|