package cn.com.countrygarden.bi.main.controller.advise;

import cn.com.countrygarden.bi.main.controller.BaseController;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.model.advise.AfAdviseBranchType;
import cn.com.countrygarden.bi.main.service.advise.IAfAdviseBranchTypeService;
import cn.com.countrygarden.bi.main.util.roleUtils.AuthorityCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


/**
 * 建言分支类型-控制层实现
 *
 * @author 木木子
 * @email 944528607@qq.com
 * @url 
 * @date 2019-04-15
 */
@RestController("AfAdviseBranchTypeController")
@RequestMapping("/api/afAdviseBranchType")
public class AfAdviseBranchTypeController extends BaseController{
    @Autowired
    private IAfAdviseBranchTypeService afAdviseBranchTypeService;

    @AuthorityCheck(authorityArray={"adviseSystemAdmin"} )
    @GetMapping(value = "/list", produces = "application/json;charset=utf-8")
    public Result list(AfAdviseBranchType afAdviseBranchType,
                       HttpServletRequest request){
        return  afAdviseBranchTypeService.queryList(afAdviseBranchType);
    }

    @GetMapping(value = "/one", produces = "application/json;charset=utf-8")
    public Result queryById(@RequestParam(value = "id", required = true)Integer id,
                            HttpServletRequest request){
        return  afAdviseBranchTypeService.queryById(id);
    }

    @PostMapping(value = "/addOrEdit")
    public Result add(AfAdviseBranchType afAdviseBranchType,
                      HttpServletRequest request){
        return  afAdviseBranchTypeService.addOrEdit(afAdviseBranchType,getAccessToken(request));
    }



    @DeleteMapping(value="/del")
    public Result del(@RequestParam(value = "id", required = true)Integer id){
        return  afAdviseBranchTypeService.del(id);
    }


}