Просмотр исходного кода

1.新增公共controller
2.新增项目管理模块代码

lengfaqiang 2 лет назад
Родитель
Сommit
8a93de3c9e
29 измененных файлов с 961 добавлено и 504 удалено
  1. 1 1
      pom.xml
  2. 20 0
      slope-common/slope-common-core/src/main/java/com/sckw/core/utils/OkHttpUtils.java
  3. 6 0
      slope-modules/slope-detection/pom.xml
  4. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/AlarmController.java
  5. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceController.java
  6. 38 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/HttpDemoController.java
  7. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/IntegrationController.java
  8. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/LogController.java
  9. 78 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ProjectController.java
  10. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ReportController.java
  11. 17 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ThresholdController.java
  12. 9 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsProjectDeviceMapper.java
  13. 10 9
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsProjectMapper.java
  14. 5 5
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsProject.java
  15. 24 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/BaseItemDTO.java
  16. 23 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/IntegrationItemDTO.java
  17. 86 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/ProjectAddDTO.java
  18. 90 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/ProjectUpdateDTO.java
  19. 21 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/ProjectQueryDto.java
  20. 115 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectVo.java
  21. 134 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/ProjectService.java
  22. 87 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/api/DetectionApiService.java
  23. 7 0
      slope-modules/slope-detection/src/main/resources/bootstrap.yml
  24. 1 1
      slope-modules/slope-detection/src/main/resources/log4j2.xml
  25. 0 186
      slope-modules/slope-detection/src/main/resources/mapper/KwsIntegrationMapper.xml
  26. 0 0
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceIntegrationMapper.xml
  27. 35 22
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml
  28. 55 0
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectDeviceMapper.xml
  29. 14 280
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectMapper.xml

+ 1 - 1
pom.xml

@@ -15,7 +15,7 @@
     <modules>
     <modules>
         <module>slope-common</module>
         <module>slope-common</module>
         <module>slope-modules</module>
         <module>slope-modules</module>
-        <!--        <module>slope-modules-api</module>-->
+<!--        <module>slope-modules-api</module>-->
     </modules>
     </modules>
     <packaging>pom</packaging>
     <packaging>pom</packaging>
 
 

+ 20 - 0
slope-common/slope-common-core/src/main/java/com/sckw/core/utils/OkHttpUtils.java

@@ -240,6 +240,26 @@ public class OkHttpUtils {
         return urlBuilder.toString();
         return urlBuilder.toString();
     }
     }
 
 
+    private String buildUrlAndParaMap(String url, Map<String, String> paraMap) {
+        StringBuilder urlBuilder = new StringBuilder(url);
+        if (paraMap != null) {
+            urlBuilder.append("?");
+            try {
+                for (Map.Entry<String, String> entry : paraMap.entrySet()) {
+                    urlBuilder.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8)).
+                            append("=").
+                            append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8)).
+                            append("&");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            urlBuilder.deleteCharAt(urlBuilder.length() - 1);
+        }
+        log.info("请求地址:\n" + urlBuilder.toString());
+        return urlBuilder.toString();
+    }
+
     /**
     /**
      * 文件下载同步请求
      * 文件下载同步请求
      *
      *

+ 6 - 0
slope-modules/slope-detection/pom.xml

@@ -56,6 +56,12 @@
             <version>1.0.0</version>
             <version>1.0.0</version>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>com.sckw</groupId>
+            <artifactId>slope-detection-api</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+
         <dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
             <artifactId>spring-web</artifactId>

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/AlarmController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 报警Controller
+ * @date 2023-10-30 17:10:29
+ */
+@Slf4j
+@RestController
+@RequestMapping("/alarm")
+public class AlarmController {
+
+}

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/DeviceController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 设备controller
+ * @date 2023-10-30 17:10:24
+ */
+@Slf4j
+@RestController
+@RequestMapping("/device")
+public class DeviceController {
+
+}

+ 38 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/HttpDemoController.java

@@ -0,0 +1,38 @@
+package com.sckw.slope.detection.controller;
+
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.slope.detection.service.api.DetectionApiService;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description httpDemo
+ * @date 2023-10-30 09:10:08
+ */
+@RestController
+@RequestMapping("/http")
+public class HttpDemoController {
+
+    @Autowired
+    DetectionApiService detectionApiService;
+
+    @RequestMapping(value = "/toSaasGetDemo", method = RequestMethod.GET)
+    public void httpToSaasGetDemo(HttpServletResponse response) {
+        String s= response.getHeader("a");
+        HttpResult saasGetDemo = detectionApiService.toSaasGetDemo();
+        System.out.println(saasGetDemo);
+    }
+
+
+    @RequestMapping(value = "/toSaasPostDemo", method = RequestMethod.GET)
+    public void httpToSaasPostDemo() {
+        HttpResult saasPostDemo = detectionApiService.toSaasPostDemo();
+        System.out.println(saasPostDemo);
+    }
+
+
+}

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/IntegrationController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 要素controller
+ * @date 2023-10-30 17:10:26
+ */
+@Slf4j
+@RestController
+@RequestMapping("/integration")
+public class IntegrationController {
+
+}

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/LogController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 日志Controller
+ * @date 2023-10-30 17:10:28
+ */
+@Slf4j
+@RestController
+@RequestMapping("/log")
+public class LogController {
+
+}

+ 78 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ProjectController.java

@@ -0,0 +1,78 @@
+package com.sckw.slope.detection.controller;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.sckw.core.annotation.Log;
+import com.sckw.core.annotation.RepeatSubmit;
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.slope.detection.model.dto.ProjectAddDTO;
+import com.sckw.slope.detection.model.dto.ProjectUpdateDTO;
+import com.sckw.slope.detection.model.param.ProjectQueryDto;
+import com.sckw.slope.detection.service.ProjectService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author lfdc
+ * @description 项目controller
+ * @date 2023-10-30 13:10:42
+ */
+@Slf4j
+@RestController
+@RequestMapping("/project")
+public class ProjectController {
+
+    @Autowired
+    ProjectService projectService;
+
+    @Log(description = "项目查询-分页")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目查询-分页", value = "/select", method = RequestMethod.POST)
+    public HttpResult select(@Valid @RequestBody ProjectQueryDto projectQueryDto, HttpResponse response) {
+        log.info("项目新增 select param:{}", JSONObject.toJSONString(projectQueryDto));
+        return HttpResult.ok(projectService.select(projectQueryDto, response));
+    }
+
+    @Log(description = "项目新增")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目新增", value = "/add", method = RequestMethod.POST)
+    public HttpResult projectAdd(@Valid @RequestBody ProjectAddDTO projectAddDto, HttpResponse response) {
+        log.info("项目新增 add param:{}", JSONObject.toJSONString(projectAddDto));
+        return projectService.add(projectAddDto, response);
+    }
+
+    @Log(description = "项目详情")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目详情", value = "/detail", method = RequestMethod.GET)
+    public HttpResult detail(@RequestParam("id") @NotBlank(message = "数据id不能为空") String id, HttpResponse response) {
+        log.info("项目详情 detail param:{}", id);
+        return projectService.detail(id, response);
+    }
+
+    @Log(description = "项目编辑")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目编辑", value = "/update", method = RequestMethod.POST)
+    public HttpResult update(@Valid @RequestBody ProjectUpdateDTO projectAddDto, HttpResponse response) {
+        log.info("项目编辑 update param:{}", JSONObject.toJSONString(projectAddDto));
+        return projectService.update(projectAddDto, response);
+    }
+
+    @Log(description = "项目删除")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目删除", value = "/dels", method = RequestMethod.DELETE)
+    public HttpResult dels(@RequestParam("ids") @NotBlank(message = "数据id不能为空") String ids, HttpResponse response) {
+        log.info("项目删除 delete param:{}", ids);
+        return projectService.dels(ids, response);
+    }
+
+    @Log(description = "项目监测要素项")
+    @RepeatSubmit(interval = 3000, message = "两次请求间隔未超过3秒")
+    @RequestMapping(name = "项目监测要素项", value = "/monitorItem", method = RequestMethod.GET)
+    public HttpResult monitorItem(@RequestParam("id") @NotBlank(message = "数据id不能为空") String id, HttpResponse response) {
+        log.info("项目监测要素项 select param:{}", id);
+        return projectService.monitorItem(id, response);
+    }
+}

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ReportController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 报表Controller
+ * @date 2023-10-30 17:10:27
+ */
+@Slf4j
+@RestController
+@RequestMapping("/report")
+public class ReportController {
+
+}

+ 17 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/controller/ThresholdController.java

@@ -0,0 +1,17 @@
+package com.sckw.slope.detection.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lfdc
+ * @description 阈值controller
+ * @date 2023-10-30 17:10:25
+ */
+@Slf4j
+@RestController
+@RequestMapping("/threshold")
+public class ThresholdController {
+
+}

+ 9 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsProjectDeviceMapper.java

@@ -3,7 +3,12 @@ package com.sckw.slope.detection.dao.mysql;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.slope.detection.model.dos.mysql.KwsProjectDevice;
 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 org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 
 @Mapper
 @Mapper
 @DS("mysql")
 @DS("mysql")
@@ -19,4 +24,8 @@ public interface KwsProjectDeviceMapper extends BaseMapper<KwsProjectDevice> {
     int updateByPrimaryKeySelective(KwsProjectDevice record);
     int updateByPrimaryKeySelective(KwsProjectDevice record);
 
 
     int updateByPrimaryKey(KwsProjectDevice record);
     int updateByPrimaryKey(KwsProjectDevice record);
+
+    List<BaseItemDTO> selectDataByProjectId(@Param("id") long id);
+
+    List<IntegrationItemDTO> selectIntegrationItemByProjectId(@Param("id") long id);
 }
 }

+ 10 - 9
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/mysql/KwsProjectMapper.java

@@ -3,20 +3,21 @@ package com.sckw.slope.detection.dao.mysql;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.slope.detection.model.dos.mysql.KwsProject;
 import com.sckw.slope.detection.model.dos.mysql.KwsProject;
+import com.sckw.slope.detection.model.param.ProjectQueryDto;
+import com.sckw.slope.detection.model.vo.ProjectVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
+import java.util.List;
+
 @Mapper
 @Mapper
 @DS("mysql")
 @DS("mysql")
 public interface KwsProjectMapper extends BaseMapper<KwsProject> {
 public interface KwsProjectMapper extends BaseMapper<KwsProject> {
-    int deleteByPrimaryKey(Long id);
-
-    int insert(KwsProject record);
-
-    int insertSelective(KwsProject record);
-
-    KwsProject selectByPrimaryKey(Long id);
 
 
-    int updateByPrimaryKeySelective(KwsProject record);
+    /**
+     * 分页查询
+     * @param projectQueryDto
+     * @return
+     */
+    List<ProjectVo> selectByProjectParam(ProjectQueryDto projectQueryDto);
 
 
-    int updateByPrimaryKey(KwsProject record);
 }
 }

+ 5 - 5
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsProject.java

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDateTime;
 
 
 /**
 /**
  * @author lfdc
  * @author lfdc
@@ -80,7 +80,7 @@ public class KwsProject implements Serializable {
     /**
     /**
      * 状态
      * 状态
      */
      */
-    private Byte status;
+    private int status;
 
 
     /**
     /**
      * 创建人
      * 创建人
@@ -90,7 +90,7 @@ public class KwsProject implements Serializable {
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */
-    private Date createTime;
+    private LocalDateTime createTime;
 
 
     /**
     /**
      * 修改人
      * 修改人
@@ -100,13 +100,13 @@ public class KwsProject implements Serializable {
     /**
     /**
      * 修改时间
      * 修改时间
      */
      */
-    private Date updateTime;
+    private LocalDateTime updateTime;
 
 
     /**
     /**
      * 删除标识
      * 删除标识
      */
      */
     @TableLogic(value = "0")
     @TableLogic(value = "0")
-    private Byte delFlag;
+    private int delFlag;
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 }
 }

+ 24 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/BaseItemDTO.java

@@ -0,0 +1,24 @@
+package com.sckw.slope.detection.model.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 基础要素
+ * @date 2023-10-30 17:10:01
+ */
+@Data
+public class BaseItemDTO implements Serializable {
+
+    /**
+     * 设备型号名称
+     */
+    private String name;
+
+    /**
+     * 要素名
+     */
+    private String partName;
+}

+ 23 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/IntegrationItemDTO.java

@@ -0,0 +1,23 @@
+package com.sckw.slope.detection.model.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 集成要素
+ * @date 2023-10-30 17:10:10
+ */
+@Data
+public class IntegrationItemDTO implements Serializable {
+    /**
+     * 集成要素id
+     */
+    private String integrationId;
+
+    /**
+     * 集成要素名
+     */
+    private String integrationName;
+}

+ 86 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/ProjectAddDTO.java

@@ -0,0 +1,86 @@
+package com.sckw.slope.detection.model.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 新建项目dto
+ * @date 2023-10-30 13:10:38
+ */
+@Data
+public class ProjectAddDTO implements Serializable {
+
+    /**
+     * 项目名
+     */
+    @NotBlank(message = "项目名不能为空")
+    private String name;
+
+    /**
+     * 项目区域
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String fence;
+
+    /**
+     * 所属矿山id
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String mountainId;
+
+    /**
+     * 所属矿山名
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String mountainName;
+
+    /**
+     * 省级平台名
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String platformName;
+
+    /**
+     * 省级平台地址(url)
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String platformAddress;
+
+    /**
+     * 设计单位名
+     */
+    private String designCompany;
+
+    /**
+     * 设计单位联系人
+     */
+    private String designContacts;
+
+    /**
+     * 设计单位联系人电话
+     */
+    private String designPhone;
+
+    /**
+     * 施工单位名
+     */
+    private String buildCompany;
+
+    /**
+     * 施工单位联系人
+     */
+    private String buildContacts;
+
+    /**
+     * 施工单位联系人电话
+     */
+    private String buildPhone;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 90 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dto/ProjectUpdateDTO.java

@@ -0,0 +1,90 @@
+package com.sckw.slope.detection.model.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 新建项目dto
+ * @date 2023-10-30 13:10:38
+ */
+@Data
+public class ProjectUpdateDTO implements Serializable {
+
+    /**
+     * 项目id
+     */
+    private  String id;
+    /**
+     * 项目名
+     */
+    @NotBlank(message = "项目名不能为空")
+    private String name;
+
+    /**
+     * 项目区域
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String fence;
+
+    /**
+     * 所属矿山id
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String mountainId;
+
+    /**
+     * 所属矿山名
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String mountainName;
+
+    /**
+     * 省级平台名
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String platformName;
+
+    /**
+     * 省级平台地址(url)
+     */
+    @NotBlank(message = "项目区域不能为空")
+    private String platformAddress;
+
+    /**
+     * 设计单位名
+     */
+    private String designCompany;
+
+    /**
+     * 设计单位联系人
+     */
+    private String designContacts;
+
+    /**
+     * 设计单位联系人电话
+     */
+    private String designPhone;
+
+    /**
+     * 施工单位名
+     */
+    private String buildCompany;
+
+    /**
+     * 施工单位联系人
+     */
+    private String buildContacts;
+
+    /**
+     * 施工单位联系人电话
+     */
+    private String buildPhone;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 21 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/ProjectQueryDto.java

@@ -0,0 +1,21 @@
+package com.sckw.slope.detection.model.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lfdc
+ * @description 分页查询项目dto
+ * @date 2023-10-30 13:10:38
+ */
+@Data
+public class ProjectQueryDto implements Serializable {
+
+
+    private String name;
+
+    private int page;
+
+    private int pageSize;
+}

+ 115 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectVo.java

@@ -0,0 +1,115 @@
+package com.sckw.slope.detection.model.vo;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author lfdc
+ * @description vo
+ * @date 2023-10-30 13:10:38
+ */
+@Data
+public class ProjectVo implements Serializable {
+    private Long id;
+
+    /**
+     * 项目名
+     */
+    private String name;
+
+    /**
+     * 设备数量
+     */
+    private Long deviceTotal;
+
+    /**
+     * 所属矿山id
+     */
+    private String mountainId;
+
+    /**
+     * 所属矿山名
+     */
+    private String mountainName;
+
+    /**
+     * 省级平台名
+     */
+    private String platformName;
+
+    /**
+     * 省级平台地址(url)
+     */
+    private String platformAddress;
+
+    /**
+     * 设计单位名
+     */
+    private String designCompany;
+
+    /**
+     * 设计单位联系人
+     */
+    private String designContacts;
+
+    /**
+     * 设计单位联系人电话
+     */
+    private String designPhone;
+
+    /**
+     * 施工单位名
+     */
+    private String buildCompany;
+
+    /**
+     * 施工单位联系人
+     */
+    private String buildContacts;
+
+    /**
+     * 施工单位联系人电话
+     */
+    private String buildPhone;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态
+     */
+    private int status;
+
+    /**
+     * 创建人
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 修改人
+     */
+    private Long updateBy;
+
+    /**
+     * 修改时间
+     */
+    private LocalDateTime updateTime;
+
+    /**
+     * 删除标识
+     */
+    @TableLogic(value = "0")
+    private int delFlag;
+
+    private static final long serialVersionUID = 1L;
+}

+ 134 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/ProjectService.java

@@ -0,0 +1,134 @@
+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.KwsProjectMapper;
+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.ProjectQueryDto;
+import com.sckw.slope.detection.model.vo.ProjectVo;
+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 lfdc
+ * @description 项目service
+ * @date 2023-10-30 13:10:50
+ */
+@Slf4j
+@Service
+public class ProjectService {
+
+    @Autowired
+    KwsProjectMapper projectMapper;
+
+    @Autowired
+    KwsProjectDeviceMapper projectDeviceMapper;
+
+    /**
+     * 新增项目
+     *
+     * @param projectAddDto 请求参数
+     * @param response      http流
+     * @return 返回值
+     */
+    @Transactional
+    public HttpResult add(ProjectAddDTO projectAddDto, HttpResponse response) {
+        KwsProject project = new KwsProject();
+        BeanUtils.copyProperties(projectAddDto, project);
+        project.setId(new IdWorker(NumberConstant.ONE).nextId());
+        project.setStatus(NumberConstant.ZERO);
+        project.setCreateBy(0L);
+        LocalDateTime now = LocalDateTime.now();
+        project.setCreateTime(now);
+        project.setUpdateBy(0L);
+        project.setUpdateTime(now);
+        projectMapper.insert(project);
+        return HttpResult.ok();
+    }
+
+    /**
+     * 项目管理分页查询
+     *
+     * @param projectQueryDto 请求分页
+     * @param response        http流
+     * @return 返回值
+     */
+    public PageRes select(ProjectQueryDto projectQueryDto, HttpResponse response) {
+        PageHelper.startPage(projectQueryDto.getPage(), projectQueryDto.getPageSize());
+        List<ProjectVo> list = projectMapper.selectByProjectParam(projectQueryDto);
+        PageInfo<ProjectVo> pageInfo = new PageInfo<>(list);
+        if (CollectionUtils.isEmpty(list)) {
+            return PageRes.build(pageInfo, list);
+        }
+        for (ProjectVo vo : list) {
+            vo.setDeviceTotal(projectDeviceMapper.selectCount(new LambdaQueryWrapper<KwsProjectDevice>().eq(KwsProjectDevice::getProjectId, vo.getId())));
+        }
+        return PageRes.build(pageInfo, list);
+    }
+
+    public HttpResult detail(String id, HttpResponse response) {
+        KwsProject project = projectMapper.selectOne(new LambdaQueryWrapper<KwsProject>()
+                .eq(KwsProject::getId, id));
+        ProjectVo vo = new ProjectVo();
+        BeanUtils.copyProperties(project, vo);
+        return HttpResult.ok(vo);
+    }
+
+    @Transactional
+    public HttpResult update(ProjectUpdateDTO projectAddDto, HttpResponse response) {
+        KwsProject project = new KwsProject();
+        BeanUtils.copyProperties(projectAddDto, project);
+        project.setId(new IdWorker(NumberConstant.ONE).nextId());
+        project.setStatus(NumberConstant.ZERO);
+        project.setCreateBy(0L);
+        LocalDateTime now = LocalDateTime.now();
+        project.setCreateTime(now);
+        project.setUpdateBy(0L);
+        project.setUpdateTime(now);
+        projectMapper.updateById(project);
+        return HttpResult.ok();
+    }
+
+    @Transactional
+    public HttpResult dels(String ids, HttpResponse response) {
+        List<Long> list = StringUtils.splitStrToList(ids, Long.class);
+        int update = projectMapper.update(null, new LambdaUpdateWrapper<KwsProject>().in(KwsProject::getId, list).set(KwsProject::getDelFlag, "1"));
+        if (update < 1) {
+            throw new BusinessException("删除失败");
+        }
+        return HttpResult.ok();
+    }
+
+    public HttpResult monitorItem(String id, HttpResponse response) {
+        //查询基本要素
+        List<BaseItemDTO> baseItem = projectDeviceMapper.selectDataByProjectId(Long.parseLong(id));
+        List<IntegrationItemDTO> integrationItem = projectDeviceMapper.selectIntegrationItemByProjectId(Long.parseLong(id));
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("baseItem",baseItem);
+        jsonObject.put("integrationItem",integrationItem);
+        return HttpResult.ok(jsonObject);
+    }
+}

+ 87 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/api/DetectionApiService.java

@@ -0,0 +1,87 @@
+package com.sckw.slope.detection.service.api;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.OkHttpUtils;
+import com.sckw.core.web.response.HttpResult;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * @author lfdc
+ * @description 对外请求接口地址
+ * @date 2023-10-30 08:10:40
+ */
+@Slf4j
+@Service
+@Component
+public class DetectionApiService {
+
+    private String okHttpClientUrl = "http://10.10.10.220";
+
+    public HttpResult toSaasPostDemo() {
+        OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(okHttpClientUrl + "/api/menu/getMenu");
+        okHttpUtils.addHeader("adminid", "4f98414ac8411d85b45146659780c4aa6e104347");
+        Map<String, Object> para = new HashMap<>();
+        if (!CollectionUtils.isEmpty(para)) {
+            for (Map.Entry<String, Object> p : para.entrySet()) {
+                //跳过非空参数
+                Object v = p.getValue();
+                String k = p.getKey();
+                if (Objects.isNull(v)) {
+                    continue;
+                }
+                okHttpUtils.addBodyPara(k, JSONObject.toJSONString(v));
+            }
+        }
+        String sync;
+        try {
+            sync = okHttpUtils.post(true).sync();
+        } catch (Exception e) {
+            log.error("http post error ", e.getCause());
+            throw new RuntimeException("http post error异常!");
+        }
+        JSONObject parse = new JSONObject();
+        if (StringUtils.isNotBlank(sync)) {
+            parse = JSONObject.parse(sync);
+        }
+        log.info("返回值->{}", sync);
+        return HttpResult.ok(parse);
+    }
+
+
+    public HttpResult toSaasGetDemo() {
+        OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(okHttpClientUrl);
+        Map<String, Object> para = new HashMap<>();
+        if (!CollectionUtils.isEmpty(para)) {
+            for (Map.Entry<String, Object> p : para.entrySet()) {
+                //跳过非空参数
+                Object v = p.getValue();
+                String k = p.getKey();
+                if (Objects.isNull(v)) {
+                    continue;
+                }
+                okHttpUtils.addBodyPara(k, JSONObject.toJSONString(v));
+            }
+        }
+        String sync;
+        try {
+            sync = OkHttpUtils.builder().url(okHttpClientUrl + "/api/admin/getUserInfo").addHeader("adminid", "4f98414ac8411d85b45146659780c4aa6e104347").get().sync();
+        } catch (Exception e) {
+            log.error("http get error ", e.getCause());
+            throw new RuntimeException("http get error 异常!");
+        }
+        JSONObject parse = new JSONObject();
+        if (StringUtils.isNotBlank(sync)) {
+            parse = JSONObject.parse(sync);
+        }
+        log.info("返回值->{}", sync);
+        return HttpResult.ok(parse);
+    }
+}

+ 7 - 0
slope-modules/slope-detection/src/main/resources/bootstrap.yml

@@ -10,3 +10,10 @@ spring:
   main:
   main:
     allow-bean-definition-overriding: true
     allow-bean-definition-overriding: true
     allow-circular-references: true
     allow-circular-references: true
+
+mybatis-plus:
+#  mapper-locations: classpath*:/mapper/*/*.xml    #扫描xml文件
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.sckw.*.model.dos.mysql,com.sckw.*.model.dos.tdengine
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 1 - 1
slope-modules/slope-detection/src/main/resources/log4j2.xml

@@ -7,7 +7,7 @@
                   value="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %X{traceId} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%t]}{faint} %clr{%c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx"/>
                   value="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %X{traceId} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%t]}{faint} %clr{%c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx"/>
         <property name="LOG_WITHOUT_COLOR_PATTERN"
         <property name="LOG_WITHOUT_COLOR_PATTERN"
                   value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %X{traceId} ${sys:PID}--- [%t] %c{1.} : %m%n%xwEx"/>
                   value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %X{traceId} ${sys:PID}--- [%t] %c{1.} : %m%n%xwEx"/>
-        <property name="LOG_PATH" value="logs/sckw-transport"/>
+        <property name="LOG_PATH" value="logs/slope-detection"/>
     </properties>
     </properties>
     <!--DEBUG<INFO<WARNING<ERROR<CRITICAL-->
     <!--DEBUG<INFO<WARNING<ERROR<CRITICAL-->
     <!-- 先定义所有的appender(附加器)-->
     <!-- 先定义所有的appender(附加器)-->

+ 0 - 186
slope-modules/slope-detection/src/main/resources/mapper/KwsIntegrationMapper.xml

@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.sckw.slope.detection.dao.KwsIntegrationMapper">
-  <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
-    <!--@mbg.generated-->
-    <!--@Table kws_integration-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="integration_name" jdbcType="VARCHAR" property="integrationName" />
-    <result column="part_names" jdbcType="VARCHAR" property="partNames" />
-    <result column="unit" jdbcType="VARCHAR" property="unit" />
-    <result column="formula" jdbcType="VARCHAR" property="formula" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <result column="status" jdbcType="TINYINT" property="status" />
-    <result column="create_by" jdbcType="BIGINT" property="createBy" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, integration_name, part_names, unit, formula, remark, `status`, create_by, create_time, 
-    update_by, update_time, del_flag
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from kws_integration
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from kws_integration
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
-    <!--@mbg.generated-->
-    insert into kws_integration (id, integration_name, part_names, 
-      unit, formula, remark, 
-      `status`, create_by, create_time, 
-      update_by, update_time, del_flag
-      )
-    values (#{id,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, #{partNames,jdbcType=VARCHAR}, 
-      #{unit,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
-      #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
-      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
-    <!--@mbg.generated-->
-    insert into kws_integration
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="integrationName != null">
-        integration_name,
-      </if>
-      <if test="partNames != null">
-        part_names,
-      </if>
-      <if test="unit != null">
-        unit,
-      </if>
-      <if test="formula != null">
-        formula,
-      </if>
-      <if test="remark != null">
-        remark,
-      </if>
-      <if test="status != null">
-        `status`,
-      </if>
-      <if test="createBy != null">
-        create_by,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="updateBy != null">
-        update_by,
-      </if>
-      <if test="updateTime != null">
-        update_time,
-      </if>
-      <if test="delFlag != null">
-        del_flag,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="integrationName != null">
-        #{integrationName,jdbcType=VARCHAR},
-      </if>
-      <if test="partNames != null">
-        #{partNames,jdbcType=VARCHAR},
-      </if>
-      <if test="unit != null">
-        #{unit,jdbcType=VARCHAR},
-      </if>
-      <if test="formula != null">
-        #{formula,jdbcType=VARCHAR},
-      </if>
-      <if test="remark != null">
-        #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=TINYINT},
-      </if>
-      <if test="createBy != null">
-        #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        #{delFlag,jdbcType=TINYINT},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
-    <!--@mbg.generated-->
-    update kws_integration
-    <set>
-      <if test="integrationName != null">
-        integration_name = #{integrationName,jdbcType=VARCHAR},
-      </if>
-      <if test="partNames != null">
-        part_names = #{partNames,jdbcType=VARCHAR},
-      </if>
-      <if test="unit != null">
-        unit = #{unit,jdbcType=VARCHAR},
-      </if>
-      <if test="formula != null">
-        formula = #{formula,jdbcType=VARCHAR},
-      </if>
-      <if test="remark != null">
-        remark = #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        `status` = #{status,jdbcType=TINYINT},
-      </if>
-      <if test="createBy != null">
-        create_by = #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        update_by = #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        del_flag = #{delFlag,jdbcType=TINYINT},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
-    <!--@mbg.generated-->
-    update kws_integration
-    set integration_name = #{integrationName,jdbcType=VARCHAR},
-      part_names = #{partNames,jdbcType=VARCHAR},
-      unit = #{unit,jdbcType=VARCHAR},
-      formula = #{formula,jdbcType=VARCHAR},
-      remark = #{remark,jdbcType=VARCHAR},
-      `status` = #{status,jdbcType=TINYINT},
-      create_by = #{createBy,jdbcType=BIGINT},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      update_by = #{updateBy,jdbcType=BIGINT},
-      update_time = #{updateTime,jdbcType=TIMESTAMP},
-      del_flag = #{delFlag,jdbcType=TINYINT}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-</mapper>

+ 0 - 0
slope-modules/slope-detection/src/main/resources/mapper/KwsDeviceIntegrationMapper.xml → slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceIntegrationMapper.xml


+ 35 - 22
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml

@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.sckw.slope.detection.dao.mysql.KwsIntegrationMapper">
+<mapper namespace="com.sckw.slope.detection.dao.KwsIntegrationMapper">
   <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
   <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     <!--@Table kws_integration-->
     <!--@Table kws_integration-->
     <id column="id" jdbcType="BIGINT" property="id" />
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="device_id" jdbcType="BIGINT" property="deviceId" />
     <result column="integration_name" jdbcType="VARCHAR" property="integrationName" />
     <result column="integration_name" jdbcType="VARCHAR" property="integrationName" />
     <result column="part_names" jdbcType="VARCHAR" property="partNames" />
     <result column="part_names" jdbcType="VARCHAR" property="partNames" />
     <result column="unit" jdbcType="VARCHAR" property="unit" />
     <result column="unit" jdbcType="VARCHAR" property="unit" />
+    <result column="formula" jdbcType="VARCHAR" property="formula" />
+    <result column="remark" jdbcType="VARCHAR" property="remark" />
     <result column="status" jdbcType="TINYINT" property="status" />
     <result column="status" jdbcType="TINYINT" property="status" />
     <result column="create_by" jdbcType="BIGINT" property="createBy" />
     <result column="create_by" jdbcType="BIGINT" property="createBy" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -18,7 +19,7 @@
   </resultMap>
   </resultMap>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
-    id, device_id, integration_name, part_names, unit, `status`, create_by, create_time, 
+    id, integration_name, part_names, unit, formula, remark, `status`, create_by, create_time, 
     update_by, update_time, del_flag
     update_by, update_time, del_flag
   </sql>
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -35,14 +36,16 @@
   </delete>
   </delete>
   <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
   <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
-    insert into kws_integration (id, device_id, integration_name, 
-      part_names, unit, `status`, 
-      create_by, create_time, update_by, 
-      update_time, del_flag)
-    values (#{id,jdbcType=BIGINT}, #{deviceId,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, 
-      #{partNames,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, 
-      #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT})
+    insert into kws_integration (id, integration_name, part_names, 
+      unit, formula, remark, 
+      `status`, create_by, create_time, 
+      update_by, update_time, del_flag
+      )
+    values (#{id,jdbcType=BIGINT}, #{integrationName,jdbcType=VARCHAR}, #{partNames,jdbcType=VARCHAR}, 
+      #{unit,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, 
+      #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}
+      )
   </insert>
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
@@ -51,9 +54,6 @@
       <if test="id != null">
       <if test="id != null">
         id,
         id,
       </if>
       </if>
-      <if test="deviceId != null">
-        device_id,
-      </if>
       <if test="integrationName != null">
       <if test="integrationName != null">
         integration_name,
         integration_name,
       </if>
       </if>
@@ -63,6 +63,12 @@
       <if test="unit != null">
       <if test="unit != null">
         unit,
         unit,
       </if>
       </if>
+      <if test="formula != null">
+        formula,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
       <if test="status != null">
       <if test="status != null">
         `status`,
         `status`,
       </if>
       </if>
@@ -86,9 +92,6 @@
       <if test="id != null">
       <if test="id != null">
         #{id,jdbcType=BIGINT},
         #{id,jdbcType=BIGINT},
       </if>
       </if>
-      <if test="deviceId != null">
-        #{deviceId,jdbcType=BIGINT},
-      </if>
       <if test="integrationName != null">
       <if test="integrationName != null">
         #{integrationName,jdbcType=VARCHAR},
         #{integrationName,jdbcType=VARCHAR},
       </if>
       </if>
@@ -98,6 +101,12 @@
       <if test="unit != null">
       <if test="unit != null">
         #{unit,jdbcType=VARCHAR},
         #{unit,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="formula != null">
+        #{formula,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
       <if test="status != null">
         #{status,jdbcType=TINYINT},
         #{status,jdbcType=TINYINT},
       </if>
       </if>
@@ -122,9 +131,6 @@
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     update kws_integration
     update kws_integration
     <set>
     <set>
-      <if test="deviceId != null">
-        device_id = #{deviceId,jdbcType=BIGINT},
-      </if>
       <if test="integrationName != null">
       <if test="integrationName != null">
         integration_name = #{integrationName,jdbcType=VARCHAR},
         integration_name = #{integrationName,jdbcType=VARCHAR},
       </if>
       </if>
@@ -134,6 +140,12 @@
       <if test="unit != null">
       <if test="unit != null">
         unit = #{unit,jdbcType=VARCHAR},
         unit = #{unit,jdbcType=VARCHAR},
       </if>
       </if>
+      <if test="formula != null">
+        formula = #{formula,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        remark = #{remark,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
       <if test="status != null">
         `status` = #{status,jdbcType=TINYINT},
         `status` = #{status,jdbcType=TINYINT},
       </if>
       </if>
@@ -158,10 +170,11 @@
   <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
   <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
     update kws_integration
     update kws_integration
-    set device_id = #{deviceId,jdbcType=BIGINT},
-      integration_name = #{integrationName,jdbcType=VARCHAR},
+    set integration_name = #{integrationName,jdbcType=VARCHAR},
       part_names = #{partNames,jdbcType=VARCHAR},
       part_names = #{partNames,jdbcType=VARCHAR},
       unit = #{unit,jdbcType=VARCHAR},
       unit = #{unit,jdbcType=VARCHAR},
+      formula = #{formula,jdbcType=VARCHAR},
+      remark = #{remark,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=TINYINT},
       `status` = #{status,jdbcType=TINYINT},
       create_by = #{createBy,jdbcType=BIGINT},
       create_by = #{createBy,jdbcType=BIGINT},
       create_time = #{createTime,jdbcType=TIMESTAMP},
       create_time = #{createTime,jdbcType=TIMESTAMP},

+ 55 - 0
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectDeviceMapper.xml

@@ -148,4 +148,59 @@
       del_flag = #{delFlag,jdbcType=TINYINT}
       del_flag = #{delFlag,jdbcType=TINYINT}
     where id = #{id,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
   </update>
+
+  <select id="selectDataByProjectId" resultType="com.sckw.slope.detection.model.dto.BaseItemDTO">
+<!--      SELECT
+	*
+FROM
+	kws_device_model_part
+WHERE
+	device_model_id IN (
+	SELECT DISTINCT
+		id
+	FROM
+		kws_device_model
+	WHERE
+		id IN (
+		SELECT
+			model_id
+		FROM
+			kws_device
+		WHERE
+			id IN (
+			SELECT
+				device_id
+			FROM
+				kws_project_device
+			WHERE
+			project_id IN ())));-->
+      SELECT
+          c.`name` AS NAME,
+          d.part_name AS partName
+      FROM
+          kws_project_device a
+              LEFT JOIN kws_device b ON a.device_id = b.id
+              LEFT JOIN kws_device_model c ON b.model_id = c.id
+              LEFT JOIN kws_device_model_part d ON c.id = d.device_model_id
+      WHERE
+          a.del_flag = 0
+        AND b.del_flag = 0
+        AND c.del_flag = 0
+        AND d.del_flag =0
+        and a.project_id = #{id}
+    </select>
+
+  <select id="selectIntegrationItemByProjectId" resultType="com.sckw.slope.detection.model.dto.IntegrationItemDTO">
+      SELECT c.integration_id   AS integrationId,
+             d.integration_name AS integrationName
+      FROM kws_project_device a
+               LEFT JOIN kws_device b ON a.device_id = b.id
+               LEFT JOIN kws_device_integration c ON b.id = c.integration_id
+               LEFT JOIN kws_integration d ON c.integration_id = d.id
+      WHERE a.del_flag = 0
+        AND b.del_flag = 0
+        and c.del_flag = 0
+        and d.del_flag
+        and a.project_id = #{id}
+  </select>
 </mapper>
 </mapper>

+ 14 - 280
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectMapper.xml

@@ -10,16 +10,10 @@
     <result column="mountain_name" jdbcType="VARCHAR" property="mountainName" />
     <result column="mountain_name" jdbcType="VARCHAR" property="mountainName" />
     <result column="platform_name" jdbcType="VARCHAR" property="platformName" />
     <result column="platform_name" jdbcType="VARCHAR" property="platformName" />
     <result column="platform_address" jdbcType="VARCHAR" property="platformAddress" />
     <result column="platform_address" jdbcType="VARCHAR" property="platformAddress" />
-    <result column="design
-
-_company" jdbcType="VARCHAR" property="design
-
-Company" />
+    <result column="design_company" jdbcType="VARCHAR" property="designCompany" />
     <result column="design_contacts" jdbcType="VARCHAR" property="designContacts" />
     <result column="design_contacts" jdbcType="VARCHAR" property="designContacts" />
     <result column="design_phone" jdbcType="VARCHAR" property="designPhone" />
     <result column="design_phone" jdbcType="VARCHAR" property="designPhone" />
-    <result column="build
-_company" jdbcType="VARCHAR" property="build
-Company" />
+    <result column="build_company" jdbcType="VARCHAR" property="buildCompany" />
     <result column="build_contacts" jdbcType="VARCHAR" property="buildContacts" />
     <result column="build_contacts" jdbcType="VARCHAR" property="buildContacts" />
     <result column="build_phone" jdbcType="VARCHAR" property="buildPhone" />
     <result column="build_phone" jdbcType="VARCHAR" property="buildPhone" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
     <result column="remark" jdbcType="VARCHAR" property="remark" />
@@ -32,279 +26,19 @@ Company" />
   </resultMap>
   </resultMap>
   <sql id="Base_Column_List">
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
     <!--@mbg.generated-->
-    id, `name`, mountain_id, mountain_name, platform_name, platform_address, design
-
-_company, 
-    design_contacts, design_phone, build
-_company, build_contacts, build_phone, remark, 
+    id, `name`, mountain_id, mountain_name, platform_name, platform_address, design_company,
+    design_contacts, design_phone, build_company, build_contacts, build_phone, remark,
     `status`, create_by, create_time, update_by, update_time, del_flag
     `status`, create_by, create_time, update_by, update_time, del_flag
   </sql>
   </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from kws_project
-    where id = #{id,jdbcType=BIGINT}
+  <select id="selectByProjectParam" resultType="com.sckw.slope.detection.model.vo.ProjectVo">
+      select
+      <include refid="Base_Column_List">
+      </include>
+      from kws_project
+      <where>
+          <if test="name != null and name != ''">
+              and name like concat('%', #{name}, '%')
+          </if>
+      </where>
   </select>
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from kws_project
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsProject">
-    <!--@mbg.generated-->
-    insert into kws_project (id, `name`, mountain_id, 
-      mountain_name, platform_name, platform_address, 
-      design
-
-_company, design_contacts, design_phone, 
-      build
-_company, build_contacts, build_phone, 
-      remark, `status`, create_by, 
-      create_time, update_by, update_time, 
-      del_flag)
-    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{mountainId,jdbcType=VARCHAR}, 
-      #{mountainName,jdbcType=VARCHAR}, #{platformName,jdbcType=VARCHAR}, #{platformAddress,jdbcType=VARCHAR}, 
-      #{design
-
-Company,jdbcType=VARCHAR}, #{designContacts,jdbcType=VARCHAR}, #{designPhone,jdbcType=VARCHAR}, 
-      #{build
-Company,jdbcType=VARCHAR}, #{buildContacts,jdbcType=VARCHAR}, #{buildPhone,jdbcType=VARCHAR}, 
-      #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{createBy,jdbcType=BIGINT}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, 
-      #{delFlag,jdbcType=TINYINT})
-  </insert>
-  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsProject">
-    <!--@mbg.generated-->
-    insert into kws_project
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="name != null">
-        `name`,
-      </if>
-      <if test="mountainId != null">
-        mountain_id,
-      </if>
-      <if test="mountainName != null">
-        mountain_name,
-      </if>
-      <if test="platformName != null">
-        platform_name,
-      </if>
-      <if test="platformAddress != null">
-        platform_address,
-      </if>
-      <if test="design
-
-Company != null">
-        design
-
-_company,
-      </if>
-      <if test="designContacts != null">
-        design_contacts,
-      </if>
-      <if test="designPhone != null">
-        design_phone,
-      </if>
-      <if test="build
-Company != null">
-        build
-_company,
-      </if>
-      <if test="buildContacts != null">
-        build_contacts,
-      </if>
-      <if test="buildPhone != null">
-        build_phone,
-      </if>
-      <if test="remark != null">
-        remark,
-      </if>
-      <if test="status != null">
-        `status`,
-      </if>
-      <if test="createBy != null">
-        create_by,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="updateBy != null">
-        update_by,
-      </if>
-      <if test="updateTime != null">
-        update_time,
-      </if>
-      <if test="delFlag != null">
-        del_flag,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="name != null">
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="mountainId != null">
-        #{mountainId,jdbcType=VARCHAR},
-      </if>
-      <if test="mountainName != null">
-        #{mountainName,jdbcType=VARCHAR},
-      </if>
-      <if test="platformName != null">
-        #{platformName,jdbcType=VARCHAR},
-      </if>
-      <if test="platformAddress != null">
-        #{platformAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="design
-
-Company != null">
-        #{design
-
-Company,jdbcType=VARCHAR},
-      </if>
-      <if test="designContacts != null">
-        #{designContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="designPhone != null">
-        #{designPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="build
-Company != null">
-        #{build
-Company,jdbcType=VARCHAR},
-      </if>
-      <if test="buildContacts != null">
-        #{buildContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="buildPhone != null">
-        #{buildPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="remark != null">
-        #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=TINYINT},
-      </if>
-      <if test="createBy != null">
-        #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        #{delFlag,jdbcType=TINYINT},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsProject">
-    <!--@mbg.generated-->
-    update kws_project
-    <set>
-      <if test="name != null">
-        `name` = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="mountainId != null">
-        mountain_id = #{mountainId,jdbcType=VARCHAR},
-      </if>
-      <if test="mountainName != null">
-        mountain_name = #{mountainName,jdbcType=VARCHAR},
-      </if>
-      <if test="platformName != null">
-        platform_name = #{platformName,jdbcType=VARCHAR},
-      </if>
-      <if test="platformAddress != null">
-        platform_address = #{platformAddress,jdbcType=VARCHAR},
-      </if>
-      <if test="design
-
-Company != null">
-        design
-
-_company = #{design
-
-Company,jdbcType=VARCHAR},
-      </if>
-      <if test="designContacts != null">
-        design_contacts = #{designContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="designPhone != null">
-        design_phone = #{designPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="build
-Company != null">
-        build
-_company = #{build
-Company,jdbcType=VARCHAR},
-      </if>
-      <if test="buildContacts != null">
-        build_contacts = #{buildContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="buildPhone != null">
-        build_phone = #{buildPhone,jdbcType=VARCHAR},
-      </if>
-      <if test="remark != null">
-        remark = #{remark,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        `status` = #{status,jdbcType=TINYINT},
-      </if>
-      <if test="createBy != null">
-        create_by = #{createBy,jdbcType=BIGINT},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="updateBy != null">
-        update_by = #{updateBy,jdbcType=BIGINT},
-      </if>
-      <if test="updateTime != null">
-        update_time = #{updateTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="delFlag != null">
-        del_flag = #{delFlag,jdbcType=TINYINT},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsProject">
-    <!--@mbg.generated-->
-    update kws_project
-    set `name` = #{name,jdbcType=VARCHAR},
-      mountain_id = #{mountainId,jdbcType=VARCHAR},
-      mountain_name = #{mountainName,jdbcType=VARCHAR},
-      platform_name = #{platformName,jdbcType=VARCHAR},
-      platform_address = #{platformAddress,jdbcType=VARCHAR},
-      design
-
-_company = #{design
-
-Company,jdbcType=VARCHAR},
-      design_contacts = #{designContacts,jdbcType=VARCHAR},
-      design_phone = #{designPhone,jdbcType=VARCHAR},
-      build
-_company = #{build
-Company,jdbcType=VARCHAR},
-      build_contacts = #{buildContacts,jdbcType=VARCHAR},
-      build_phone = #{buildPhone,jdbcType=VARCHAR},
-      remark = #{remark,jdbcType=VARCHAR},
-      `status` = #{status,jdbcType=TINYINT},
-      create_by = #{createBy,jdbcType=BIGINT},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      update_by = #{updateBy,jdbcType=BIGINT},
-      update_time = #{updateTime,jdbcType=TIMESTAMP},
-      del_flag = #{delFlag,jdbcType=TINYINT}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
 </mapper>
 </mapper>