package thyyxxk.webserver.controller.zhuyuanyizheng;

import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.zhuyuanyisheng.orderquash.ReqOrderQuash;
import thyyxxk.webserver.entity.zhuyuanyisheng.orderquash.ReturnReqOrderQuash;
import thyyxxk.webserver.service.zhuyuanyisheng.OrderQuashService;

import java.util.List;

@RestController
@RequestMapping("/orderQuash")
public class OrderQuashController {
    private final OrderQuashService service;

    public OrderQuashController(OrderQuashService service) {
        this.service = service;
    }

    @PostMapping("/applicationForRevocation")
    public ResultVo<Integer> applicationForRevocation(@RequestBody ReqOrderQuash param) {
        return service.applicationForRevocation(param);
    }

    @GetMapping("/getReqOrderQuash")
    public ResultVo<List<ReturnReqOrderQuash>> getReqOrderQuash(@RequestParam("startTime") String startTime,
                                                                @RequestParam("endTime") String endTime,
                                                                @RequestParam("state") int state,
                                                                @RequestParam("myReq") Boolean myReq) {
        return service.getReqOrderQuash(startTime, endTime, state, myReq);
    }

    @GetMapping("/selectReqListByPat")
    public ResultVo<List<ReturnReqOrderQuash>> selectReqListByPat(@RequestParam("patNo") String patNo,
                                                                  @RequestParam("times") String times,
                                                                  @RequestParam("state") int state) {
        return service.selectReqListByPat(patNo, times, state);
    }

    @PostMapping("/saveData")
    public ResultVo<String> saveData(@RequestBody List<ReqOrderQuash> list) {
        return service.saveData(list);
    }
}
