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

import com.sqx.common.utils.Result;
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
import com.sqx.modules.bl.commission.jjr.entity.JjrApply;
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
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/jjrApply")
@Api(value = "分佣管理", tags = {"经纪人申请"})
public class JjrApplyController {

    @Autowired
    private JjrApplyService service;

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

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

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

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

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

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

}
