-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcriteriaCommonParameterSetting.java
More file actions
42 lines (33 loc) · 1.59 KB
/
criteriaCommonParameterSetting.java
File metadata and controls
42 lines (33 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if(paramMap.get("sKey") != null && paramMap.get("sWords") != null) {
condition1 = criteriaBuilder.like(root.get(paramMap.get("sKey").toString()), "%"+paramMap.get("sWords").toString()+"%");
criteriaQuery.where(condition1);
}
if(paramMap.get("delYn") != null) {
delCondition = criteriaBuilder.equal(root.get("delYn"),paramMap.get("delYn").toString().charAt(0));
criteriaQuery.where(delCondition);
}
if(paramMap.get("sKey") != null && paramMap.get("delYn") != null) {
OrderConditions = criteriaBuilder.and(condition1, delCondition);
criteriaQuery.where(OrderConditions);
}
// perPage 파라미터가 있을경우
if(paramMap.get("page") != null) {
page =Integer.parseInt(paramMap.get("page").toString());
}
if(paramMap.get("perPage") != null) {
perPage = Integer.parseInt(paramMap.get("perPage").toString());
}
perPage = Integer.parseInt(paramMap.get("perPage").toString());
page = PageCalculator.calculatePage(paramMap);
result = entityManager.createQuery(criteriaQuery)
.setFirstResult(page)
.setMaxResults(perPage)
.getResultList();
pageNationMap.put("page", Integer.parseInt(paramMap.get("page").toString()));
pageNationMap.put("totalCount",adminGoodsRepository.count());
resultMap.put("pagination", pageNationMap);
resultMap.put("contents", result);
resultMap.put("message", Message.success);
results.put("code", MessageCode.success);
results.put("result", true);
results.put("data", resultMap);