Easy-Es Easy-Es
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)

adv display by random ❤️become sponsor
💋Home
  • v2.0.0(current version)
  • What's New

    • What' s New In Easy-Es v2.0.0?
  • history version

    • v1.x.x
  • Upgrade guide

    • Upgrade to 2.x.x instructions
💖Support
  • OS Community
  • Recommend Goods
  • Project PPT (opens new window)
  • Project introduction
  • Project members
  • PR
Join
Customer
  • Doc-Apis (opens new window)
  • Fitness plan automatic generation system (opens new window)
  • Vuepress-theme-vdoing (opens new window)
  • Gitee (opens new window)
  • Github (opens new window)
  • 简体中文 (opens new window)
  • English (opens new window)
  • Quick start

    • Introduction.md
    • Applicable scene
    • Worry free
    • Avoid pit
    • Quick start
    • Springboot demo
    • Spring Integration Guide
    • Solon Integration Guide
    • Config
    • Annotation
  • Core function

    • Condition constructor

      • Introduction of Wrapper
      • Index wrapper
      • Select wrapper
      • Update wrapper
    • Index CRUD

      • Index hosting model
      • Index CRUD
    • Data CRUD

      • Data synchronization solutions
      • Data CRUD
    • Multiple data sources support
    • Dynamic indexing support
    • Four nested query
    • Chain call
  • Extended function

    • Mixed query
    • Origin query
    • Page
    • Nested
    • Join parent child
    • Get DSL
    • ExecuteDSL
    • Execute SQL
    • Custom RequestOptions
    • Custom default method
      • Custom default method
  • High-level syntax

    • Field filtering
    • Sort
    • Aggregation
    • Match&fuzzy match
    • Weight
    • Highlight
    • Geo
    • IP
  • Plugin

    • Plugin
  • Other

    • Faq
    • Difference from MP
    • MySQL and EE syntax comparison
    • Update log
    • Update plan
    • Copyright
    • Thanks
  • v2.xDoc
  • Extended function
LaoHan
2024-03-24
目录

Custom default method

# Custom default method

The custom mapper inherited from BaseEsMapper has all the methods of BaseEsMapper, but in some scenarios, users hope to customize some common public methods. Currently, the framework does not support customizing xml and writing dsl into xml like Mybatis. In fact, It is not necessary to use this function because handwriting The complexity of dsl and handwritten sql are not comparable. dsl is a json tree structure. If it is defined using xml, the burden will be too heavy for users. Moreover, we also provide an API that can directly execute dsl. In addition, we provide The existing methods combined with hybrid queries can meet 99% of scenarios out of the box, and hybrid queries can satisfy 1% of scenarios. To cover all user needs, support for this feature will not be considered in the short term. Since the custom xml method is not supported, is it possible to support the custom default method? Excellent developers in our community have implemented this function. Since the PR submission location is wrong, I tried to contact but failed. The PR has not been merged yet, but the code has been It is submitted and published by the author, and the actual ownership is still owned by acmdl528 (githubID).

##use

     /**
      * Add default method to demo mapper
      *
      * @return document list
      */
     default List<Document> testDefaultMethod() {
             LambdaEsQueryWrapper<Document> wrapper = EsWrappers.lambdaQuery(Document.class)
                 .eq(Document::getTitle, "Old Man");
             return selectList(wrapper);
     }
1
2
3
4
5
6
7
8
9
10

Warm reminder

Before this, if you define the default method directly in the mapper, an error will be reported. If you want to know the reason, you can refer to the relevant code in the register package of the starter module in the source code.

Help us improve this document (opens new window)
Last update: 2024/04/12
Custom RequestOptions
Field filtering

← Custom RequestOptions Field filtering→

Theme by Vdoing | Copyright © 2021-2025 LaoHan | Zhejiang ICP No. 2022020479 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式