package cn.com.countrygarden.bi.main.controller.investment;
import cn.com.countrygarden.bi.main.controller.BaseController;
import cn.com.countrygarden.bi.main.core.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import cn.com.countrygarden.bi.main.model.investment.InvestProjectAccount;
import cn.com.countrygarden.bi.main.dao.investment.InvestProjectAccountMapper;
import cn.com.countrygarden.bi.main.service.investment.InvestProjectAccountService;

/**
 * -业务逻辑层实现
 *
 * @author 汤婷
 * @email www.justintoforest@gamail.com
 * @url 
 * @date 2018-10-05
 */
@RestController("InvestProjectAccountController")
@RequestMapping("/api/investProjectAccount")
public class InvestProjectAccountController extends BaseController{
    @Autowired
    private InvestProjectAccountService investProjectAccountService;


    @GetMapping(value = "/list", produces = "application/json;charset=utf-8")
    public Result list(InvestProjectAccount investProjectAccount,
                       @RequestParam(value = "size", required = false, defaultValue = "10") int size,
                       @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                       HttpServletRequest request){
        return  investProjectAccountService.queryPageList(investProjectAccount,page,size);
    }

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

    @PostMapping(value = "/add")
    public Result add(InvestProjectAccount investProjectAccount,
                      HttpServletRequest request){
        return  investProjectAccountService.add(investProjectAccount,getAccessToken(request));
    }


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


}