package cn.pluss.platform.controller;

import cn.pluss.platform.UserMakerQuota.UserMakerQuotaService;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import lombok.RequiredArgsConstructor;
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 java.math.BigDecimal;
import java.util.Map;

/**
 * @author lyf
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/userMakerQuota")
public class UserMakerQuotaController {
    @Resource
    private UserMakerQuotaService userMakerQuotaService;

    /**
     * 汇总数据
     * @return
     */
    @GetMapping("/quota")
    public Result<Object> quota() {
        Map<String, BigDecimal> quota = userMakerQuotaService.quota();
        return ResultGenerator.genSuccessResult(quota);
    }

    /**
     * 额度明细
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/quotaInfo")
    public Result<Object> quotaList(Integer page, Integer size, Integer type){
        return ResultGenerator.genSuccessResult(userMakerQuotaService.quotaList(page,size,type));
    }

}
