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

import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.InspectionBatchSettlementOrder;
import cn.iocoder.yudao.module.inspection.entity.InspectionBatchSettlementOrderQuery;
import cn.iocoder.yudao.module.inspection.service.IInspectionBatchSettlementOrderService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
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;

@RestController
@RequestMapping("/batchSettlement")
@RequiredArgsConstructor
public class InspectionBatchSettlementOrderController {

    private final IInspectionBatchSettlementOrderService batchSettlementOrderService;

    /**
     * 分页查询
     *
     * @param pageNo   页码
     * @param pageSize 每页数量
     * @param query    查询条件
     * @return 分页结果
     */
    @GetMapping("/page")
    public CommonResult<?> page(@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
                                InspectionBatchSettlementOrderQuery query) {
        Page<InspectionBatchSettlementOrder> page = new Page<>(pageNo, pageSize);

        return CommonResult.success(batchSettlementOrderService.pageVo(page, query));
    }

}
