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.YpSelinfoSold;
import thyyxxk.webserver.service.medicine.YpSelinfoSoldService;

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

/**
 * @ClassName YpSelinfoSoldController
 * @Author hsh
 * @Date 2025/6/3 0003 11:10
 * @Version 1.0
 * @Description 药品销售/销售退货上传信息
 **/
@RestController
@RequestMapping("/ypSelinfoSold")
public class YpSelinfoSoldController {

    private final YpSelinfoSoldService service;

    public YpSelinfoSoldController(YpSelinfoSoldService service) {
        this.service = service;
    }

    /**
     * @Description 上传药品销售/销售退货上传信息
     * @Author hsh
     * @param list 药品销售/销售退货上传信息
     * @return map
     * @Date 2025/6/3 0003 11:25
     */
    @PassToken
    @PostMapping("/updateYpSelinfoSoldBatch")
    public ResultVo<Map<String, Object>> updateYpSelinfoSoldBatch(@RequestBody @Validated List<YpSelinfoSold> list) {
        return service.updateYpSelinfoSoldBatch(list);
    }

    /**
     * @Description 查询药品销售/销售退货上传信息结果
     * @Author hsh
     * @param upload 查询条件
     * @return list 药品销售/销售退货上传信息结果
     * @Date 2025/6/3 0003 11:15
     */
    @PostMapping("/selectYpSelinfoResult")
    public ResultVo<List<YpSelinfoSold>> selectYpSelinfoResult(@RequestBody @Validated YpCodgUpload upload){
        return service.selectYpSelinfoResult(upload);
    }

    /**
     * @Description 删除药品销售/销售退货上传信息
     * @Author hsh
     * @param list 药品销售/销售退货上传信息
     * @return map
     * @Date 2025/6/12 0012 17:09
     */
    @PostMapping("/deleteYpSelinfoSoldBatchByCode")
    public ResultVo<Map<String, Object>> deleteYpSelinfoSoldBatchByCode(@RequestBody @Validated List<YpCodgUpload> list){
        return service.deleteYpSelinfoSoldBatchByCode(list);
    }

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

}
