Showing
7 changed files
with
107 additions
and
10 deletions
@@ -46,6 +46,7 @@ public class TkConfigurationCenterRepository implements TkEdgeProcessorRepositor | @@ -46,6 +46,7 @@ public class TkConfigurationCenterRepository implements TkEdgeProcessorRepositor | ||
46 | public PageData<TkConfigurationCenter> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) { | 46 | public PageData<TkConfigurationCenter> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) { |
47 | LambdaQueryWrapper<TkConfigurationCenterEntity> queryWrapper = Wrappers.lambdaQuery(); | 47 | LambdaQueryWrapper<TkConfigurationCenterEntity> queryWrapper = Wrappers.lambdaQuery(); |
48 | queryWrapper.eq(TkConfigurationCenterEntity::getTenantId, tenantId.getId().toString()); | 48 | queryWrapper.eq(TkConfigurationCenterEntity::getTenantId, tenantId.getId().toString()); |
49 | + queryWrapper.eq(TkConfigurationCenterEntity::getIsTemplate, 1); | ||
49 | Page<TkConfigurationCenterEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize()); | 50 | Page<TkConfigurationCenterEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize()); |
50 | IPage<TkConfigurationCenterEntity> resultPage = tkConfigurationCenterMapper.selectPage(queryPage, queryWrapper); | 51 | IPage<TkConfigurationCenterEntity> resultPage = tkConfigurationCenterMapper.selectPage(queryPage, queryWrapper); |
51 | return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages()); | 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,7 +18,9 @@ import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity; | ||
18 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentMapper; | 18 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentMapper; |
19 | import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository; | 19 | import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository; |
20 | 20 | ||
21 | +import java.util.HashMap; | ||
21 | import java.util.List; | 22 | import java.util.List; |
23 | +import java.util.Map; | ||
22 | import java.util.UUID; | 24 | import java.util.UUID; |
23 | import java.util.stream.Collectors; | 25 | import java.util.stream.Collectors; |
24 | 26 | ||
@@ -40,10 +42,11 @@ public class TkConfigurationContentRepository implements TkEdgeProcessorReposito | @@ -40,10 +42,11 @@ public class TkConfigurationContentRepository implements TkEdgeProcessorReposito | ||
40 | 42 | ||
41 | @Override | 43 | @Override |
42 | public PageData<TkConfigurationContent> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) { | 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 | Page<TkConfigurationContentEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize()); | 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 | return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), | 50 | return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), |
48 | (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages()); | 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,7 +18,9 @@ import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEnt | ||
18 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentNodeMapper; | 18 | import org.thingsboard.server.dao.yunteng.mapper.ConfigurationContentNodeMapper; |
19 | import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository; | 19 | import org.thingsboard.server.service.edge.rpc.yunteng.TkEdgeProcessorRepository; |
20 | 20 | ||
21 | +import java.util.HashMap; | ||
21 | import java.util.List; | 22 | import java.util.List; |
23 | +import java.util.Map; | ||
22 | import java.util.UUID; | 24 | import java.util.UUID; |
23 | import java.util.stream.Collectors; | 25 | import java.util.stream.Collectors; |
24 | 26 | ||
@@ -40,20 +42,17 @@ public class TkConfigurationContentNodeRepository implements TkEdgeProcessorRepo | @@ -40,20 +42,17 @@ public class TkConfigurationContentNodeRepository implements TkEdgeProcessorRepo | ||
40 | 42 | ||
41 | @Override | 43 | @Override |
42 | public PageData<TkConfigurationContentNode> selectToEdge(TenantId tenantId, EdgeId edgeId, PageLink pageLink) { | 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 | Page<TkConfigurationContentNodeEntity> queryPage = new Page<>(pageLink.getPage(), pageLink.getPageSize()); | 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 | return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), | 50 | return new PageData(resultPage.getRecords().stream().map(this::toData).collect(Collectors.toList()), |
50 | (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages()); | 51 | (int) resultPage.getPages(), resultPage.getTotal(), resultPage.getCurrent()<resultPage.getPages()); |
51 | } | 52 | } |
52 | 53 | ||
53 | @Override | 54 | @Override |
54 | public List<TkConfigurationContentNode> selectToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId) { | 55 | public List<TkConfigurationContentNode> selectToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId) { |
55 | - System.out.println(" 下行转换 TkConfigurationContentNode"); | ||
56 | - | ||
57 | LambdaQueryWrapper<TkConfigurationContentNodeEntity> queryWrapper = Wrappers.lambdaQuery(); | 56 | LambdaQueryWrapper<TkConfigurationContentNodeEntity> queryWrapper = Wrappers.lambdaQuery(); |
58 | queryWrapper.eq(TkConfigurationContentNodeEntity::getTenantId, tenantId.getId().toString()); | 57 | queryWrapper.eq(TkConfigurationContentNodeEntity::getTenantId, tenantId.getId().toString()); |
59 | queryWrapper.eq(TkConfigurationContentNodeEntity::getId, entityId.getId().toString()); | 58 | queryWrapper.eq(TkConfigurationContentNodeEntity::getId, entityId.getId().toString()); |
1 | package org.thingsboard.server.dao.yunteng.mapper; | 1 | package org.thingsboard.server.dao.yunteng.mapper; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import org.apache.ibatis.annotations.Mapper; | 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 | import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity; | 8 | import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity; |
6 | 9 | ||
10 | +import java.util.Map; | ||
11 | + | ||
7 | @Mapper | 12 | @Mapper |
8 | public interface ConfigurationContentMapper extends BaseMapper<TkConfigurationContentEntity> { | 13 | public interface ConfigurationContentMapper extends BaseMapper<TkConfigurationContentEntity> { |
14 | + | ||
15 | + IPage<TkConfigurationContentEntity> getPage( | ||
16 | + IPage<?> page, @Param("queryMap") Map<String, Object> queryMap); | ||
9 | } | 17 | } |
1 | package org.thingsboard.server.dao.yunteng.mapper; | 1 | package org.thingsboard.server.dao.yunteng.mapper; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
4 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | +import org.apache.ibatis.annotations.Param; | ||
7 | +import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentEntity; | ||
5 | import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEntity; | 8 | import org.thingsboard.server.dao.yunteng.entities.TkConfigurationContentNodeEntity; |
6 | 9 | ||
10 | +import java.util.Map; | ||
11 | + | ||
7 | /** | 12 | /** |
8 | * @author Administrator | 13 | * @author Administrator |
9 | */ | 14 | */ |
10 | @Mapper | 15 | @Mapper |
11 | public interface ConfigurationContentNodeMapper extends BaseMapper<TkConfigurationContentNodeEntity> { | 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> |
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> |