package com.cloudcross.ssp.web.back.main.ad.report;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.cloudcross.ssp.base.web.SimpleController;
import com.cloudcross.ssp.common.utils.Pager;
import com.cloudcross.ssp.model.TypeReport;
import com.cloudcross.ssp.service.ITypeReportService;



/**
 * 媒体数据报表中类型报表控制
 * @author Hao
 *
 */
@Controller("back.typeReportController")
@RequestMapping("/back/main/ad/report/media-report")
public class TypeReportController extends SimpleController{
	
	@Autowired
	private ITypeReportService typeReportService;
	
	//类型报表
	@RequestMapping("/type")
	public String type(Model model,
			@RequestParam HashMap<String, Object> paramMap,
			@RequestParam(defaultValue="1") int page,
			@RequestParam(required = false) Long  operatorId){
		
	       paramMap.put("operatorId", operatorId);
	       model.addAttribute("operatorId",operatorId);
		
		
		int totalRow = typeReportService.countByParams(paramMap);
		Pager pager = new Pager();
		pager.setPage(page);
		pager.setTotalRow(totalRow);
		
		List<TypeReport> reportList = typeReportService.findByParams(paramMap, pager);
		
		model.addAllAttributes(paramMap);
		model.addAttribute("pager",pager);
		model.addAttribute("reportList",reportList);
		
		return page("type");
		
		
		
	}
	


}
