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.YpInvinfoModify;
import thyyxxk.webserver.service.medicine.YpInvinfoService;

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

/**
 * @ClassName YpInvinfoController
 * @Author hsh
 * @Date 2025/6/5 0005 23:08
 * @Version 1.0
 * @Description 药品库存变更批量上传结果
 **/
@RestController
@RequestMapping("/ypInvinfo")
public class YpInvinfoController {

    private final YpInvinfoService service;


    public YpInvinfoController(YpInvinfoService service) {
        this.service = service;
    }

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

    /**
     * @Description 查询药品库存变更批量上传结果
     * @Author hsh
     * @param upload 参数
     * @return list
     * @Date 2025/6/5 0005 23:11
     */
    @PostMapping("/selectYpInvinfoResult")
    public ResultVo<List<YpInvinfoModify>> selectYpInvinfoResult(@RequestBody @Validated YpCodgUpload upload){
        return service.selectYpInvinfoResult(upload);
    }

    /**
     * @Description 删除药品库存变更上传信息
     * @Author hsh
     * @param list 药品库存变更上传信息
     * @return map
     * @Date 2025/6/12 0012 17:11
     */
    @PostMapping("/deleteYpInvinfoBatchByCode")
    public ResultVo<Map<String, Object>> deleteYpInvinfoBatchByCode(@RequestBody @Validated List<YpCodgUpload> list){
        return service.deleteYpInvinfoBatchByCode(list);
    }

    /**
     * @Description 更新药品库存变更上传状态为删除（-2）
     * @Author hsh
     * @param list 药品库存变更上传信息
     * @return map
     * @Date 2025/7/2 0002 17:42
     */
    @PostMapping("/updateYpInvinfoBatchByCode")
    public ResultVo<Map<String, Object>> updateYpInvinfoBatchByCode(@RequestBody @Validated List<YpCodgUpload> list){
        return service.updateYpInvinfoBatchByCode(list);
    }

}
