package com.huimv.admin.controller;


import com.huimv.admin.common.utils.Result;
import com.huimv.admin.service.IBillPcrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.huimv.admin.common.utils.Result;
import com.huimv.admin.common.utils.ResultCode;
import com.huimv.admin.service.IBillPcrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.util.Map;

/**
 * <p>
 * pcr 表 前端控制器
 * </p>
 *
 * @author author
 * @since 2023-07-21
 */
@RestController
@RequestMapping("/bill-pcr")
@CrossOrigin
public class BillPcrController {

    @Autowired
    private IBillPcrService pcrService;
    @RequestMapping("/listPcr")
    public Result listPcr(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
        return pcrService.list(httpServletRequest, paramsMap);
    }
    @RequestMapping("/listById")
    public Result listById(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) {
        return pcrService.listById(httpServletRequest, paramsMap);
    }
    @RequestMapping("/editPcr")
    public Result editPcr(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap) throws ParseException {
        return pcrService.edit(httpServletRequest, paramsMap);
    }
    @Autowired
    private IBillPcrService billPcrService;

    @PostMapping("/listPersonalPcr")
    public Result listPersonalPcr(HttpServletRequest httpServletRequest, @RequestBody Map<String, String> paramsMap){
        return billPcrService.listPersonalPcr(httpServletRequest,paramsMap);
    }

    @PostMapping("/getDetail")
    public Result getDetail(@RequestBody Map<String, String> paramsMap){
        return new Result(ResultCode.SUCCESS, billPcrService.getById(paramsMap.get("id")));
    }

}
