package cn.newfeifan.mall.module.distri.controller.app.orderpercentage;

import cn.newfeifan.mall.framework.common.pojo.CommonResult;
import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
import cn.newfeifan.mall.module.distri.controller.app.orderpercentage.vo.*;
import cn.newfeifan.mall.module.distri.dal.dataobject.orderpercentage.OrderPercentageDO;
import cn.newfeifan.mall.module.distri.service.orderpercentage.OrderPercentageService;
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.*;

import javax.annotation.Resource;

import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 积分相关计算浮动百分比设置")
@RestController
@RequestMapping("/distri/order-percentage")
@Validated
public class OrderPercentageController {

    @Resource
    private OrderPercentageService orderPercentageService;

    @GetMapping("/get")
    @Operation(summary = "获得积分相关计算浮动百分比设置")
    public CommonResult<OrderPercentageRespVO> getOrderPercentage() {
        OrderPercentageDO orderPercentage = orderPercentageService.queryStatus();
        return success(BeanUtils.toBean(orderPercentage, OrderPercentageRespVO.class));
    }

}