🎉 优化log模块分页排序逻辑

This commit is contained in:
smallchill 2020-08-27 19:44:57 +08:00
parent 113f99bf73
commit e2eb792c26
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,7 +64,9 @@ public class LogApiController {
*/
@GetMapping("/list")
public R<IPage<LogApiVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
IPage<LogApi> pages = logService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(log, LogApi.class));
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogApi> pages = logService.page(Condition.getPage(query), Condition.getQueryWrapper(log, LogApi.class));
List<LogApiVo> records = pages.getRecords().stream().map(logApi -> {
LogApiVo vo = BeanUtil.copy(logApi, LogApiVo.class);
vo.setStrId(Func.toStr(logApi.getId()));

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,7 +64,9 @@ public class LogErrorController {
*/
@GetMapping("/list")
public R<IPage<LogErrorVo>> list(@ApiIgnore @RequestParam Map<String, Object> logError, Query query) {
IPage<LogError> pages = errorLogService.page(Condition.getPage(query.setDescs("create_time")), Condition.getQueryWrapper(logError, LogError.class));
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogError> pages = errorLogService.page(Condition.getPage(query), Condition.getQueryWrapper(logError, LogError.class));
List<LogErrorVo> records = pages.getRecords().stream().map(logApi -> {
LogErrorVo vo = BeanUtil.copy(logApi, LogErrorVo.class);
vo.setStrId(Func.toStr(logApi.getId()));

View File

@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,6 +64,8 @@ public class LogUsualController {
*/
@GetMapping("/list")
public R<IPage<LogUsualVo>> list(@ApiIgnore @RequestParam Map<String, Object> log, Query query) {
query.setAscs("create_time");
query.setDescs(StringPool.EMPTY);
IPage<LogUsual> pages = logService.page(Condition.getPage(query), Condition.getQueryWrapper(log, LogUsual.class));
List<LogUsualVo> records = pages.getRecords().stream().map(logApi -> {
LogUsualVo vo = BeanUtil.copy(logApi, LogUsualVo.class);