PayOrderController.java
2.5 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.sunyo.energy.location.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.energy.location.controller.response.ResultJson;
import com.sunyo.energy.location.model.PayRecords;
import com.sunyo.energy.location.service.PayOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* Created by XYH on 2019/12/16.
* 订单查询,新增,更新,删除
*/
@Api(description = "订单管理")
@RestController
@RequestMapping("/order")
public class PayOrderController {
@Autowired
PayOrderService payOrderService;
@ApiOperation(value = "查询缴费订单")
@RequestMapping("/list")
public PageInfo<PayRecords> getOrder(@RequestParam(value = "pageSize", required = false, defaultValue = "1") int pageSize,
@RequestParam(value = "pageNum", required = false, defaultValue = "5") int pageNum,
@RequestParam(value = "orderNumber",required = false) String orderNumber,
@RequestParam(value = "payTime", required = false) String payTime ){
return payOrderService.getOrder(pageSize, pageNum, orderNumber, payTime);
}
@ApiOperation(value = "新增缴费订单")
@PostMapping("/add")
public ResultJson addOrder(@RequestBody PayRecords records){
int mgs=0;
int result=payOrderService.addOrder(records);
if(result>0){
mgs=1;
}
return mgs==1?new ResultJson("200","新增订单成功"):new ResultJson("500","新增订单失败");
}
@ApiOperation(value = "更新缴费订单")
@PutMapping("/edi")
public ResultJson ediOrder(@RequestBody PayRecords records){
int mgs=0;
int result=payOrderService.ediOrder(records);
if(result>0){
mgs=1;
}
return mgs==1? new ResultJson("200","订单信息更新成功"):new ResultJson("500","订单信息更新失败");
}
@ApiOperation(value = "删除缴费订单")
@DeleteMapping("/del")
public ResultJson delOrder(@RequestBody PayRecords payRecords){
int mgs=0;
int result=payOrderService.delOrder(payRecords);
if(result>0){
mgs=1;
}
return mgs==1? new ResultJson("200","订单信息移出成功"):new ResultJson("500","订单信息删除失败");
}
}