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

import cn.com.countrygarden.bi.main.constant.wcx.WcxConstant;
import cn.com.countrygarden.bi.main.core.Response;
import cn.com.countrygarden.bi.main.core.Result;
import cn.com.countrygarden.bi.main.dto.wcx.WcxRegionProjectDto;
import cn.com.countrygarden.bi.main.service.wcx.WcxRegionProjectService;
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;

import java.util.List;

/**
 * 各基础业务线点赞前三
 */
@RestController
@RequestMapping("/api/wcx/regionProject")
public class WcxRegionProjectController {
    @Autowired
    private WcxRegionProjectService wcxRegionProjectService;

    /**
     * 绑定erp中的区域
     * @return
     */
    @PostMapping
    public Result bindRegionProject(){
        wcxRegionProjectService.bindRegionProject();
        return Response.response(WcxConstant.DEAL_SUCCESS);
    }

    /**
     * 查询所有的NC区域
     * @return
     */
    @GetMapping("/NCRegionList")
    public Result selectAllNCRegion(){
        List<WcxRegionProjectDto> ncRegPros = wcxRegionProjectService.selectAllNCRegion();
        return Response.response(ncRegPros);
    }

    /**
     * 查询所有的NC区域下NC项目
     * @return
     */
    @GetMapping("/NCProjectList")
    public Result selectAllRegion(String regionName){
        List<WcxRegionProjectDto> ncRegPros = wcxRegionProjectService.selectNCProject(regionName);
        return Response.response(ncRegPros);
    }
}
