頁面查詢流程
阿新 • • 發佈:2018-11-09
/** * 跳轉至列表頁面時的主邏輯演算法(繫結級聯下拉框) * @param request 請求物件 * @param modelMap 頁面引數集合 * @param source 表單資料來源 * @param mainEntity 主實體bean * @param service 主業務控制器 */ protected void toList_bind(HttpServletRequest request, ModelMap modelMap,FormSource source, SFObject mainEntity, ModuleService service) throws Exception { PersonrangeBean personrangeBean = this.bean(request, PersonrangeBean.class, false); modelMap.put(PersonrangeArgument.VILLAGEIDS, personrangeBean.getCommunids()); COMMUNINFOService comService = IocFactory.instance(COMMUNINFOService.class); DataTable commTable = comService.getArea(); if(!NoneType.isNullOrEmpty(commTable)){ source.add(CommuninfoArgument.COMMUNINFO_PARENT_ID, commTable); } } /** * 跳轉至列表頁面 * @param request 請求物件 * @param response 響應物件 * @param modelMap 頁面引數集合 * @return 頁面檢視控制器 */ @RequestMapping("toList.do") public ModelAndView toList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) { if( NoneType.isNullOrEmpty( request.getParameter(ContextArgument.ATTR_QUERY_TYPE) ) ){ //初始化頁面的queryType查詢型別 request.setAttribute(ContextArgument.ATTR_QUERY_TYPE, StatusType.UNDEFAULT); }else{ this.backfill(request, ContextArgument.ATTR_QUERY_TYPE); } SFObject mainEntity = this.createMainEntity(); ModuleService service = this.createService(); FormSource source = this.source(request); try{ this.toList_bind(request,modelMap,source,mainEntity,service); //將頁面標籤(過濾條件)所需的資料來源載入表單資料來源內。 ( 【 PersonrangeBean personrangeBean = this.bean(request, PersonrangeBean.class, false); //頁面輸入的查詢條件 modelMap.put(PersonrangeArgument.VILLAGEIDS, personrangeBean.getCommunids()); //頁面查詢條件載入到模型檢視標籤id 】 【COMMUNINFOService comService = IocFactory.instance(COMMUNINFOService.class); DataTable commTable = comService.getArea(); if(!NoneType.isNullOrEmpty(commTable)){ source.add(CommuninfoArgument.COMMUNINFO_PARENT_ID, commTable); }(表單資料來源新增資料) 】 ) source.put(modelMap); (查詢條件載入到表單資料來源) }catch(Exception e ){ this.logger.error(e); } return new ModelAndView(this.getActionPath("list"), modelMap); } /** * 查詢社群資訊並繫結至列表頁面(下拉框查詢) * @param request 請求物件 * @param response 響應物件 * @param modelMap 頁面引數集合 * @return 表單資料來源JSON */ @RequestMapping("list.do") public ModelAndView list(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) { COMMUNINFOService service = IocFactory.instance(COMMUNINFOService.class); try { DataPage dataPage = this.getDataPage(request); String orderBy = request.getParameter(ContextArgument.GRID); COMMUNINFO bean = this.bean(request, COMMUNINFO.class); DataTable table = service.table(bean, orderBy,dataPage); FormSource source = this.source(request); source.add(ContextArgument.GRID, table, orderBy ); source.add(ContextArgument.PGINFO, dataPage ); source.put(modelMap); } catch (Exception e) { logger.error(e); } return this.output(response, modelMap); }