refactor: 优化 Query 相关注解使用方式

This commit is contained in:
2024-01-24 21:54:23 +08:00
parent 9648cf64a4
commit 15b152008c
15 changed files with 50 additions and 83 deletions

View File

@@ -16,22 +16,18 @@
package top.charles7c.continew.admin.monitor.model.query;
import cn.hutool.core.date.DatePattern;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.format.annotation.DateTimeFormat;
import cn.hutool.core.date.DatePattern;
import top.charles7c.continew.starter.data.mybatis.plus.query.Query;
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryType;
/**
* 登录日志查询条件
*
@@ -49,7 +45,6 @@ public class LoginLogQuery implements Serializable {
* 登录状态
*/
@Schema(description = "登录状态1成功2失败", example = "1")
@Query
private Integer status;
/**

View File

@@ -52,7 +52,6 @@ public class OperationLogQuery implements Serializable {
* 操作状态
*/
@Schema(description = "操作状态1成功2失败", example = "1")
@Query
private Integer status;
/**

View File

@@ -34,7 +34,7 @@ import top.charles7c.continew.admin.monitor.model.resp.*;
import top.charles7c.continew.admin.monitor.service.LogService;
import top.charles7c.continew.starter.core.util.ReflectUtils;
import top.charles7c.continew.starter.core.util.validate.CheckUtils;
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryHelper;
import top.charles7c.continew.starter.data.mybatis.plus.query.QueryWrapperHelper;
import top.charles7c.continew.starter.extension.crud.model.query.PageQuery;
import top.charles7c.continew.starter.extension.crud.model.resp.PageResp;
@@ -58,7 +58,7 @@ public class LogServiceImpl implements LogService {
@Override
@AutoOperate(type = OperationLogResp.class, on = "list")
public PageResp<OperationLogResp> page(OperationLogQuery query, PageQuery pageQuery) {
QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query);
QueryWrapper<LogDO> queryWrapper = QueryWrapperHelper.build(query);
// 限定查询信息
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class);
List<String> columnNameList = fieldNameList.stream()
@@ -74,7 +74,7 @@ public class LogServiceImpl implements LogService {
@Override
@AutoOperate(type = LoginLogResp.class, on = "list")
public PageResp<LoginLogResp> page(LoginLogQuery query, PageQuery pageQuery) {
QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query);
QueryWrapper<LogDO> queryWrapper = QueryWrapperHelper.build(query);
queryWrapper.eq("module", "登录");
// 限定查询信息
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class);
@@ -91,7 +91,7 @@ public class LogServiceImpl implements LogService {
@Override
@AutoOperate(type = SystemLogResp.class, on = "list")
public PageResp<SystemLogResp> page(SystemLogQuery query, PageQuery pageQuery) {
QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query);
QueryWrapper<LogDO> queryWrapper = QueryWrapperHelper.build(query);
// 限定查询信息
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class);
List<String> columnNameList = fieldNameList.stream()