类 SohelpQuery

java.lang.Object
net.sohelp.boot.admin.core.web.SohelpQuery

@Component public class SohelpQuery extends Object
查询构建工具类,用于处理前端传入的过滤条件并生成对应的SQL语句或参数映射。
从以下版本开始:
2024/7/18 13:59
作者:
AaronFung
  • 构造器详细资料

    • SohelpQuery

      public SohelpQuery()
  • 方法详细资料

    • getConditions

      public List<ConditionVO> getConditions() throws com.fasterxml.jackson.core.JsonProcessingException
      获取默认名称("filter")下的过滤条件列表。
      返回:
      过滤条件对象列表
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • getConditions

      public List<ConditionVO> getConditions(String paramName) throws com.fasterxml.jackson.core.JsonProcessingException
      根据指定参数名从请求中提取并反序列化为过滤条件列表。
      参数:
      paramName - 请求中的参数名
      返回:
      过滤条件对象列表
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByMagicApi

      public String buildByMagicApi() throws com.fasterxml.jackson.core.JsonProcessingException
      使用默认参数名和空字段别名字典构建适用于 MagicAPI 的 SQL 条件字符串。
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByJdbc

      public String buildByJdbc() throws com.fasterxml.jackson.core.JsonProcessingException
      使用默认参数名和空字段别名字典构建适用于 JDBC 的 SQL 条件字符串。
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByMybatis

      public String buildByMybatis() throws com.fasterxml.jackson.core.JsonProcessingException
      使用默认参数名和空字段别名字典构建适用于 MyBatis 的 SQL 条件字符串。
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildData

      public Map<String,Object> buildData() throws com.fasterxml.jackson.core.JsonProcessingException
      使用默认参数名构建查询参数的数据映射表。
      返回:
      包含查询参数键值对的 Map 对象
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByMagicApi

      public String buildByMagicApi(String paramName, Map<String,String> fieldAlias) throws com.fasterxml.jackson.core.JsonProcessingException
      构建适用于 MagicAPI 的 SQL 条件字符串。
      参数:
      paramName - 请求参数名
      fieldAlias - 字段别名字典,可为空
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByMybatis

      public String buildByMybatis(String paramName, Map<String,String> fieldAlias) throws com.fasterxml.jackson.core.JsonProcessingException
      构建适用于 MyBatis 的 SQL 条件字符串。
      参数:
      paramName - 请求参数名
      fieldAlias - 字段别名字典,可为空
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildData

      public Map<String,Object> buildData(String paramName) throws com.fasterxml.jackson.core.JsonProcessingException
      构建查询参数的数据映射表。
      参数:
      paramName - 请求参数名
      返回:
      包含查询参数键值对的 Map 对象
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • buildByJdbc

      public String buildByJdbc(String paramName, Map<String,String> fieldAlias) throws com.fasterxml.jackson.core.JsonProcessingException
      构建适用于 JDBC 的 SQL 条件字符串。
      参数:
      paramName - 请求参数名
      fieldAlias - 字段别名字典,可为空
      返回:
      构建好的 SQL 字符串片段
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 当解析JSON失败时抛出异常
    • getFilterSQL

      public String getFilterSQL()
      获取过滤Mybatis SQL
      返回:
      构造完成的SQL字符串
    • getFilterMap

      public Map<String,Object> getFilterMap()
      获取过滤数据Map * [{ * fieldName:'sex', * comparison:'EQ', * value:'11' * }]
      返回:
      包含查询参数键值对的 Map 对象