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

import com.lightinit.hsdatashow.entity.Region;
import com.lightinit.hsdatashow.entity.StWaterConsumer;
import com.lightinit.hsdatashow.entity.StWaterGroundwater;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.model.topic.water.NameAndValueModel;
import com.lightinit.hsdatashow.model.topic.water.RegionAndConsumption;
import com.lightinit.hsdatashow.service.topic.water.IWaterUserService;
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("/topic/water/waterUser")
public class WaterUserController {
    @Autowired
    private IWaterUserService iWaterUserService;

    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("topic/water/wholeCityWater/waterUser") ;
        return modelAndView ;
    }

    /**
     * 地图
     * @return
     */
    @RequestMapping(value = "/getWaterUser.action")
    @ResponseBody
    public ResultState getWaterUser() {
        return iWaterUserService.getWaterUser();
    }

    /**
     * 列表
     * @param regionName
     * @return
     */
    @RequestMapping(value = "/getAreaWaterUser.action")
    @ResponseBody
    public List<RegionAndConsumption> getAreaWaterUser(String regionName) {
        if(regionName=="" || regionName ==null) {
            regionName="安平县";
        }
        return iWaterUserService.getAreaWaterUser(regionName);
    }

    /**
     * 全市取水用户构成
     * @return
     */
        @RequestMapping(value = "/getWaterUserConstitute.action")
        @ResponseBody
        public ResultState getWaterUserConstitute() {
            return iWaterUserService.getWaterUserConstitute();
        }


}
