SchedulePlanInfoController.java
1.82 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
43
44
45
46
47
48
49
50
51
52
package com.bsth.controller.schedule;
import com.bsth.controller.BaseController;
import com.bsth.entity.schedule.SchedulePlanInfo;
import com.google.common.base.Splitter;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* Created by xu on 16/6/16.
*/
@RestController
@RequestMapping("spic")
public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> {
/**
*
* @Title: list
* @Description: TODO(多条件分页查询)
* @param @param map 查询条件
* @param @param page 页码
* @param @param size 每页显示数量
* @throws
*/
@RequestMapping(method = RequestMethod.GET)
public Page<SchedulePlanInfo> list(@RequestParam Map<String, Object> map,
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "10") int size,
@RequestParam(defaultValue = "id") String order,
@RequestParam(defaultValue = "DESC") String direction){
Sort.Direction d;
if(null != direction && direction.equals("ASC"))
d = Sort.Direction.ASC;
else
d = Sort.Direction.DESC;
// order由 col1,col2,col3 这样传入
List<String> list = Splitter.on(",").trimResults().splitToList(order);
return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
}
}