|
@@ -4,8 +4,10 @@ import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.IotInfoMapper;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -34,6 +36,8 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
private IotInfoMapper iotInfoMapper;
|
|
private IotInfoMapper iotInfoMapper;
|
|
@Resource
|
|
@Resource
|
|
private IotInfoClassifyService iotInfoClassifyService;
|
|
private IotInfoClassifyService iotInfoClassifyService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IotTreeService iotTreeService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Long createIotInfo(IotInfoSaveReqVO createReqVO) {
|
|
public Long createIotInfo(IotInfoSaveReqVO createReqVO) {
|
|
@@ -77,6 +81,25 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
public PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO) {
|
|
public PageResult<IotInfoDO> getIotInfoPage(IotInfoPageReqVO pageReqVO) {
|
|
return iotInfoMapper.selectPage(pageReqVO, getInfoCondition(pageReqVO.getClassId()));
|
|
return iotInfoMapper.selectPage(pageReqVO, getInfoCondition(pageReqVO.getClassId()));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public PageResult<IotInfoDO> getIotInfoFilePage(IotInfoPageReqVO pageReqVO) {
|
|
|
|
+ return iotInfoMapper.selectPage(pageReqVO, getInfoFileCondition(pageReqVO.getClassId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Set<Long> getInfoFileCondition(Long classId) {
|
|
|
|
+ if (Objects.isNull(classId)) {
|
|
|
|
+ return Collections.emptySet();
|
|
|
|
+ }
|
|
|
|
+ IotTreeDO iotTree = iotTreeService.getIotTree(classId);
|
|
|
|
+ if (Objects.isNull(iotTree)) {
|
|
|
|
+ throw exception(IOT_INFO_NOT_EXISTS);
|
|
|
|
+ }
|
|
|
|
+ Set<Long> fileIds = convertSet(iotTreeService.getChildTreeList(classId), IotTreeDO::getOriginId);
|
|
|
|
+ fileIds.add(iotTree.getOriginId()); // 包括自身
|
|
|
|
+ return fileIds;
|
|
|
|
+ }
|
|
|
|
+
|
|
private Set<Long> getInfoCondition(Long classId) {
|
|
private Set<Long> getInfoCondition(Long classId) {
|
|
if (classId == null) {
|
|
if (classId == null) {
|
|
return Collections.emptySet();
|
|
return Collections.emptySet();
|
|
@@ -85,4 +108,6 @@ public class IotInfoServiceImpl implements IotInfoService {
|
|
deptIds.add(classId); // 包括自身
|
|
deptIds.add(classId); // 包括自身
|
|
return deptIds;
|
|
return deptIds;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|