package com.lightinit.hsdatashow.controller.admin;

import com.lightinit.hsdatashow.dictionary.DicViewMenuTitle;
import com.lightinit.hsdatashow.model.admin.PrecipitationAggregateResultModel;
import com.lightinit.hsdatashow.model.admin.WaterResourceAggregateResultModel;
import com.lightinit.hsdatashow.model.admin.WaterStorageAggregateResultModel;
import com.lightinit.hsdatashow.service.admin.IWaterThingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


@Controller
@RequestMapping(value = "/admin/newWater")
public class NewWaterTingController extends BaseController {

    @Autowired
    private IWaterThingService waterThingService ;

    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("admin/newWater/index");
        //降水总量
        PrecipitationAggregateResultModel jiangshui = waterThingService.getnewPrecipitationAggregate() ;
        modelAndView.addObject("jiangshui",jiangshui) ;
        //水资源总量
        WaterResourceAggregateResultModel shuiziyuan = waterThingService.getWaterResourceAggregate() ;
        modelAndView.addObject("shuiziyuan",shuiziyuan) ;
        //蓄水总量
        WaterStorageAggregateResultModel xushui = waterThingService.getWaterStorageAggregate() ;
        modelAndView.addObject("xushui",xushui) ;
        modelAndView.addObject("title", DicViewMenuTitle.WATER) ;
        return modelAndView;
    }
}
