Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Paging query based on spingboot

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "spingboot implementation paging query", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "spingboot to realize paging query"!

1@What does configuration mean?

A: Used to define configuration class, expenditure class is the information source of Bean configuration, equivalent to xml file

2. @Bean

A: Equivalent to an element in xml, placed above a method, not a class, meaning to generate a bean and hand it over to Spring management.

3. @PathVariable

A: Path variables

4. Implementation of paging query in springBoot

/** * Page query method * @param page number, counting from 1 * @param size Number of records per page * @param queryRequest query criteria * @return */ public QueryResponseResult findList(int page, int size, QueryPageRequest queryPageRequest){ if(queryPageRequest == null){ queryPageRequest = new QueryPageRequest(); } //Custom Condition Query //Define condition matcher ExampleMatcher exampleMatcher = ExampleMatcher.matching() .withMatcher("pageAliase", ExampleMatcher.GenericPropertyMatchers.contains()); //Condition Value Object CmsPage cmsPage = new CmsPage(); //Set condition value (site id) if(StringUtils.isNotEmpty(queryPageRequest.getSiteId())){ cmsPage.setSiteId(queryPageRequest.getSiteId()); } //Set template id as query condition if(StringUtils.isNotEmpty(queryPageRequest.getTemplateId())){ cmsPage.setTemplateId(queryPageRequest.getTemplateId()); } //Set page alias as query condition if(StringUtils.isNotEmpty(queryPageRequest.getPageAliase())){ cmsPage.setPageAliase(queryPageRequest.getPageAliase()); } //Define conditional object Example Example example = Example.of(cmsPage,exampleMatcher); //pagination parameters if(page

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report