81,092
社区成员
发帖
与我相关
我的任务
分享
@RequestMapping(value = "list.do", method = RequestMethod.POST)
public @ResponseBody List<HashMap> getCompanyList(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "AjaxQuery") String AjaxQuery) {
List<HashMap> list = companySercive.findListByAjaxKey(AjaxQuery);
return list;// JsonModel.listToJSON(list);
}
@RequestMapping(params = "queryPeopleStream")
public @ResponseBody List<QueryPeopleYear> queryPeopleStream(QueryPeopleYear QueryPeopleYear,HttpServletRequest request) {
String sql = "select DATE_FORMAT (t.date,'%Y-%m') month,sum(t.out_total) out_total,sum(enter_total) enter_total from monitor_people_stream t where DATE_FORMAT(date_sub(curdate(),interval 12 month),'%Y-%m') group by month";
String yearSql = "select DATE_FORMAT (t.date,'%Y') year,sum(t.out_total) out_total,sum(enter_total) enter_total from monitor_people_stream t where DATE_FORMAT(date_sub(curdate(),interval 12 month),'%Y-%m') group by year";
List<QueryPeopleYear> queryPeopleStreamList = jdbcDao.find(yearSql, QueryPeopleYear.class, null);
// System.out.println("list.size="+queryPeopleStreamList.size());
// for(QueryPeopleStreamEntity entity:queryPeopleStreamList){
// System.out.println("统计数据为:"+entity.getEnterTotal()+";"+entity.getDay());
// }
request.setAttribute("queryPeopleStreamList", queryPeopleStreamList);
Map<String,List> model = new HashMap<String,List>();
model.put("queryPeopleStreamList", queryPeopleStreamList);
String data = JsonUtils.object2Json(queryPeopleStreamList);
System.out.println("data = "+data);
model.put("queryPeopleList", queryPeopleStreamList);
ModelAndView mav = new ModelAndView("monitor/queryPeopleStreamList",model);
mav.addObject("queryPeopleList", data);
return queryPeopleStreamList;
}
jsp为:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script src="plug-in/monitor/js/ajax-pushlet-client.js"></script>
<style>
#main{width:auto;height:auto;}
#left{width:auto;height:600px;}
#right{width:auto;height:600px;margin-left:0px;}
#left,#right{float:left;}
</style>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div id="main">
<div class="easyui-layout" fit="true" id="right">
<div region="center" style="padding:1px;">
<t:datagrid name="queryPeopleStreamList" title="客流信息查询" actionUrl="queryPeopleStreamController.do?datagrid" idField="id" fit="true">
<t:dgCol title="编号" field="id" hidden="false"></t:dgCol>
<t:dgCol title="日期" field="date" formatter="yyyy-MM-dd hh:mm:ss"></t:dgCol>
<t:dgCol title="总入园人数" field="enterTotal" ></t:dgCol>
<t:dgCol title="总出园人数" field="outTotal" ></t:dgCol>
<t:dgCol title="滞园人数" field="leftTotal" ></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgDelOpt title="删除" url="queryPeopleStreamController.do?del&id={id}" />
<t:dgToolBar title="录入" icon="icon-add" url="queryPeopleStreamController.do?addorupdate" funname="add"></t:dgToolBar>
<t:dgToolBar title="编辑" icon="icon-edit" url="queryPeopleStreamController.do?addorupdate" funname="update"></t:dgToolBar>
<t:dgToolBar title="查看" icon="icon-search" url="queryPeopleStreamController.do?addorupdate" funname="detail"></t:dgToolBar>
</t:datagrid>
</div>
</div>
</div>
<script type="text/javascript">
// function getRtmMsg(show){
// $.ajax({
// type:"POST",
// url:"monitorPeopleStreamController.do?monitorPeopleStream",
// data:"show="+show,
// success: function(msg){
// if(msg!=null){
// bottomRight();
// getRtmMsg("0");
// }
// }
// });
// }
// function bottomRight(){
// alert("aaaaa");
// }
// $(function(){
// PL._init();
// PL.joinListen('/getNewMessage');
// PL.setFun(onData);
// });
// function onData(event) {
// var tipMessage = event.get("message");
// if(tipMessage != undefined && tipMessage != ""){
// alert("aaa");
// showMessage("收到新消息:【" + tipMessage + "】");
// }
// }
PL._init();
PL.joinListen('/cuige/he');
function onData(event) {
alert(event.get("mess"));
// 离开
// PL.leave();
}
</script>
这是jeecg的开源框架,我想重用jsp的datagrid ,但是不管控制类的业务逻辑怎么写,都是显示数据库的表数据