MCPcopy Create free account
hub / github.com/LisenCoding/cangku / Query

Method Query

boot/src/main/java/com/utils/Query.java:29–52  ·  view source on GitHub ↗
(JQPageInfo pageInfo)

Source from the content-addressed store, hash-verified

27 private int limit = 10;
28
29 public Query(JQPageInfo pageInfo) {
30 //分页参数
31 if(pageInfo.getPage()!= null){
32 currPage = pageInfo.getPage();
33 }
34 if(pageInfo.getLimit()!= null){
35 limit = pageInfo.getLimit();
36 }
37
38
39 //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
40 String sidx = SQLFilter.sqlInject(pageInfo.getSidx());
41 String order = SQLFilter.sqlInject(pageInfo.getOrder());
42
43
44 //mybatis-plus分页
45 this.page = new Page<>(currPage, limit);
46
47 //排序
48 if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){
49 this.page.setOrderByField(sidx);
50 this.page.setAsc("ASC".equalsIgnoreCase(order));
51 }
52 }
53
54
55 public Query(Map<String, Object> params){

Callers

nothing calls this directly

Calls 6

sqlInjectMethod · 0.95
getSidxMethod · 0.80
getOrderMethod · 0.80
putMethod · 0.80
getPageMethod · 0.45
getLimitMethod · 0.45

Tested by

no test coverage detected