package thyyxxk.webserver.controller.medicine;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicine.YpTempPurchase;
import thyyxxk.webserver.entity.medicine.YpTempPurchaseVo;
import thyyxxk.webserver.service.medicine.YpTempPurchaseService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName YpTempPurchaseController
 * @Author hsh
 * @Date 2024/4/24 15:16
 * @Version 1.0
 * @Description 药品预购申请与审核
 **/
@RestController
@RequestMapping("/ypTempPurchase")
public class YpTempPurchaseController {

    private final YpTempPurchaseService service;

    public YpTempPurchaseController(YpTempPurchaseService service) {
        this.service = service;
    }

    @GetMapping("/selectTempPurchaseYp")
    public ResultVo<List<Map<String, Object>>> selectTempPurchaseYp(@RequestParam("text") String text){
        return service.selectTempPurchaseYp(text);
    }

    @PostMapping("/selectYpTempPurchase")
    public ResultVo<List<YpTempPurchase>> selectYpTempPurchase(@RequestBody @Validated YpTempPurchaseVo vo){
        return service.selectYpTempPurchase(vo);
    }

    @PostMapping("/saveYpTempPurchase")
    public ResultVo<Map<String, Object>> saveYpTempPurchase(@RequestBody @Validated YpTempPurchase ypTempPurchase){
        return service.saveYpTempPurchase(ypTempPurchase);
    }

    @PostMapping("/auditYpTempPurchase")
    public ResultVo<Map<String, Object>> auditYpTempPurchase(@RequestBody @Validated YpTempPurchase ypTempPurchase){
        return service.auditYpTempPurchase(ypTempPurchase);
    }

}
