|
@@ -10,9 +10,15 @@ import io.swagger.annotations.ApiImplicitParam;
|
10
|
10
|
import io.swagger.annotations.ApiImplicitParams;
|
11
|
11
|
import io.swagger.annotations.ApiOperation;
|
12
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
13
|
+import org.springframework.beans.propertyeditors.CustomDateEditor;
|
|
14
|
+import org.springframework.web.bind.ServletRequestDataBinder;
|
13
|
15
|
import org.springframework.web.bind.annotation.*;
|
14
|
16
|
|
|
17
|
+import javax.servlet.http.HttpServletRequest;
|
15
|
18
|
import javax.servlet.http.HttpSession;
|
|
19
|
+import java.text.DateFormat;
|
|
20
|
+import java.text.SimpleDateFormat;
|
|
21
|
+import java.util.Date;
|
16
|
22
|
|
17
|
23
|
/**
|
18
|
24
|
* <p>
|
|
@@ -26,17 +32,29 @@ import javax.servlet.http.HttpSession;
|
26
|
32
|
@RequestMapping("/")
|
27
|
33
|
@Api(value = "用户 API", description = "用户 API")
|
28
|
34
|
public class CustomerController extends BaseController {
|
|
35
|
+
|
29
|
36
|
@Autowired
|
30
|
37
|
private ICustomerService iCustomerService;
|
31
|
38
|
|
|
39
|
+ /**
|
|
40
|
+ * 自定义方法绑定请求参数的Date类型
|
|
41
|
+ *
|
|
42
|
+ * @param request
|
|
43
|
+ * @param binder
|
|
44
|
+ * @throws Exception
|
|
45
|
+ */
|
|
46
|
+ @InitBinder
|
|
47
|
+ protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
|
|
48
|
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
49
|
+ CustomDateEditor editor = new CustomDateEditor(df, true);//true表示允许为空,false反之
|
|
50
|
+ binder.registerCustomEditor(Date.class, editor);
|
|
51
|
+ }
|
|
52
|
+
|
32
|
53
|
@ApiOperation(value = "会员列表", notes = "会员列表")
|
33
|
54
|
@ApiImplicitParams({
|
34
|
|
- @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "pageNum:分页第几页" +
|
35
|
|
- "pageSize:每页长度,phone:手机号,name:姓名")
|
36
|
|
-
|
|
55
|
+ @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "pageNum:分页第几页,pageSize:每页长度,phone:手机号,name:姓名,beginDate:开始时间,endDate:结束时间")
|
37
|
56
|
})
|
38
|
|
-// @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "token")
|
39
|
|
- @RequestMapping(value = "/customerList", method = RequestMethod.GET)
|
|
57
|
+ @RequestMapping(value = "/customerList", method = RequestMethod.POST)
|
40
|
58
|
public ResponseBean buildingList(@RequestBody String parameter, HttpSession session){
|
41
|
59
|
ResponseBean responseBean = iCustomerService.customerList(parameter);
|
42
|
60
|
return responseBean;
|