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

import com.sqx.common.utils.Result;
import com.sqx.modules.bl.commission.ywy.entity.YwyApply;
import com.sqx.modules.bl.commission.ywy.service.YwyApplyService;
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/ywyApply")
@Api(value = "分佣管理", tags = {"业务员申请"})
public class YwyApplyController {

    @Autowired
    private YwyApplyService service;

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

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

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

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

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

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

}
