入口
@At("/data")
@Ok("json")
@RequiresAuthentication
public Object data(@Param("appname") String appname,@Param("length") int length, @Param("start") int start, @Param("draw") int draw,@Param("startTime") String stime,@Param("endTime") String etime) {
Cnd cnd = Cnd.NEW();
Subject subject = SecurityUtils.getSubject();
String uid="";
if (subject != null) {
uid= (String) subject.getSession(true).getAttribute("uid");
}
if(!StringUtils.isBlank(appname)) {
cnd.and("appname", "like", String.format("%%s%%",appname));
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(!StringUtils.isBlank(stime)&&!StringUtils.isBlank(etime))
{
String sdate=stime+" 00:00:00";
String edate=etime+" 23:59:59";
cnd.and("createtime",">=",sdate);
cnd.and("createtime","<=",edate);
}else
{
if(!StringUtils.isBlank(stime)) {
String sdate = stime + " 00:00:00";
String edate = stime + " 23:59:59";
cnd.and("createtime", ">=", sdate);
cnd.and("createtime", "<=", edate);
}
}
cnd.and("opBy","=",uid);
cnd.orderBy("opAt","DESC");
return trackingAppService.data(length, start, draw, null, null, cnd, null);
}
service
public NutMap data(int length, int start, int draw, List<DataTableOrder> orders, List<DataTableColumn> columns, Cnd cnd, String linkName) {
NutMap re = new NutMap();
Pager pager = new OffsetPager(start, length);
re.put("recordsFiltered", this.dao().count(this.getEntityClass(), cnd));
List<?> list = this.dao().query(this.getEntityClass(), cnd, pager);
re.put("data", list);
re.put("draw", draw);
re.put("recordsTotal", length);
return re;
}