|
|
@@ -1,22 +1,23 @@
|
|
|
package cn.iocoder.yudao.module.pms.service.qhse.danger;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.danger.vo.IotDangerSourcePageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.danger.vo.IotDangerSourceSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.danger.IotDangerSourceDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.danger.IotDangerSourceMapper;
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
-
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
|
|
/**
|
|
|
@@ -30,6 +31,8 @@ public class IotDangerSourceServiceImpl implements IotDangerSourceService {
|
|
|
|
|
|
@Resource
|
|
|
private IotDangerSourceMapper iotDangerSourceMapper;
|
|
|
+ @Autowired
|
|
|
+ private DeptService deptService;
|
|
|
|
|
|
@Override
|
|
|
public Long createIotDangerSource(IotDangerSourceSaveReqVO createReqVO) {
|
|
|
@@ -71,7 +74,12 @@ public class IotDangerSourceServiceImpl implements IotDangerSourceService {
|
|
|
|
|
|
@Override
|
|
|
public PageResult<IotDangerSourceDO> getIotDangerSourcePage(IotDangerSourcePageReqVO pageReqVO) {
|
|
|
- return iotDangerSourceMapper.selectPage(pageReqVO);
|
|
|
+ Set<Long> ids = new HashSet<>();
|
|
|
+ if (Objects.nonNull(pageReqVO.getDeptId())) {
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
+ ids.add(pageReqVO.getDeptId());
|
|
|
+ }
|
|
|
+ return iotDangerSourceMapper.selectPage(pageReqVO, ids);
|
|
|
}
|
|
|
|
|
|
}
|