package cn.newfeifan.mall.module.distri.controller.admin.usertopupconsumptionpointsorder;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.*;
import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.common.pojo.CommonResult;
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;


import cn.newfeifan.mall.module.distri.controller.admin.usertopupconsumptionpointsorder.vo.*;
import cn.newfeifan.mall.module.distri.dal.dataobject.usertopupconsumptionpointsorder.UserTopUpConsumptionPointsOrderDO;
import cn.newfeifan.mall.module.distri.service.usertopupconsumptionpointsorder.UserTopUpConsumptionPointsOrderService;

@Tag(name = "管理后台 - 用户充值消费分订单")
@RestController
@RequestMapping("/distri/user-top-up-consumption-points-order")
@Validated
public class UserTopUpConsumptionPointsOrderController {

    @Resource
    private UserTopUpConsumptionPointsOrderService userTopUpConsumptionPointsOrderService;

    @GetMapping("/page")
    @Operation(summary = "获得用户充值消费分订单分页")
    @PreAuthorize("@ss.hasPermission('distri:user-top-up-consumption-points-order:query')")
    public CommonResult<PageResult<UserTopUpConsumptionPointsOrderRespVO>> getUserTopUpConsumptionPointsOrderPage(@Valid UserTopUpConsumptionPointsOrderPageReqVO pageReqVO) {
        PageResult<UserTopUpConsumptionPointsOrderDO> pageResult = userTopUpConsumptionPointsOrderService.getUserTopUpConsumptionPointsOrderPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, UserTopUpConsumptionPointsOrderRespVO.class));
    }

}