|
|
@@ -0,0 +1,79 @@
|
|
|
+package com.sckw.slope.detection.service;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.sckw.core.common.enums.NumberConstant;
|
|
|
+import com.sckw.core.exception.BusinessException;
|
|
|
+import com.sckw.core.model.page.PageRes;
|
|
|
+import com.sckw.core.utils.IdWorker;
|
|
|
+import com.sckw.core.utils.StringUtils;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
+import com.sckw.slope.detection.dao.mysql.KwsProjectDeviceMapper;
|
|
|
+import com.sckw.slope.detection.dao.mysql.KwsDeviceMapper;
|
|
|
+import com.sckw.slope.detection.model.dos.mysql.KwsProject;
|
|
|
+import com.sckw.slope.detection.model.dos.mysql.KwsProjectDevice;
|
|
|
+import com.sckw.slope.detection.model.dto.BaseItemDTO;
|
|
|
+import com.sckw.slope.detection.model.dto.IntegrationItemDTO;
|
|
|
+import com.sckw.slope.detection.model.dto.ProjectAddDTO;
|
|
|
+import com.sckw.slope.detection.model.dto.ProjectUpdateDTO;
|
|
|
+import com.sckw.slope.detection.model.param.DeviceQueryDto;
|
|
|
+import com.sckw.slope.detection.model.param.ProjectQueryDto;
|
|
|
+import com.sckw.slope.detection.model.vo.DeviceVo;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author sky
|
|
|
+ * @description 项目service
|
|
|
+ * @date 2023-10-30 13:10:50
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class DeviceService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ KwsDeviceMapper deviceMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ KwsProjectDeviceMapper projectDeviceMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增项目
|
|
|
+ *
|
|
|
+ * @param projectAddDto 请求参数
|
|
|
+ * @param response http流
|
|
|
+ * @return 返回值
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目管理分页查询
|
|
|
+ *
|
|
|
+ * @param deviceQueryDto 请求分页
|
|
|
+ * @param response http流
|
|
|
+ * @return 返回值
|
|
|
+ */
|
|
|
+ public PageRes select(DeviceQueryDto deviceQueryDto, HttpResponse response) {
|
|
|
+ PageHelper.startPage(deviceQueryDto.getPage(), deviceQueryDto.getPageSize());
|
|
|
+ List<DeviceVo> list = deviceMapper.selectByDeviceParam(deviceQueryDto);
|
|
|
+ PageInfo<DeviceVo> pageInfo = new PageInfo<>(list);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return PageRes.build(pageInfo, list);
|
|
|
+ }
|
|
|
+ for (DeviceVo vo : list) {
|
|
|
+ //vo.setDeviceTotal(projectDeviceMapper.selectCount(new LambdaQueryWrapper<KwsProjectDevice>().eq(KwsProjectDevice::getProjectId, vo.getId())));
|
|
|
+ }
|
|
|
+ return PageRes.build(pageInfo, list);
|
|
|
+ }
|
|
|
+}
|