package cn.iocoder.yudao.module.stockOperate.controller.admin;


import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * 采购单领料单子表(DlRepairSoi)表控制层
 * @author 小李
 * @date 9:14 2024/9/13
**/
@RestController
@RequestMapping("/repair/soi")
public class DlRepairSoiController{
    /**
     * 服务对象
     */
    @Resource
    private DlRepairSoiService dlRepairSoiService;

    /**
     * 采购单领料单子表 分页
     *
     * @author 小李
     * @date 10:44 2024/9/18
     * @param repairSoiReqVO 查询对象
     * @param pageNo 页码
     * @param pageSize 条数
    **/
    @GetMapping("/page")
    @Operation(summary = "采购单领料单子表 分页")
    public CommonResult<?> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO,
                                            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
        Page<DlRepairSoi> page = new Page<>(pageNo, pageSize);
        return success(dlRepairSoiService.getRepairSoiPage(repairSoiReqVO, page));
    }

    /**
     * 采购单领料单子表详细 按ID查
     *
     * @author 小李
     * @date 11:24 2024/9/22
     * @param ids ids
    **/
    @GetMapping("/get")
    @Operation(summary = "采购单领料单子表详细 按ID查")
    public CommonResult<?> getRepairSoiByIds(@RequestParam(value = "ids") List<String> ids){
        return success(dlRepairSoiService.getRepairSoiByIds(ids));
    }

    /**
     * 按主表ID查
     *
     * @author 小李
     * @date 11:22 2024/10/21
     * @param soId 主表ID
    **/
    @GetMapping("/getBySoId")
    @Operation(summary = "按主表ID查")
    public CommonResult<?> getRepairSoiBySoId(@RequestParam(value = "soId") String soId){
        return success(dlRepairSoiService.getRepairSoiBySoId(soId));
    }
}

