package cn.iocoder.yudao.module.system.controller.admin.biz;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.ElderlyCcbPayOrderRecordPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.ElderlyCcbPayOrderRecordRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyCcbPayOrderRecordDO;
import cn.iocoder.yudao.module.system.service.biz.ElderlyCcbPayOrderRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Objects;

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

@Tag(name = "管理后台 - 建行支付账单记录")
@RestController
@RequestMapping("/elderly/ccb-pay-order-record")
@Validated
public class ElderlyCcbPayOrderRecordController {

    @Resource
    private ElderlyCcbPayOrderRecordService elderlyCcbPayOrderRecordService;

    @GetMapping("/page")
    @Operation(summary = "获得建行支付账单记录分页")
    @TenantIgnore
    public CommonResult<PageResult<ElderlyCcbPayOrderRecordRespVO>> getPage(@Valid ElderlyCcbPayOrderRecordPageReqVO pageReqVO) {
        pageReqVO.setTenantIds(Objects.isNull(pageReqVO.getTenantIds()) ? new Long[]{TenantContextHolder.getTenantId()} : pageReqVO.getTenantIds());
        PageResult<ElderlyCcbPayOrderRecordDO> pageResult = elderlyCcbPayOrderRecordService.getPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, ElderlyCcbPayOrderRecordRespVO.class));
    }
}
