Browse Source

更改查询微服务配置接口

tuonina 5 years ago
parent
commit
c7c5a4ae79

+ 3 - 4
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/controller/PropertyMgrController.kt

@@ -2,6 +2,7 @@ package cn.gygxzc.cloud.config.controller
 
 import cn.gygxzc.cloud.config.model.ConfigProperty
 import cn.gygxzc.cloud.config.service.IConfigPropService
+import cn.tonyandmoney.tuonq.core.req.PageReq
 import com.baomidou.mybatisplus.core.metadata.IPage
 import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
@@ -53,11 +54,9 @@ class PropertyMgrController {
 
     @GetMapping
     @ApiOperation("条件查询系统配置信息")
-    fun query(cond: ConfigProperty,
-              @RequestParam("current") page: Long,
-              @RequestParam("pageSize") pageSize: Long): Mono<IPage<ConfigProperty>> {
+    fun query(cond: ConfigProperty, pageReq: PageReq): Mono<IPage<ConfigProperty>> {
         return Mono.create {
-            it.success(propService.query(cond, page, pageSize))
+            it.success(propService.query(cond, pageReq))
         }
     }
 }

+ 2 - 1
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/IConfigPropService.kt

@@ -1,6 +1,7 @@
 package cn.gygxzc.cloud.config.service
 
 import cn.gygxzc.cloud.config.model.ConfigProperty
+import cn.tonyandmoney.tuonq.core.req.PageReq
 import com.baomidou.mybatisplus.core.metadata.IPage
 
 /**
@@ -18,6 +19,6 @@ interface IConfigPropService {
 
     fun updateById(prop: ConfigProperty)
 
-    fun query(prop: ConfigProperty, page: Long, pageSize: Long): IPage<ConfigProperty>
+    fun query(prop: ConfigProperty, pageReq: PageReq): IPage<ConfigProperty>
 
 }

+ 12 - 13
envir-config/src/main/kotlin/cn/gygxzc/cloud/config/service/impl/ConfigPropService.kt

@@ -4,9 +4,9 @@ import cn.gygxzc.cloud.config.dao.IPropertyDao
 import cn.gygxzc.cloud.config.model.ConfigProperty
 import cn.gygxzc.cloud.config.service.IConfigPropService
 import cn.tonyandmoney.tuonq.core.SessionUtils
+import cn.tonyandmoney.tuonq.core.req.PageReq
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
 import com.baomidou.mybatisplus.core.metadata.IPage
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 import java.util.*
@@ -38,23 +38,22 @@ class ConfigPropService : IConfigPropService {
         propDao.updateById(prop)
     }
 
-    override fun query(prop: ConfigProperty,
-                       page: Long, pageSize: Long): IPage<ConfigProperty> {
+    override fun query(prop: ConfigProperty, pageReq: PageReq): IPage<ConfigProperty> {
         val queryWrapper = QueryWrapper<ConfigProperty>()
-        queryWrapper.orderByDesc("application","profile","`key`")
-        if (!prop.application.isNullOrBlank()){
-            queryWrapper.eq("application",prop.application)
+        queryWrapper.orderByDesc("application", "profile", "`key`")
+        if (!prop.application.isNullOrBlank()) {
+            queryWrapper.eq("application", prop.application)
         }
-        if (!prop.profile.isNullOrBlank()){
-            queryWrapper.eq("profile",prop.profile)
+        if (!prop.profile.isNullOrBlank()) {
+            queryWrapper.eq("profile", prop.profile)
         }
-        if (!prop.label.isNullOrBlank()){
-            queryWrapper.eq("label",prop.label)
+        if (!prop.label.isNullOrBlank()) {
+            queryWrapper.eq("label", prop.label)
         }
-        if (!prop.key.isNullOrBlank()){
-            queryWrapper.like("`key`",prop.key)
+        if (!prop.key.isNullOrBlank()) {
+            queryWrapper.like("`key`", prop.key)
         }
-        return propDao.selectPage(Page(page, pageSize), queryWrapper)
+        return propDao.selectPage(pageReq.page(), queryWrapper)
     }