package com.miaxis.pc.controller.extension;

import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.domain.Response;
import com.miaxis.common.core.page.ResponsePageInfo;
import com.miaxis.extension.domain.WxExtensionIncome;
import com.miaxis.extension.service.IWxExtensionIncomeService;
import com.miaxis.extension.vo.ExtensionIncomeVo;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 【分成收益】Controller
 * @author wwl
 * @version 1.0
 * @date 2021/11/4 15:02
 */
@RestController
@RequestMapping("/pc/extension/income")
@Api(tags={"【PC-分成收益】"})
@AllArgsConstructor
public class ExtensionIncomeController extends BaseController {

    private final IWxExtensionIncomeService wxExtensionIncomeService;


    /**
     * 查询分成收益列表
     */
    @PreAuthorize("@ss.hasPermi('extension:income:list')")
    @GetMapping("/list")
    @ApiOperation("查询分成收益列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
    })
    public ResponsePageInfo<ExtensionIncomeVo> list(@ModelAttribute ExtensionIncomeVo wxExtensionIncome){
        startPage();
        List<ExtensionIncomeVo> list = wxExtensionIncomeService.selectWxExtensionIncomeList(wxExtensionIncome);
        return toResponsePageInfo(list);
    }


    /**
     * 获取分成收益详细信息
     */
    @PreAuthorize("@ss.hasPermi('extension:income:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取分成收益详细信息")
    public Response<WxExtensionIncome> getInfo(
            @ApiParam(name = "id", value = "分成收益参数", required = true)
            @PathVariable("id") Long id
    ){
        return Response.success(wxExtensionIncomeService.getById(id));
    }


}
