package thyyxxk.webserver.controller.medicine;

import org.springframework.validation.annotation.Validated;
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.RestController;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicine.YpCodgUpload;
import thyyxxk.webserver.entity.medicine.YpPurcinfoBought;
import thyyxxk.webserver.service.medicine.YpPurcinfoBoughtService;

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

/**
 * @ClassName YpPurcinfoBoughtController
 * @Author hsh
 * @Date 2025/5/28 0028 18:32
 * @Version 1.0
 * @Description 商品采购/退货上传信息
 **/
@RestController
@RequestMapping("/ypPurcinfoBought")
public class YpPurcinfoBoughtController {

    private final YpPurcinfoBoughtService service;

    public YpPurcinfoBoughtController(YpPurcinfoBoughtService service) {
        this.service = service;
    }

    @PassToken
    @PostMapping("/updateYpPurcinfoBoughtBatch")
    public ResultVo<Map<String, Object>> updateYpPurcinfoBoughtBatch(@RequestBody @Validated List<YpPurcinfoBought> list) {
        return service.updateYpPurcinfoBoughtBatch(list);
    }

    /**
     * @Description 查询药品采购入库/退货上传信息结果
     * @Author hsh
     * @param upload 参数
     * @return list 药品采购入库/退货上传结果信息结果
     * @Date 2025/5/28 0028 17:51
     */
    @PostMapping("/selectYpPurchaseResult")
    public ResultVo<List<YpPurcinfoBought>> selectYpPurchaseResult(@RequestBody @Validated YpCodgUpload upload){
        return service.selectYpPurchaseResult(upload);
    }

}
