package com.changda.gjjapp.zhfwpt.hgqymd.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

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 com.changda.cd4j.foundation.core.dto.ResultDto;
import com.changda.gjjapp.db.entity.M_HGZYQYMD;
import com.changda.gjjapp.zhfwpt.dto.yhxxgl.YongHuXinXiSearchDto;
import com.changda.gjjapp.zhfwpt.qdxxgl.controller.QuDaoXinXiGuanLiController;
import com.changda.gjjapp.zhfwpt.service.hgqymd.HgqymdSerivce;

@Controller()
@RequestMapping(value = "/zhfwpt/hgqymd")
public class HgqymdController {
	
	@Autowired
	private HgqymdSerivce hgqymdSerivce;
	
	// 用户信息查询
	@RequestMapping("query_HGqymd")
	@ResponseBody
	public ResultDto query_HGqymd(HttpServletRequest request) {
		int page = Integer.parseInt(request.getParameter("page"));
		int limit = Integer.parseInt(request.getParameter("limit"));
		ResultDto resultDto = new ResultDto();
		String data = request.getParameter("data");
		boolean a=QuDaoXinXiGuanLiController.SqlFilter2(data);
		if(a){
			resultDto.setData(0);
			resultDto.setMessage("存在sql注入");
			resultDto.setSuccess(false);
		}else{
			//管辖单位
			String gxdw = request.getParameter("gxdw");
			
			Map<String, Object> map = hgqymdSerivce.query_HGqymd(data,gxdw, page, limit);
			List<M_HGZYQYMD> list = (List<M_HGZYQYMD>) map.get("list");
			int total = (int) map.get("total");
			resultDto.setTotal(total);
			resultDto.setData(list);
			resultDto.setSuccess(true);
		}
		
		return resultDto;
	}
	
}
