国标级联支持搜索

This commit is contained in:
648540858
2024-08-29 17:18:22 +08:00
parent 8dc27d1353
commit 0416b76ed0
5 changed files with 30 additions and 18 deletions

View File

@@ -70,13 +70,15 @@ public class PlatformController {
}
}
@GetMapping("/query/{count}/{page}")
@GetMapping("/query")
@Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true)
public PageInfo<Platform> platforms(@PathVariable int page, @PathVariable int count) {
@Parameter(name = "page", description = "当前页")
@Parameter(name = "count", description = "每页查询数量")
@Parameter(name = "query", description = "查询内容")
public PageInfo<Platform> platforms(int page, int count,
@RequestParam(required = false) String query) {
PageInfo<Platform> parentPlatformPageInfo = platformService.queryPlatformList(page, count);
PageInfo<Platform> parentPlatformPageInfo = platformService.queryPlatformList(page, count, query);
if (parentPlatformPageInfo != null && !parentPlatformPageInfo.getList().isEmpty()) {
for (Platform platform : parentPlatformPageInfo.getList()) {
platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null);

View File

@@ -62,15 +62,18 @@ public interface PlatformMapper {
@Delete("DELETE FROM wvp_platform WHERE id=#{id}")
int delete(@Param("id") Integer id);
@Select(" SELECT pp.*, " +
@Select(" <script>" +
" SELECT pp.*, " +
" ( (SELECT count(0) FROM wvp_platform_channel pc WHERE pc.platform_id = pp.id ) + " +
" (SELECT count(0) FROM wvp_platform_group pg WHERE pg.platform_id = pp.id ) * pp.catalog_with_group + " +
" (SELECT count(0) FROM wvp_platform_region pr WHERE pr.platform_id = pp.id ) * pp.catalog_with_region + " +
" pp.catalog_with_platform " +
" ) as channel_count" +
" FROM wvp_platform pp "
)
List<Platform> queryList();
" FROM wvp_platform pp where 1=1 " +
" <if test='query != null'> " +
" AND (pp.name LIKE concat('%',#{query},'%') OR pp.server_gb_id LIKE concat('%',#{query},'%') )</if> " +
" </script>")
List<Platform> queryList(@Param("query") String query);
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<Platform> getEnableParentPlatformList(boolean enable);

View File

@@ -29,7 +29,7 @@ public interface IPlatformService {
* @param count
* @return
*/
PageInfo<Platform> queryPlatformList(int page, int count);
PageInfo<Platform> queryPlatformList(int page, int count, String query);
/**
* 添加级联平台

View File

@@ -156,9 +156,9 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public PageInfo<Platform> queryPlatformList(int page, int count) {
public PageInfo<Platform> queryPlatformList(int page, int count, String query) {
PageHelper.startPage(page, count);
List<Platform> all = platformMapper.queryList();
List<Platform> all = platformMapper.queryList(query);
return new PageInfo<>(all);
}