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.YpCodgLine;
import thyyxxk.webserver.entity.medicine.YpInDetlVo;
import thyyxxk.webserver.entity.medicine.vo.YpDetlVo;
import thyyxxk.webserver.service.medicine.YpCodgLineService;

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

/**
 * @ClassName YpCodgLineController
 * @Author hsh
 * @Date 2025/6/26 0026 16:46
 * @Version 1.0
 * @Description 企业追溯信息下载
 **/
@RestController
@RequestMapping("/ypLine")
public class YpCodgLineController {

    private final YpCodgLineService service;

    public YpCodgLineController(YpCodgLineService service) {
        this.service = service;
    }

    /**
     * @Description 批量更新企业追溯下载信息
     * @Author hsh
     * @param list 企业追溯下载信息
     * @return map
     * @Date 2025/6/26 0026 17:11
     */
    @PassToken
    @PostMapping("/updateYpCodgLineBatch")
    public ResultVo<Map<String, Object>> updateYpCodgLineBatch(@RequestBody @Validated List<YpCodgLine> list) {
        return service.updateYpCodgLineBatch(list);
    }

    /**
     * @Description 根据条件查询入库信息
     * @Author hsh
     * @param vo 条件
     * @return list
     * @Date 2025/6/30 0030 15:13
     */
    @PostMapping("/selectYpInDetlData")
    public ResultVo<List<YpInDetlVo>> selectYpInDetlData(@RequestBody @Validated YpDetlVo vo) {
        return service.selectYpInDetlData(vo);
    }

    /**
     * @Description 根据条件查询企业追溯下载信息
     * @Author hsh
     * @param vo 条件
     * @return list 企业追溯下载信息
     * @Date 2025/7/1 0001 19:17
     */
    @PostMapping("/selectYpCodgLineData")
    public ResultVo<List<YpCodgLine>> selectYpCodgLineData(@RequestBody @Validated YpDetlVo vo) {
        return service.selectYpCodgLineData(vo);
    }

}
