Commit a481b5ebd77ddf383461ca6e1f412ebc79ccbf55

Authored by xp.Huang
2 parents 6d219a41 6eb5dda5

Merge branch 'fix/teambition/2024-10-29-B' into 'master_dev'

Fix/teambition/2024 10 29 b

See merge request yunteng/thingskit!459
... ... @@ -46,6 +46,7 @@ public class TkConfigurationCenterRepository implements TkEdgeProcessorRepositor
46 46 public PageData<TkConfigurationCenter> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) {
47 47 LambdaQueryWrapper<TkConfigurationCenterEntity> queryWrapper = Wrappers.lambdaQuery();
48 48 queryWrapper.eq(TkConfigurationCenterEntity::getTenantId, tenantId.getId().toString());
  49 + queryWrapper.eq(TkConfigurationCenterEntity::getIsTemplate, 1);
49 50 Page<TkConfigurationCenterEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize());
50 51 IPage<TkConfigurationCenterEntity> resultPage = tkConfigurationCenterMapper.selectPage(queryPage, queryWrapper);
51 52 return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages());
... ...
... ... @@ -18,7 +18,9 @@ import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity;
18 18 import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentMapper;
19 19 import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository;
20 20
  21 +import java.util.HashMap;
21 22 import java.util.List;
  23 +import java.util.Map;
22 24 import java.util.UUID;
23 25 import java.util.stream.Collectors;
24 26
... ... @@ -40,10 +42,11 @@ public class TkConfigurationContentRepository implements TkEdgeProcessorReposito
40 42
41 43 @Override
42 44 public PageData<TkConfigurationContent> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) {
43   - LambdaQueryWrapper<TkConfigurationContentEntity> queryWrapper = Wrappers.lambdaQuery();
44   - queryWrapper.eq(TkConfigurationContentEntity::getTenantId, tenantId.getId().toString());
  45 + Map<String,Object> queryMap=new HashMap<>();
  46 + queryMap.put("tenantId",tenantId.getId().toString());
  47 + queryMap.put("isTemplate",1);
45 48 Page<TkConfigurationContentEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize());
46   - IPage<TkConfigurationContentEntity> resultPage = TkConfigurationContentMapper.selectPage(queryPage, queryWrapper);
  49 + IPage<TkConfigurationContentEntity> resultPage = TkConfigurationContentMapper.getPage(queryPage, queryMap);
47 50 return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()),
48 51 (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages());
49 52 }
... ...
... ... @@ -18,7 +18,9 @@ import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEnt
18 18 import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentNodeMapper;
19 19 import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository;
20 20
  21 +import java.util.HashMap;
21 22 import java.util.List;
  23 +import java.util.Map;
22 24 import java.util.UUID;
23 25 import java.util.stream.Collectors;
24 26
... ... @@ -40,20 +42,17 @@ public class TkConfigurationContentNodeRepository implements TkEdgeProcessorRepo
40 42
41 43 @Override
42 44 public PageData<TkConfigurationContentNode> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) {
43   - System.out.println(" 全量下行查询 TkConfigurationContentNode");
44   -
45   - LambdaQueryWrapper<TkConfigurationContentNodeEntity> queryWrapper = Wrappers.lambdaQuery();
46   - queryWrapper.eq(TkConfigurationContentNodeEntity::getTenantId, tenantId.getId().toString());
  45 + Map<String,Object> queryMap=new HashMap<>();
  46 + queryMap.put("tenantId",tenantId.getId().toString());
  47 + queryMap.put("isTemplate",1);
47 48 Page<TkConfigurationContentNodeEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize());
48   - IPage<TkConfigurationContentNodeEntity> resultPage = tkConfigurationContentNodeMapper.selectPage(queryPage, queryWrapper);
  49 + IPage<TkConfigurationContentNodeEntity> resultPage = tkConfigurationContentNodeMapper.getPage(queryPage, queryMap);
49 50 return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()),
50 51 (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages());
51 52 }
52 53
53 54 @Override
54 55 public List<TkConfigurationContentNode> selectToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId) {
55   - System.out.println(" 下行转换 TkConfigurationContentNode");
56   -
57 56 LambdaQueryWrapper<TkConfigurationContentNodeEntity> queryWrapper = Wrappers.lambdaQuery();
58 57 queryWrapper.eq(TkConfigurationContentNodeEntity::getTenantId, tenantId.getId().toString());
59 58 queryWrapper.eq(TkConfigurationContentNodeEntity::getId, entityId.getId().toString());
... ...
1 1 package org.thingsboard.server.dao.yunteng.mapper;
2 2
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
4 5 import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +import org.thingsboard.server.common.data.yunteng.dto.ConfigurationCenterDTO;
5 8 import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity;
6 9
  10 +import java.util.Map;
  11 +
7 12 @Mapper
8 13 public interface ConfigurationContentMapper extends BaseMapper<TkConfigurationContentEntity> {
  14 +
  15 + IPage<TkConfigurationContentEntity> getPage(
  16 + IPage<?> page, @Param("queryMap") Map<String, Object> queryMap);
9 17 }
... ...
1 1 package org.thingsboard.server.dao.yunteng.mapper;
2 2
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
4 5 import org.apache.ibatis.annotations.Mapper;
  6 +import org.apache.ibatis.annotations.Param;
  7 +import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity;
5 8 import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEntity;
6 9
  10 +import java.util.Map;
  11 +
7 12 /**
8 13 * @author Administrator
9 14 */
10 15 @Mapper
11 16 public interface ConfigurationContentNodeMapper extends BaseMapper<TkConfigurationContentNodeEntity> {
  17 + IPage<TkConfigurationContentNodeEntity> getPage(
  18 + IPage<?> page, @Param("queryMap") Map<String, Object> queryMap);
12 19 }
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +
  4 +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentMapper">
  5 +
  6 +
  7 + <resultMap id="entity" type="org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity">
  8 + <result property="id" column="id"/>
  9 + <result property="name" column="name"/>
  10 + <result property="configurationId" column="configuration_id"/>
  11 + <result property="type" column="type"/>
  12 + <result property="remark" column="remark"/>
  13 + <result property="content" column="content"/>
  14 + <result property="createTime" column="create_time"/>
  15 + <result property="creator" column="creator"/>
  16 + <result property="tenantId" column="tenant_id"/>
  17 + <result property="updater" column="updater"/>
  18 + </resultMap>
  19 +
  20 + <sql id="columns">
  21 + id, configuration_id, name, type, content ,tenant_id ,create_time, creator, updater ,update_time, remark
  22 + </sql>
  23 +
  24 +
  25 + <select id="getPage" resultMap="entity">
  26 + SELECT tk_configuration_content.*
  27 + FROM tk_configuration_content
  28 + INNER JOIN tk_configuration_center on (tk_configuration_center.id=tk_configuration_content.configuration_id)
  29 + <where>
  30 + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''">
  31 + AND tk_configuration_content.tenant_id = #{queryMap.tenantId}
  32 + </if>
  33 + <if test="queryMap.isTemplate !=null">
  34 + AND tk_configuration_center.is_template = #{queryMap.isTemplate}
  35 + </if>
  36 + </where>
  37 + </select>
  38 +
  39 +</mapper>
\ No newline at end of file
... ...
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +
  4 +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentNodeMapper">
  5 +
  6 +
  7 + <resultMap id="entity" type="org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEntity">
  8 + <result property="id" column="id"/>
  9 + <result property="configurationId" column="configuration_id"/>
  10 + <result property="contentId" column="content_id"/>
  11 + <result property="actJson" column="act_json"/>
  12 + <result property="dataSourceJson" column="data_source_json"/>
  13 + <result property="eventJson" column="event_json"/>
  14 + <result property="remark" column="remark"/>
  15 + <result property="createTime" column="create_time"/>
  16 + <result property="creator" column="creator"/>
  17 + <result property="tenantId" column="tenant_id"/>
  18 + <result property="updater" column="updater"/>
  19 + </resultMap>
  20 +
  21 + <sql id="columns">
  22 + id, configuration_id ,content_id, act_json, data_source_json ,event_json ,tenant_id ,create_time, creator ,updater, update_time ,remark, configuration_node_id
  23 + </sql>
  24 +
  25 +
  26 + <select id="getPage" resultMap="entity">
  27 + SELECT tk_configuration_content_node.*
  28 + FROM tk_configuration_content_node
  29 + INNER JOIN tk_configuration_center on (tk_configuration_center.id=tk_configuration_content_node.configuration_id)
  30 + <where>
  31 + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''">
  32 + AND tk_configuration_content_node.tenant_id = #{queryMap.tenantId}
  33 + </if>
  34 + <if test="queryMap.isTemplate !=null">
  35 + AND tk_configuration_center.is_template = #{queryMap.isTemplate}
  36 + </if>
  37 + </where>
  38 + </select>
  39 +
  40 +</mapper>
\ No newline at end of file
... ...
... ... @@ -30,6 +30,9 @@
30 30 FROM tk_device_profile_category tkdpc
31 31 LEFT JOIN sys_dict_item ON (sys_dict_item.item_value=tkdpc.dict_item_id)
32 32 WHERE 1=1
  33 + <if test="isSysAdmin == true">
  34 + AND tkdpc.tenant_id='13814000-1dd2-11b2-8080-808080808080'
  35 + </if>
33 36 <if test="isSysAdmin == false">
34 37 AND tkdpc.tenant_id = #{tenantId}
35 38 <if test="status !=null">
... ... @@ -60,6 +63,9 @@
60 63 FROM tk_device_profile_category tkdpc
61 64 LEFT JOIN sys_dict_item ON (sys_dict_item.item_value=tkdpc.dict_item_id)
62 65 WHERE 1=1
  66 + <if test="isSysAdmin == true">
  67 + AND tkdpc.tenant_id='13814000-1dd2-11b2-8080-808080808080'
  68 + </if>
63 69 <if test="isSysAdmin == false">
64 70 AND tkdpc.tenant_id = #{tenantId}
65 71 <if test="status !=null">
... ...
... ... @@ -6,7 +6,7 @@
6 6 <resultMap id="BaseResultMap" type="org.thingsboard.server.dao.yunteng.entities.Tk3dComponentEntity">
7 7 <id column="id" property="id" />
8 8 <result column="name" property="name" />
9   - <result column="imageUrl" property="imageUrl" />
  9 + <result column="image_url" property="imageUrl" />
10 10 <result column="state" property="state" />
11 11 <result column="created_time" property="createdTime" />
12 12 <result column="update_time" property="updateTime" />
... ... @@ -31,7 +31,7 @@
31 31 AND id = #{queryMap.id}
32 32 </if>
33 33 <if test="queryMap.name !=null">
34   - AND name = #{queryMap.name}
  34 + AND name LIKE concat('%',#{queryMap.name},'%')
35 35 </if>
36 36 <if test="queryMap.state !=null">
37 37 AND state = #{queryMap.state}
... ...