package com.lightinit.hsdatashow.controller.topic.water;

import com.lightinit.hsdatashow.entity.StWaterGroundwaterMonitoringStation;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.model.topic.water.MonitoringStatioSearchModel;
import com.lightinit.hsdatashow.model.topic.water.NameAndValueModel;
import com.lightinit.hsdatashow.service.topic.water.IGroundwaterMonitoringStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping(value = "/topic/water/groundwaterMonitoringStation")
public class GroundwaterMonitoringStationController {
    @Autowired
    private IGroundwaterMonitoringStationService iGroundwaterMonitoringStationService;
    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("topic/water/wholeCityWater/groundwater") ;
        return modelAndView ;
    }

    /**
     * 地下水监测站区县构成
     * @return
     */
    @RequestMapping(value = "/getAreaConstitute.action")
    @ResponseBody
    public ResultState getAreaConstitute() {
        return iGroundwaterMonitoringStationService.getAreaConstitute();
    }

    /**
     * 监测站网类型构成图
     * @return
     */
    @RequestMapping(value = "/getMonitoringStationType.action")
    @ResponseBody
    public ResultState getMonitoringStationType() {
        return iGroundwaterMonitoringStationService.getMonitoringStationType();
    }

    /**
     * 各区县地下水位监测站网分布
     * @return
     */
    @RequestMapping(value = "/getMonitoringStation.action")
    @ResponseBody
    public List<StWaterGroundwaterMonitoringStation> getMonitoringStation(MonitoringStatioSearchModel searchModel) {
        if(searchModel.getRegionName().equals("")|| searchModel.getRegionName()==null) {
            searchModel.setRegionName("安平县");
        }
        List<StWaterGroundwaterMonitoringStation> list = iGroundwaterMonitoringStationService.getMonitoringStation(searchModel);
        return list;
    }


}
