国标级联支持搜索

pull/1642/head
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)) @Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true) @Parameter(name = "page", description = "当前页")
@Parameter(name = "count", description = "每页条数", required = true) @Parameter(name = "count", description = "每页查询数量")
public PageInfo<Platform> platforms(@PathVariable int page, @PathVariable int count) { @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()) { if (parentPlatformPageInfo != null && !parentPlatformPageInfo.getList().isEmpty()) {
for (Platform platform : parentPlatformPageInfo.getList()) { for (Platform platform : parentPlatformPageInfo.getList()) {
platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null); platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null);

View File

@ -62,15 +62,18 @@ public interface PlatformMapper {
@Delete("DELETE FROM wvp_platform WHERE id=#{id}") @Delete("DELETE FROM wvp_platform WHERE id=#{id}")
int delete(@Param("id") Integer 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_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_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 + " + " (SELECT count(0) FROM wvp_platform_region pr WHERE pr.platform_id = pp.id ) * pp.catalog_with_region + " +
" pp.catalog_with_platform " + " pp.catalog_with_platform " +
" ) as channel_count" + " ) as channel_count" +
" FROM wvp_platform pp " " FROM wvp_platform pp where 1=1 " +
) " <if test='query != null'> " +
List<Platform> queryList(); " 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} ") @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<Platform> getEnableParentPlatformList(boolean enable); List<Platform> getEnableParentPlatformList(boolean enable);

View File

@ -29,7 +29,7 @@ public interface IPlatformService {
* @param count * @param count
* @return * @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 @Override
public PageInfo<Platform> queryPlatformList(int page, int count) { public PageInfo<Platform> queryPlatformList(int page, int count, String query) {
PageHelper.startPage(page, count); PageHelper.startPage(page, count);
List<Platform> all = platformMapper.queryList(); List<Platform> all = platformMapper.queryList(query);
return new PageInfo<>(all); return new PageInfo<>(all);
} }

View File

@ -4,6 +4,9 @@
<div class="page-header"> <div class="page-header">
<div class="page-title">上级平台列表</div> <div class="page-title">上级平台列表</div>
<div class="page-header-btn"> <div class="page-header-btn">
搜索:
<el-input @input="getPlatformList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary"
@click="addParentPlatform">添加 @click="addParentPlatform">添加
</el-button> </el-button>
@ -111,6 +114,7 @@ export default {
platform: null, platform: null,
pushChannelLoading: false, pushChannelLoading: false,
winHeight: window.innerHeight - 260, winHeight: window.innerHeight - 260,
searchSrt: "",
currentPage: 1, currentPage: 1,
count: 15, count: 15,
total: 0 total: 0
@ -258,15 +262,18 @@ export default {
this.getPlatformList(); this.getPlatformList();
}, },
getPlatformList: function () { getPlatformList: function () {
let that = this;
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: `/api/platform/query/${that.count}/${that.currentPage}` url: `/api/platform/query`,
}).then(function (res) { params: {
count: this.count,
page: this.currentPage,
query: this.searchSrt
}
}).then((res)=> {
if (res.data.code === 0) { if (res.data.code === 0) {
that.total = res.data.data.total; this.total = res.data.data.total;
that.platformList = res.data.data.list; this.platformList = res.data.data.list;
} }
}).catch(function (error) { }).catch(function (error) {