/** * AJAX 示例下拉框 * * @param req * @return */ @RequestMapping(params = "getDemo") @ResponseBody public AjaxJson getDemo(HttpServletRequest req) { AjaxJson j = new AjaxJson(); String id = StringUtil.getEncodePra(req.getParameter("id")); String floor = ""; if (StringUtil.isNotEmpty(id)) { if ("ThreeLevelLinkage".equals(id)) { floor += "省:<select name=\"province\" id=\"provinceid\">" + "</select>" + " "; floor += "市:<select name=\"city\" id=\"cityid\">" + "</select>" + " "; floor += "县:<select name=\"county\" id=\"countyid\">" + "</select>" + " "; } else { CriteriaQuery cq = new CriteriaQuery(TSFunction.class); cq.eq("TSFunction.id", id); cq.add(); List<TSFunction> functions = systemService.getListByCriteriaQuery(cq, false); if (functions.size() > 0) { for (TSFunction function : functions) { floor += "<input type=\"checkbox\" name=\"floornum\" id=\"floornum\" value=\"" + function.getId() + "\">" + MutiLangUtil.getMutiLangInstance().getLang(function.getFunctionName()) + " "; } } else { floor += "没有子项目!"; } } } j.setMsg(floor); return j; }
public List<MshopStoreadminEntity> getHeadAdmins() { CriteriaQuery cq = new CriteriaQuery(MshopStoreadminEntity.class); cq.eq("isHead", MshopStoreadminEntity.HEAD); cq.getDetachedCriteria().setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); cq.add(); return getListByCriteriaQuery(cq, false); }
/** demo页面跳转 */ @RequestMapping(params = "demoLayoutList") public ModelAndView demoLayout(HttpServletRequest request) { CriteriaQuery cq = new CriteriaQuery(TSDemo.class); cq.isNull("TSDemo.id"); cq.add(); List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false); request.setAttribute("demoList", demoList); return new ModelAndView("jeecg/demo/base/layout/demoLayoutList"); }
/** 下拉联动跳转 */ @RequestMapping(params = "select") public ModelAndView select(HttpServletRequest request) { // 新闻 CriteriaQuery cq2 = new CriteriaQuery(TSFunction.class); cq2.eq("functionLevel", Globals.Function_Leave_ONE); cq2.add(); List<TSFunction> funList = systemService.getListByCriteriaQuery(cq2, true); request.setAttribute("funList", funList); return new ModelAndView("jeecg/demo/base/AJAX/select"); }
/** * easyuiAJAX请求数据 * * @param request * @param response * @param dataGrid */ @RequestMapping(params = "datagrid") public void datagrid( HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(TSLog.class, dataGrid); String loglevel = request.getParameter("loglevel"); if (loglevel == null || loglevel.equals("0")) { } else { cq.eq("loglevel", oConvertUtils.getShort(loglevel)); cq.add(); } this.systemService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); }
/** * easyuiAJAX列表请求数据 * * @param request * @param response * @param dataGrid */ @RequestMapping(params = "datagrid") public void datagrid( ZkZhBanner entity, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(ZkZhBanner.class, dataGrid); // 查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, entity); // Object[] isshow = {Short.parseShort("1"),Short.parseShort("2")};//搜寻显示或是不显示的内容 // cq.in("isshow", isshow); cq.add(); this.systemService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); }
/** * 部门列表,树形展示 * * @param request * @param response * @param treegrid * @return */ @RequestMapping(params = "departgrid") @ResponseBody public List<TreeGrid> departgrid( TSDepart tSDepart, HttpServletRequest request, HttpServletResponse response, TreeGrid treegrid) { CriteriaQuery cq = new CriteriaQuery(TSDepart.class); // update-begin--Author:sun Date:20130510 for:[089]解决部门名称查询异常 if ("yes".equals(request.getParameter("isSearch"))) { treegrid.setId(null); tSDepart.setId(null); } // ---------------------------------------------------------------- // update-begin--Author:yeshuai Date:20130412 for:增加部门名称搜寻框 if (null != tSDepart.getDepartname()) { org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tSDepart); } // update-end--Author:yeshuai Date:20130412 for:增加部门名称搜寻框 // ---------------------------------------------------------------- if (treegrid.getId() != null) { cq.eq("TSPDepart.id", treegrid.getId()); } if (treegrid.getId() == null) { cq.isNull("TSPDepart"); } cq.add(); List<TreeGrid> departList = null; departList = systemService.getListByCriteriaQuery(cq, false); if (departList.size() == 0 && tSDepart.getDepartname() != null) { cq = new CriteriaQuery(TSDepart.class); TSDepart parDepart = new TSDepart(); tSDepart.setTSPDepart(parDepart); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tSDepart); departList = systemService.getListByCriteriaQuery(cq, false); } // update-end--Author:sun Date:20130510 for:[089]解决部门名称查询异常 List<TreeGrid> treeGrids = new ArrayList<TreeGrid>(); TreeGridModel treeGridModel = new TreeGridModel(); treeGridModel.setTextField("departname"); treeGridModel.setParentText("TSPDepart_departname"); treeGridModel.setParentId("TSPDepart_id"); treeGridModel.setSrc("description"); treeGridModel.setIdField("id"); treeGridModel.setChildList("TSDeparts"); treeGrids = systemService.treegrid(departList, treeGridModel); return treeGrids; }
/** * 父级权限列表 * * @param role * @param request * @param response * @param dataGrid * @param user * @return */ @RequestMapping(params = "setPFunction") @ResponseBody public List<ComboTree> setPFunction(HttpServletRequest request, ComboTree comboTree) { CriteriaQuery cq = new CriteriaQuery(TSDepart.class); if (comboTree.getId() != null) { cq.eq("TSPDepart.id", comboTree.getId()); } if (comboTree.getId() == null) { cq.isNull("TDepart"); } cq.add(); List<TSDepart> departsList = systemService.getListByCriteriaQuery(cq, false); List<ComboTree> comboTrees = new ArrayList<ComboTree>(); comboTrees = systemService.comTree(departsList, comboTree); return comboTrees; }
@RequestMapping(params = "getChildren") @ResponseBody public List<ComboTree> getChildren(HttpServletRequest request, ComboTree comboTree) { CriteriaQuery cq = new CriteriaQuery(TSTerritory.class); if (comboTree.getId() != null) { cq.eq("TSTerritory.id", comboTree.getId()); } else { cq.eq("TSTerritory.id", "1"); // 这个是全国最高级 } cq.addOrder("territoryCode", SortDirection.asc); cq.add(); List<TSTerritory> list = systemService.getListByCriteriaQuery(cq, false); ComboTreeModel comboTreeModel = new ComboTreeModel("id", "territoryName", "TSTerritorys"); List<ComboTree> comboTrees = systemService.ComboTree(list, comboTreeModel, null); return comboTrees; }
/** 父级DEMO下拉菜单 */ @RequestMapping(params = "pDemoList") @ResponseBody public List<ComboTree> pDemoList(HttpServletRequest request, ComboTree comboTree) { CriteriaQuery cq = new CriteriaQuery(TSDemo.class); if (comboTree.getId() != null) { cq.eq("TSDemo.id", comboTree.getId()); } if (comboTree.getId() == null) { cq.isNull("TSDemo"); } cq.add(); List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false); List<ComboTree> comboTrees = new ArrayList<ComboTree>(); ComboTreeModel comboTreeModel = new ComboTreeModel("id", "demotitle", "tsDemos", "demourl"); comboTrees = systemService.ComboTree(demoList, comboTreeModel, null, false); return comboTrees; }
/** * easyui AJAX请求数据 * * @param request * @param response * @param dataGrid * @param user */ @RequestMapping(params = "datagrid") public void datagrid( WeixinExpandconfigEntity weixinExpandconfig, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(WeixinExpandconfigEntity.class, dataGrid); // 查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql( cq, weixinExpandconfig, request.getParameterMap()); try { // 自定义追加查询条件 } catch (Exception e) { throw new BusinessException(e.getMessage()); } cq.add(); this.weixinExpandconfigService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); }
/** * easyui AJAX请求数据 * * @param request * @param response * @param dataGrid * @param user */ @RequestMapping(params = "datagrid") public void datagrid( TbOrderTrackingEntity tbOrderTracking, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(TbOrderTrackingEntity.class, dataGrid); // 查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tbOrderTracking); // System.out.println("tbOrderTrackIng:"+tbOrderTracking.getId()); if (null != tbOrderTracking.getOrderId() && !"".equals(tbOrderTracking.getOrderId()) && null != tbOrderTracking.getOrderId().getId()) { cq.createAlias("orderId", "tbOrders"); cq.eq("orderId.id", tbOrderTracking.getOrderId().getId()); cq.add(); } this.tbOrderTrackingService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); }
/** 权限列表 */ @RequestMapping(params = "demoGrid") @ResponseBody public List<TreeGrid> demoGrid(HttpServletRequest request, TreeGrid treegrid) { CriteriaQuery cq = new CriteriaQuery(TSDemo.class); if (treegrid.getId() != null) { cq.eq("TSDemo.id", treegrid.getId()); } if (treegrid.getId() == null) { cq.isNull("TSDemo"); } cq.add(); List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false); TreeGridModel treeGridModel = new TreeGridModel(); treeGridModel.setTextField("demotitle"); treeGridModel.setParentText("TSDemo_demotitle"); treeGridModel.setParentId("TSDemo_id"); treeGridModel.setSrc("demourl"); treeGridModel.setIdField("id"); treeGridModel.setChildList("tsDemos"); List<TreeGrid> treeGrids = systemService.treegrid(demoList, treeGridModel); return treeGrids; }
@RequestMapping(params = "exportXls") public String exportXls( FullStatisticsMonthEntity fullStatisticsMonth, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid, ModelMap map) { CriteriaQuery cq = new CriteriaQuery(FullStatisticsMonthEntity.class, dataGrid); // 设置默认的排序及排序字雄姿英发 cq.addOrder("sumMonth", SortDirection.desc); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql( cq, fullStatisticsMonth, request.getParameterMap()); List<FullStatisticsMonthEntity> fullStatisticsMonthList = this.fullStatisticsMonthService.getListByCriteriaQuery(cq, false); map.put(NormalExcelConstants.FILE_NAME, "全量统计"); map.put(NormalExcelConstants.CLASS, FullStatisticsMonthEntity.class); ExportParams exportParams = new ExportParams(); map.put(NormalExcelConstants.PARAMS, exportParams); map.put(NormalExcelConstants.DATA_LIST, fullStatisticsMonthList); return NormalExcelConstants.JEECG_EXCEL_VIEW; }
/** * easyuiAJAX请求数据 * * @param request * @param response * @param dataGrid */ @RequestMapping(params = "datagrid") public void datagrid( HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { CriteriaQuery cq = new CriteriaQuery(TSLog.class, dataGrid); String loglevel = request.getParameter("loglevel"); if (loglevel == null || loglevel.equals("0")) { } else { cq.eq("loglevel", oConvertUtils.getShort(loglevel)); cq.add(); } // add-begin--Author:zhangguoming Date:20140427 for:添加查询条件 操作时间 String operatetime_begin = request.getParameter("operatetime_begin"); if (operatetime_begin != null) { Timestamp beginValue = null; try { beginValue = DataUtils.parseTimestamp(operatetime_begin, "yyyy-MM-dd"); } catch (ParseException e) { e.printStackTrace(); } cq.ge("operatetime", beginValue); } String operatetime_end = request.getParameter("operatetime_end"); if (operatetime_end != null) { if (operatetime_end.length() == 10) { operatetime_end = operatetime_end + " 23:59:59"; } Timestamp endValue = null; try { endValue = DataUtils.parseTimestamp(operatetime_end, "yyyy-MM-dd hh:mm:ss"); } catch (ParseException e) { e.printStackTrace(); } cq.le("operatetime", endValue); } cq.add(); // add-end--Author:zhangguoming Date:20140427 for:添加查询条件 操作时间 this.systemService.getDataGridReturn(cq, true); TagUtil.datagrid(response, dataGrid); }
/** * 设置or(Criterion c, CriteriaQuery query, int source)(或)查询条件 * * @param keyname * @param keyvalue1 * @param keyvalue2 */ public Criterion or(Criterion c, CriteriaQuery query, int source) { return Restrictions.or(c, query.getCriterionList().getParas(source)); }
/** * 设置Or查询 * * @param query * @param source条件1 * @param dest条件2 * @return */ public Criterion or(CriteriaQuery query, int source, int dest) { return Restrictions.or( query.getCriterionList().getParas(source), query.getCriterionList().getParas(dest)); }