Эх сурвалжийг харах

1.项目详情接口查询
2.整合td数据库crud
3.关联设备查询-保存
4.新增报表接口

lengfaqiang 2 жил өмнө
parent
commit
3bdbb9de78
16 өөрчлөгдсөн 486 нэмэгдсэн , 254 устгасан
  1. 1 1
      slope-common/slope-common-tdengine/pom.xml
  2. 0 19
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/KwsIntegrationMapper.java
  3. 12 4
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/tdengine/SlopeDataMapper.java
  4. 1 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDeviceIntegration.java
  5. 18 7
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/tdengine/SlopeData.java
  6. 6 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceQuery.java
  7. 26 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceOutputValueVO.java
  8. 1 1
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectDeviceVO.java
  9. 24 0
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/SlopeDataVo.java
  10. 97 8
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java
  11. 19 2
      slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/TdengineDemoService.java
  12. 2 2
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceIntegrationMapper.xml
  13. 214 200
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceModelMapper.xml
  14. 1 1
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsIntegrationMapper.xml
  15. 10 4
      slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectMapper.xml
  16. 54 3
      slope-modules/slope-detection/src/main/resources/mapper/tdengine/SlopeDataMapper.xml

+ 1 - 1
slope-common/slope-common-tdengine/pom.xml

@@ -28,7 +28,7 @@
         <dependency>
             <groupId>com.taosdata.jdbc</groupId>
             <artifactId>taos-jdbcdriver</artifactId>
-            <version>3.2.5</version>
+            <version>3.2.7</version>
         </dependency>
     </dependencies>
 </project>

+ 0 - 19
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/KwsIntegrationMapper.java

@@ -1,19 +0,0 @@
-package com.sckw.slope.detection.dao;
-
-import com.sckw.slope.detection.model.dos.mysql.KwsIntegration;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface KwsIntegrationMapper {
-    int deleteByPrimaryKey(Long id);
-
-    int insert(KwsIntegration record);
-
-    int insertSelective(KwsIntegration record);
-
-    KwsIntegration selectByPrimaryKey(Long id);
-
-    int updateByPrimaryKeySelective(KwsIntegration record);
-
-    int updateByPrimaryKey(KwsIntegration record);
-}

+ 12 - 4
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/dao/tdengine/SlopeDataMapper.java

@@ -1,8 +1,11 @@
 package com.sckw.slope.detection.dao.tdengine;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
+import com.sckw.slope.detection.model.vo.SlopeDataVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
@@ -16,10 +19,15 @@ import java.util.List;
 @DS("td")
 @Mapper
 @Repository
-public interface SlopeDataMapper {
+public interface SlopeDataMapper extends BaseMapper<SlopeData> {
 
-    @Select("select * from slope_data")
-    List<SlopeData> selectAll();
+    @Select("select * from devices.slope_data_#{vin}_#{number}")
+    List<SlopeDataVo> selectAll(@Param("vin") String vin, @Param("number") String number);
+
+    List<SlopeDataVo> selectList();
+
+    SlopeData selectListByLine(@Param("item") String item);
+
+    int insertData(@Param("slopeData") SlopeData slopeData);
 
-    List<SlopeData> selectList();
 }

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDeviceIntegration.java

@@ -23,7 +23,7 @@ public class KwsDeviceIntegration implements Serializable {
     /**
      * 企业id
      */
-    private String companyId;
+    private String mountainId;
 
     /**
     * 集成要素id

+ 18 - 7
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/tdengine/SlopeData.java

@@ -1,9 +1,10 @@
 package com.sckw.slope.detection.model.dos.tdengine;
 
+import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * @author lfdc
@@ -11,11 +12,21 @@ import java.time.LocalDateTime;
  * @date 2023-10-25 09:10:21
  */
 @Data
+@TableName("slope_data")
 public class SlopeData implements Serializable {
-    private LocalDateTime ts;
-    private LocalDateTime rawId;
-    private String deviceId;
-    private String itemName;
-    private String itemValue;
-    private LocalDateTime createTime;
+    //ts|raw_id|tslver_id|guid|line|val|create_time|msg_id|name|
+//    SELECT ts, raw_id, tslver_id, guid, line, val, create_time, msg_idmsg_id, name
+    private Date ts;
+    private Date rawId;
+    private int tslverId;
+    private String guid;
+    private String line;
+    private String val;
+    private String msgId;
+    private String name;
+    private String vin;
+    private String serialNumber;
+    private String tagsTitle;
+    private String tags;
+    private Date createTime;
 }

+ 6 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceQuery.java

@@ -20,7 +20,7 @@ public class DeviceQuery {
     private String projectName;
 
     /**
-     * 项目名称
+     * 项目id
      */
     private String projectId;
 
@@ -39,6 +39,11 @@ public class DeviceQuery {
      */
     private String deviceType;
 
+    /**
+     * 设备型号
+     */
+    private String deviceModel;
+
     private int page;
 
     private int pageSize;

+ 26 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceOutputValueVO.java

@@ -0,0 +1,26 @@
+package com.sckw.slope.detection.model.vo;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author lfdc
+ * @description 边坡详情,测量值基准值vo
+ * @date 2023-11-04 10:11:41
+ */
+@Data
+public class DeviceOutputValueVO {
+    /**
+     * 当前基准值
+     */
+    private Map<String, Object> currentMap;
+    /**
+     * 原始基准值
+     */
+    private Map<String, Object> primitive;
+    /**
+     * 当前测量值
+     */
+    private Map<String, Object> currentMeasurement;
+}

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/ProjectDeviceVO.java

@@ -59,7 +59,7 @@ public class ProjectDeviceVO implements Serializable {
     /**
      * 型号
      */
-    private String modelName;
+    private String deviceModelName;
 
     /**
      * 创建时间

+ 24 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/SlopeDataVo.java

@@ -0,0 +1,24 @@
+package com.sckw.slope.detection.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author lfdc
+ * @description
+ * @date 2023-11-04 15:11:28
+ */
+@Data
+public class SlopeDataVo implements Serializable {
+    private Date ts;
+    private Date rawId;
+    private int tslverId;
+    private String guid;
+    private String line;
+    private String val;
+//    private String msgId;
+//    private String name;
+    private Date createTime;
+}

+ 97 - 8
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -5,19 +5,19 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.DeviceEnum;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.slope.detection.dao.mysql.*;
-import com.sckw.slope.detection.model.dos.mysql.KwsDevice;
-import com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel;
-import com.sckw.slope.detection.model.dto.DeviceDataDTO;
-import com.sckw.slope.detection.model.dto.DeviceLocationDTO;
-import com.sckw.slope.detection.model.dto.HeaderData;
-import com.sckw.slope.detection.model.dto.LocationDTO;
+import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
+import com.sckw.slope.detection.model.dos.mysql.*;
+import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
+import com.sckw.slope.detection.model.dto.*;
 import com.sckw.slope.detection.model.param.DeviceAdd;
 import com.sckw.slope.detection.model.param.DeviceQuery;
+import com.sckw.slope.detection.model.vo.DeviceOutputValueVO;
 import com.sckw.slope.detection.model.vo.DeviceVo;
 import com.sckw.slope.detection.model.vo.ProjectDeviceVO;
 import jakarta.servlet.http.HttpServletRequest;
@@ -29,9 +29,13 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author lfdc
@@ -51,15 +55,30 @@ public class DeviceService {
     @Autowired
     KwsAlarmMapper alarmMapper;
 
+    @Autowired
+    SlopeDataMapper slopeDataMapper;
+
     @Autowired
     KwsDeviceModelMapper deviceModelMapper;
 
     @Autowired
     KwsProjectMapper projectMapper;
 
+    @Autowired
+    KwsIntegrationMapper integrationMapper;
+
     @Autowired
     KwsProjectDeviceMapper projectDeviceMapper;
 
+    @Autowired
+    KwsDeviceModelPartMapper deviceModelPartMapper;
+
+    @Autowired
+    KwsDeviceIntegrationMapper deviceIntegrationMapper;
+
+    @Autowired
+    KwsDeviceReferenceMapper deviceReferenceMapper;
+
 
     @Transactional
     public HttpResult dels(String ids) {
@@ -191,10 +210,80 @@ public class DeviceService {
      */
     public HttpResult outputValue(String projectId, String deviceId, HttpServletRequest request) {
         HeaderData headerData = commonService.getHeaderData(request);
+        List<Integer> status = new ArrayList<>();
+        status.add(DeviceEnum.ALREADY_REFERRED_TO.getCode());
+        //集成要素
+        List<DeviceElementDTO> integratedElementList = deviceIntegrationMapper.selectIntegratedElement(projectId,
+                headerData.getMountainId(), status, Long.parseLong(deviceId));
+
+
         List<ProjectDeviceVO> projectDeviceList = projectMapper.selectDeviceByProjectId(headerData.getMountainId(), Long.parseLong(projectId), Long.parseLong(deviceId));
+        List<String> deviceIds = new ArrayList<>();
         if (!CollectionUtils.isEmpty(projectDeviceList)) {
-
+            deviceIds = projectDeviceList.stream().map(ProjectDeviceVO::getId).collect(Collectors.toList());
+        }
+        //基本要素
+        List<KwsDeviceReference> references = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()
+                .eq(KwsDeviceReference::getDeviceId, deviceId)
+                .eq(KwsDeviceReference::getMountainId, headerData.getMountainId())
+                .eq(KwsDeviceReference::getDelFlag, NumberConstant.ZERO)
+        );
+        List<DeviceOutputValueVO> mapList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(references)) {
+            references.forEach(re -> {
+                DeviceOutputValueVO vo = new DeviceOutputValueVO();
+                String item = re.getItem();
+                BigDecimal value = re.getValue();
+                //当前基准值
+                HashMap<String, Object> currentMap = new HashMap<>();
+                //原始基准值
+                HashMap<String, Object> primitive = new HashMap<>();
+                //当前测量值-TD获取
+                HashMap<String, Object> currentMeasurement = new HashMap<>();
+                SlopeData slopeData = slopeDataMapper.selectListByLine(item);
+                primitive.put(item, value);
+                //存在经度纬度海拔等要素 要进行公式计算
+                String itemList = "";
+                if (itemList.contains(re.getItem())) {
+                    currentMap.put(item, value);
+                } else {
+                    currentMap.put(item, value);
+                }
+                vo.setCurrentMap(currentMap);
+                vo.setPrimitive(primitive);
+                vo.setCurrentMeasurement(currentMeasurement);
+                mapList.add(vo);
+            });
+        }
+        //集成要素-测量值计算
+        List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(new LambdaQueryWrapper<KwsDeviceIntegration>()
+                .eq(KwsDeviceIntegration::getMountainId, headerData.getMountainId())
+                .eq(KwsDeviceIntegration::getDeviceId, deviceId)
+        );
+        List<Long> longList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(deviceIntegrations)) {
+            longList = deviceIntegrations.stream().map(KwsDeviceIntegration::getIntegrationId).collect(Collectors.toList());
+        }
+        if (!CollectionUtils.isEmpty(longList)) {
+            List<KwsIntegration> kwsIntegrations = integrationMapper.selectList(new LambdaQueryWrapper<KwsIntegration>().in(KwsIntegration::getId, longList));
+            if (!CollectionUtils.isEmpty(kwsIntegrations) && kwsIntegrations.size() > 0) {
+                kwsIntegrations.forEach(integration -> {
+                    String integrationName = integration.getIntegrationName();
+                    String partNames = integration.getPartNames();
+                    DeviceOutputValueVO vo = new DeviceOutputValueVO();
+                    //当前基准值
+                    HashMap<String, Object> currentMap = new HashMap<>();
+                    //原始基准值
+                    HashMap<String, Object> primitive = new HashMap<>();
+                    //当前测量值-TD获取
+                    HashMap<String, Object> currentMeasurement = new HashMap<>();
+                    vo.setCurrentMap(currentMap);
+                    vo.setPrimitive(primitive);
+                    vo.setCurrentMeasurement(currentMeasurement);
+                    mapList.add(vo);
+                });
+            }
         }
-        return null;
+        return HttpResult.ok(mapList);
     }
 }

+ 19 - 2
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/TdengineDemoService.java

@@ -3,9 +3,11 @@ package com.sckw.slope.detection.service;
 import com.alibaba.fastjson2.JSONObject;
 import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
 import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
+import com.sckw.slope.detection.model.vo.SlopeDataVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -19,9 +21,24 @@ public class TdengineDemoService {
     SlopeDataMapper slopeDataMapper;
 
     public void tdengineDemo() {
-        List<SlopeData> list = slopeDataMapper.selectAll();
+        List<SlopeDataVo> list = slopeDataMapper.selectAll("6","7");
         System.out.println(JSONObject.toJSONString(list));
-        List<SlopeData> list1 = slopeDataMapper.selectList();
+        List<SlopeDataVo> list1 = slopeDataMapper.selectList();
         System.out.println(JSONObject.toJSONString(list1));
+        SlopeData data = new SlopeData();
+        java.util.Date now = new Date();
+        data.setTs(now);
+        data.setRawId(now);
+        data.setTslverId(1);
+        data.setGuid("1");
+        data.setLine("2");
+        data.setVal("3");
+        data.setMsgId("4");
+        data.setVin("6");
+        data.setSerialNumber("7");
+        data.setTagsTitle("name");
+        data.setTags("sss");
+        data.setCreateTime(now);
+        int insert = slopeDataMapper.insertData(data);
     }
 }

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

@@ -8,7 +8,7 @@
         <result column="device_id" jdbcType="BIGINT" property="deviceId"/>
         <result column="integration_id" jdbcType="BIGINT" property="integrationId"/>
         <result column="status" jdbcType="TINYINT" property="status"/>
-        <result column="company_id" jdbcType="VARCHAR" property="companyId"/>
+        <result column="mountain_id" jdbcType="VARCHAR" property="mountainId"/>
         <result column="create_by" jdbcType="BIGINT" property="createBy"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
@@ -25,7 +25,7 @@
         create_time,
         update_by,
         update_time,
-        del_flag,company_id
+        del_flag,mountain_id
     </sql>
     <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
         <!--@mbg.generated-->

+ 214 - 200
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsDeviceModelMapper.xml

@@ -1,218 +1,232 @@
 <?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.mysql.KwsDeviceModelMapper">
-  <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
-    <!--@mbg.generated-->
-    <!--@Table kws_device_model-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="identify_code" jdbcType="VARCHAR" property="identifyCode" />
-    <result column="device_type" jdbcType="VARCHAR" property="deviceType" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer" />
-    <result column="manufacturer_contacts" jdbcType="VARCHAR" property="manufacturerContacts" />
-    <result column="manufacturer_phone" jdbcType="VARCHAR" property="manufacturerPhone" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-      <result column="mountainId" jdbcType="VARCHAR" property="mountainId" />
-    <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, identify_code, device_type, `name`, manufacturer, manufacturer_contacts, manufacturer_phone, 
-    remark, `status`, create_by, create_time, update_by, update_time, del_flag,mountain_id
-  </sql>
-  <select id="selectListAll" resultType="com.sckw.slope.detection.model.vo.DeviceModelVo">
-    select
-        <include refid="Base_Column_List" />
-    from kws_device_model
-    where del_flag = 0
-    <if test="deviceModelQuery.name != null and deviceModelQuery.name != ''">
-      and name like concat('%', #{deviceModelQuery.name}, '%')
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from kws_device_model
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from kws_device_model
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
-    <!--@mbg.generated-->
-    insert into kws_device_model (id, identify_code, device_type, 
-      `name`, manufacturer, manufacturer_contacts, 
-      manufacturer_phone, remark, `status`, 
-      create_by, create_time, update_by, 
-      update_time, del_flag,mountain_id)
-    values (#{id,jdbcType=BIGINT}, #{identifyCode,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR}, 
-      #{name,jdbcType=VARCHAR}, #{manufacturer,jdbcType=VARCHAR}, #{manufacturerContacts,jdbcType=VARCHAR}, 
-      #{manufacturerPhone,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, 
-      #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT},#{mountainId,jdbcType=VARCHAR})
-  </insert>
-  <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
-    <!--@mbg.generated-->
-    insert into kws_device_model
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
+    <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
+        <!--@mbg.generated-->
+        <!--@Table kws_device_model-->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="identify_code" jdbcType="VARCHAR" property="identifyCode"/>
+        <result column="device_type" jdbcType="VARCHAR" property="deviceType"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer"/>
+        <result column="manufacturer_contacts" jdbcType="VARCHAR" property="manufacturerContacts"/>
+        <result column="manufacturer_phone" jdbcType="VARCHAR" property="manufacturerPhone"/>
+        <result column="remark" jdbcType="VARCHAR" property="remark"/>
+        <result column="mountain_id" jdbcType="VARCHAR" property="mountainId"/>
+        <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,
-      </if>
-      <if test="identifyCode != null">
         identify_code,
-      </if>
-      <if test="deviceType != null">
         device_type,
-      </if>
-      <if test="name != null">
         `name`,
-      </if>
-      <if test="manufacturer != null">
         manufacturer,
-      </if>
-      <if test="manufacturerContacts != null">
         manufacturer_contacts,
-      </if>
-      <if test="manufacturerPhone != null">
         manufacturer_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="identifyCode != null">
-        #{identifyCode,jdbcType=VARCHAR},
-      </if>
-      <if test="deviceType != null">
-        #{deviceType,jdbcType=VARCHAR},
-      </if>
-      <if test="name != null">
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturer != null">
-        #{manufacturer,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturerContacts != null">
-        #{manufacturerContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturerPhone != null">
-        #{manufacturerPhone,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.KwsDeviceModel">
-    <!--@mbg.generated-->
-    update kws_device_model
-    <set>
-      <if test="identifyCode != null">
-        identify_code = #{identifyCode,jdbcType=VARCHAR},
-      </if>
-      <if test="deviceType != null">
-        device_type = #{deviceType,jdbcType=VARCHAR},
-      </if>
-      <if test="name != null">
-        `name` = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturer != null">
-        manufacturer = #{manufacturer,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturerContacts != null">
-        manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
-      </if>
-      <if test="manufacturerPhone != null">
-        manufacturer_phone = #{manufacturerPhone,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.KwsDeviceModel">
-    <!--@mbg.generated-->
-    update kws_device_model
-    set identify_code = #{identifyCode,jdbcType=VARCHAR},
-      device_type = #{deviceType,jdbcType=VARCHAR},
-      `name` = #{name,jdbcType=VARCHAR},
-      manufacturer = #{manufacturer,jdbcType=VARCHAR},
-      manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
-      manufacturer_phone = #{manufacturerPhone,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>
+        mountain_id
+    </sql>
+    <select id="selectListAll" resultType="com.sckw.slope.detection.model.vo.DeviceModelVo">
+        select
+        <include refid="Base_Column_List"/>
+        from kws_device_model
+        where del_flag = 0
+        <if test="deviceModelQuery.name != null and deviceModelQuery.name != ''">
+            and name like concat('%', #{deviceModelQuery.name}, '%')
+        </if>
+    </select>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        <!--@mbg.generated-->
+        select
+        <include refid="Base_Column_List"/>
+        from kws_device_model
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        <!--@mbg.generated-->
+        delete
+        from kws_device_model
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
+        <!--@mbg.generated-->
+        insert into kws_device_model (id, identify_code, device_type,
+                                      `name`, manufacturer, manufacturer_contacts,
+                                      manufacturer_phone, remark, `status`,
+                                      create_by, create_time, update_by,
+                                      update_time, del_flag, mountain_id)
+        values (#{id,jdbcType=BIGINT}, #{identifyCode,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
+                #{name,jdbcType=VARCHAR}, #{manufacturer,jdbcType=VARCHAR}, #{manufacturerContacts,jdbcType=VARCHAR},
+                #{manufacturerPhone,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
+                #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT},
+                #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{mountainId,jdbcType=VARCHAR})
+    </insert>
+    <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
+        <!--@mbg.generated-->
+        insert into kws_device_model
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="identifyCode != null">
+                identify_code,
+            </if>
+            <if test="deviceType != null">
+                device_type,
+            </if>
+            <if test="name != null">
+                `name`,
+            </if>
+            <if test="manufacturer != null">
+                manufacturer,
+            </if>
+            <if test="manufacturerContacts != null">
+                manufacturer_contacts,
+            </if>
+            <if test="manufacturerPhone != null">
+                manufacturer_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="identifyCode != null">
+                #{identifyCode,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceType != null">
+                #{deviceType,jdbcType=VARCHAR},
+            </if>
+            <if test="name != null">
+                #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturer != null">
+                #{manufacturer,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturerContacts != null">
+                #{manufacturerContacts,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturerPhone != null">
+                #{manufacturerPhone,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.KwsDeviceModel">
+        <!--@mbg.generated-->
+        update kws_device_model
+        <set>
+            <if test="identifyCode != null">
+                identify_code = #{identifyCode,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceType != null">
+                device_type = #{deviceType,jdbcType=VARCHAR},
+            </if>
+            <if test="name != null">
+                `name` = #{name,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturer != null">
+                manufacturer = #{manufacturer,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturerContacts != null">
+                manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
+            </if>
+            <if test="manufacturerPhone != null">
+                manufacturer_phone = #{manufacturerPhone,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.KwsDeviceModel">
+        <!--@mbg.generated-->
+        update kws_device_model
+        set identify_code         = #{identifyCode,jdbcType=VARCHAR},
+            device_type           = #{deviceType,jdbcType=VARCHAR},
+            `name`                = #{name,jdbcType=VARCHAR},
+            manufacturer          = #{manufacturer,jdbcType=VARCHAR},
+            manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
+            manufacturer_phone    = #{manufacturerPhone,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>

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

@@ -1,6 +1,6 @@
 <?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">
+<mapper namespace="com.sckw.slope.detection.dao.mysql.KwsIntegrationMapper">
   <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsIntegration">
     <!--@mbg.generated-->
     <!--@Table kws_integration-->

+ 10 - 4
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsProjectMapper.xml

@@ -98,7 +98,7 @@
                c.alias        AS alias,
                d.device_type  AS deviceType,
                d.manufacturer AS manufacturer,
-               d.`name`       AS modelName,
+               d.`name`       AS deviceModelName,
                c.create_time  AS createTime
         FROM kws_project a
                  LEFT JOIN kws_project_device b ON a.id = b.project_id
@@ -117,8 +117,11 @@
         <if test="deviceQuery.deviceType != null and deviceQuery.deviceType != ''">
             and d.device_type like concat('%', #{deviceQuery.deviceType}, '%')
         </if>
+        <if test="deviceQuery.deviceModel != null and deviceQuery.deviceModel != ''">
+            and d.name like concat('%', #{deviceQuery.deviceModel}, '%')
+        </if>
         <if test="deviceQuery.name != null and deviceQuery.name != ''">
-            and d.name like concat('%', #{deviceQuery.name}, '%')
+            and c.name like concat('%', #{deviceQuery.name}, '%')
         </if>
     </select>
 
@@ -130,7 +133,7 @@
                c.`name`       AS NAME,
                d.device_type  AS deviceType,
                d.manufacturer AS manufacturer,
-               d.`name`       AS modelName,
+               d.`name`       AS deviceModelName,
                c.create_time  AS createTime
         FROM kws_project a
                  LEFT JOIN kws_device c ON a.mountain_id = c.mountain_id
@@ -153,8 +156,11 @@
         <if test="deviceQuery.deviceType != null and deviceQuery.deviceType != ''">
             and d.device_type like concat('%', #{deviceQuery.deviceType}, '%')
         </if>
+        <if test="deviceQuery.deviceModel != null and deviceQuery.deviceModel != ''">
+            and d.name like concat('%', #{deviceQuery.deviceModel}, '%')
+        </if>
         <if test="deviceQuery.name != null and deviceQuery.name != ''">
-            and d.name like concat('%', #{deviceQuery.name}, '%')
+            and c.name like concat('%', #{deviceQuery.name}, '%')
         </if>
     </select>
 </mapper>

+ 54 - 3
slope-modules/slope-detection/src/main/resources/mapper/tdengine/SlopeDataMapper.xml

@@ -2,8 +2,59 @@
 <!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.tdengine.SlopeDataMapper">
 
-    <select id="selectList" resultType="com.sckw.slope.detection.model.dos.tdengine.SlopeData">
-<!--        ts, raw_id , device_id, item_name as itemName, item_value as itemValue, create_time as createTime-->
-        SELECT * FROM slope_data
+    <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.tdengine.SlopeData">
+        <!--@mbg.generated-->
+        <!--@Table slope_data-->
+        <id column="ts" jdbcType="TIMESTAMP" property="tslverId"/>
+        <result column="raw_id" jdbcType="TIMESTAMP" property="rawId"/>
+        <result column="tslver_id" jdbcType="TINYINT" property="tslverId"/>
+        <result column="guid" jdbcType="VARCHAR" property="guid"/>
+        <result column="line" jdbcType="VARCHAR" property="line"/>
+        <result column="val" jdbcType="VARCHAR" property="val"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="msg_id" jdbcType="VARCHAR" property="msgId"/>
+        <result column="name" jdbcType="TINYINT" property="name"/>
+    </resultMap>
+
+    <select id="selectList" resultType="com.sckw.slope.detection.model.vo.SlopeDataVo">
+        <!--        ts, raw_id , device_id, item_name as itemName, item_value as itemValue, create_time as createTime-->
+        SELECT ts,
+               raw_id      as rawId,
+               tslver_id   as tslverId,
+               guid,
+               line,
+               val,
+               create_time as createTime,
+               msg_id      as msgId,
+               name
+        FROM devices.slope_data_6_7
+    </select>
+
+    <sql id="Base_List">
+        ts,
+        raw_id      as rawId,
+        tslver_id   as tslverId,
+        guid,
+        line,
+        val,
+        create_time as createTime,
+        msg_id      as msgId,
+        name
+    </sql>
+    <select id="selectListByLine" resultType="com.sckw.slope.detection.model.dos.tdengine.SlopeData">
+        SELECT
+        <include refid="Base_List">
+        </include>
+        FROM devices.slope_data_#{vin}_
     </select>
+
+    <insert id="insertData" parameterType="com.sckw.slope.detection.model.dos.tdengine.SlopeData">
+        <!--        insert into devices.slope_data_202_2021-->
+        insert into devices.slope_data_#{slopeData.vin}_#{slopeData.serialNumber} using devices.slope_data (#{slopeData.tagsTitle}) tags (#{slopeData.tags})
+            (ts, raw_id, tslver_id, guid, line, val, create_time)
+        VALUES (#{slopeData.ts}, #{slopeData.rawId},
+        #{slopeData.tslverId}, #{slopeData.guid},
+        #{slopeData.line}, #{slopeData.val}, #{slopeData.createTime})
+        <!--        VALUES('2023-12-12 00:00:00.100', '2023-12-12 00:00:00.100', 111, '111', '1111', '111', '2023-12-12 00:00:00.100');-->
+    </insert>
 </mapper>