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.dto.advise.param.AdviseResponsiblerParam;
import cn.com.countrygarden.bi.main.service.advise.IAfAdviseResponsiblerService;
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("AfAdviseResponsiblerController")
@RequestMapping("/api/afAdviseResponsibler")
public class AfAdviseResponsiblerController extends BaseController{
    @Autowired
    private IAfAdviseResponsiblerService afAdviseResponsiblerService;

    @AuthorityCheck(authorityArray={"adviseSystemAdmin"} )
    @GetMapping(value = "/list", produces = "application/json;charset=utf-8")
    public Result list(AdviseResponsiblerParam adviseResponsiblerParam,

                       HttpServletRequest request){
        return  afAdviseResponsiblerService.queryList(adviseResponsiblerParam,getAccessToken(request));
    }


    @AuthorityCheck(authorityArray={"adviseSystemAdmin"} )
    @PostMapping(value = "/addOrEdit")
    public Result addOrEdit(@RequestParam(value = "data", required = true)String data,@RequestParam(value = "branchTypeCode", required = true)String branchTypeCode,
                      HttpServletRequest request){


        return  afAdviseResponsiblerService.addOrEdit(data,branchTypeCode,getAccessToken(request));
    }



    @AuthorityCheck(authorityArray={"adviseSystemAdmin"} )
    @GetMapping(value="/del")
    public Result del(@RequestParam(value = "ids", required = true)String ids){
        return  afAdviseResponsiblerService.del(ids);
    }


}