package com.sqx.modules.bl.commission.fxy.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
import com.sqx.modules.bl.commission.fxy.service.FxyApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/commission/fxyApply")
@Api(value = "分佣管理", tags = {"分销员申请"})
public class FxyApplyController {

    @Autowired
    private FxyApplyService service;

    @GetMapping("/findPage")
    @ApiOperation("查询（分页）")
    public Result findPage(FxyApply fxyApply){
        return service.findPage(fxyApply);
    }

    @PostMapping("/add")
    @ApiOperation("添加")
    public Result add(FxyApply fxyApply){
        service.add(fxyApply);
        return Result.success();
    }

    @PostMapping("/update")
    @ApiOperation("修改")
    public Result update(FxyApply fxyApply){
        service.update(fxyApply);
        return Result.success();
    }

    @PostMapping("/delete")
    @ApiOperation("删除")
    public Result delete(FxyApply fxyApply){
        service.removeById(fxyApply.getId());
        return Result.success();
    }

    @PostMapping("/approve")
    @ApiOperation("审批")
    public Result approve(FxyApply fxyApply){
        service.approve(fxyApply);
        return Result.success();
    }

    @GetMapping("/findUserPage")
    @ApiOperation("查询（分页）")
    public Result findUserPage(FxyApply fxyApply){
        return service.findUserPage(fxyApply);
    }


}
