Commit 6902d2eb2c35fa865f1e1e9edc2e2074a1b0fbaf
Committed by
xp.Huang
1 parent
8fbaa13d
feat: 新功能开发:优化查询所有接口
(cherry picked from commit 1bc7bd30e2283cb537d81ec69530805af4533260)
Showing
5 changed files
with
12 additions
and
7 deletions
@@ -145,11 +145,11 @@ public class TkDataViewInterfaceController extends BaseController { | @@ -145,11 +145,11 @@ public class TkDataViewInterfaceController extends BaseController { | ||
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | - @GetMapping("/find_all_interface") | 148 | + @GetMapping("/find_all_interface/{state}") |
149 | @ApiOperation("查询所有接口") | 149 | @ApiOperation("查询所有接口") |
150 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") | 150 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") |
151 | - public List<TkDataViewInterfaceDTO> findAll() throws ThingsboardException { | ||
152 | - return tkDataViewInterfaceService.findAll(getCurrentUser().getCurrentTenantId()); | 151 | + public List<TkDataViewInterfaceDTO> findAll(@PathVariable("state") String state) throws ThingsboardException { |
152 | + return tkDataViewInterfaceService.findAll(state,getCurrentUser().getCurrentTenantId()); | ||
153 | } | 153 | } |
154 | 154 | ||
155 | 155 |
@@ -156,11 +156,11 @@ public class TkDataViewInterfaceServiceImpl | @@ -156,11 +156,11 @@ public class TkDataViewInterfaceServiceImpl | ||
156 | } | 156 | } |
157 | 157 | ||
158 | @Override | 158 | @Override |
159 | - public List<TkDataViewInterfaceDTO> findAll(String tenantId){ | 159 | + public List<TkDataViewInterfaceDTO> findAll(String state,String tenantId){ |
160 | List<String> tenantIds = new ArrayList<>(); | 160 | List<String> tenantIds = new ArrayList<>(); |
161 | tenantIds.add(tenantId); | 161 | tenantIds.add(tenantId); |
162 | tenantIds.add(EntityId.NULL_UUID.toString()); | 162 | tenantIds.add(EntityId.NULL_UUID.toString()); |
163 | - List<TkDataViewInterfaceDTO> lists =baseMapper.findAll(tenantIds); | 163 | + List<TkDataViewInterfaceDTO> lists =baseMapper.findAll(Integer.parseInt(state),tenantIds); |
164 | return lists; | 164 | return lists; |
165 | } | 165 | } |
166 | 166 |
@@ -35,7 +35,7 @@ public interface TkDataViewInterfaceMapper extends BaseMapper<TkDataViewInterfac | @@ -35,7 +35,7 @@ public interface TkDataViewInterfaceMapper extends BaseMapper<TkDataViewInterfac | ||
35 | * @param tenantIds | 35 | * @param tenantIds |
36 | * @return | 36 | * @return |
37 | */ | 37 | */ |
38 | - List<TkDataViewInterfaceDTO> findAll(@Param("tenantIds") List<String> tenantIds); | 38 | + List<TkDataViewInterfaceDTO> findAll(@Param("state") Integer state,@Param("tenantIds") List<String> tenantIds); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * SQL 查询 | 41 | * SQL 查询 |
@@ -28,7 +28,7 @@ public interface TkDataViewInterfaceService { | @@ -28,7 +28,7 @@ public interface TkDataViewInterfaceService { | ||
28 | 28 | ||
29 | List<TkDataViewInterfaceDTO> filterByInterfaceType(String type,String tenantId); | 29 | List<TkDataViewInterfaceDTO> filterByInterfaceType(String type,String tenantId); |
30 | 30 | ||
31 | - List<TkDataViewInterfaceDTO> findAll(String tenantId); | 31 | + List<TkDataViewInterfaceDTO> findAll(String state,String tenantId); |
32 | 32 | ||
33 | boolean batchPublishInterface(List<String> ids, String tenantId); | 33 | boolean batchPublishInterface(List<String> ids, String tenantId); |
34 | 34 |
@@ -65,6 +65,11 @@ | @@ -65,6 +65,11 @@ | ||
65 | <include refid="columns"/> | 65 | <include refid="columns"/> |
66 | FROM tk_data_view_interface | 66 | FROM tk_data_view_interface |
67 | <where> | 67 | <where> |
68 | + | ||
69 | + <if test="state !=null and state !=''"> | ||
70 | + state = #{state} | ||
71 | + </if> | ||
72 | + | ||
68 | <if test="tenantIds !=null"> | 73 | <if test="tenantIds !=null"> |
69 | AND tenant_id IN | 74 | AND tenant_id IN |
70 | <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> | 75 | <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> |