public void gen() { try { Template conftempalte = VelocityUtil.getTemplate("/gencode/conf/paginesql.vm"); VelocityContext context = new VelocityContext(); context.put("conditions", gencodeService.getConditions()); context.put("sorts", gencodeService.getSortFields()); context.put("needsort", gencodeService.needsort()); context.put("tableName", gencodeService.getModuleMetaInfo().getTableName()); if (gencodeService.isPagineWithDBRownumberOver()) { if (sql.getOptype() == Constant.listquery) { context.put("pagineWithDBRownumberOver", false); context.put("pagineOrderBy", false); } else if (sql.getOptype() == Constant.pagineOrderBy) { context.put("pagineWithDBRownumberOver", true); context.put("pagineOrderBy", true); } else if (sql.getOptype() == Constant.paginequery) { context.put("pagineWithDBRownumberOver", true); context.put("pagineOrderBy", false); } } else { context.put("pagineWithDBRownumberOver", false); } sql.setSql( gencodeService.writetostring( context, conftempalte, gencodeService.getModuleMetaInfo().getEncodecharset())); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void gen() { File conf = gencodeService.getListJsp(); if (conf.exists()) { conf.delete(); } try { conf.createNewFile(); Template conftempalte = VelocityUtil.getTemplate("/gencode/ui/" + gencodeService.getTheme() + "/list.vm"); VelocityContext context = new VelocityContext(); context.put("company", gencodeService.getModuleMetaInfo().getCompany()); context.put("gendate", gencodeService.getModuleMetaInfo().getDate()); context.put("author", gencodeService.getModuleMetaInfo().getAuthor()); context.put("version", gencodeService.getModuleMetaInfo().getVersion()); context.put("conditions", gencodeService.getConditions()); context.put("fields", gencodeService.getListShowFields()); context.put("hiddenfields", gencodeService.getListHiddenFields()); context.put("moduleName", gencodeService.getModuleMetaInfo().getModuleName()); context.put("moduleCNName", gencodeService.getModuleMetaInfo().getModuleCNName()); context.put("entityVarName", gencodeService.getEntityParamName()); context.put("entityName", gencodeService.getEntityName()); context.put("primaryKeyName", gencodeService.getPrimaryKeyName()); context.put("namespacei18n", gencodeService.getNamespacei18n()); context.put("relativePath", gencodeService.getRelativePath()); context.put("genI18n", gencodeService.isGenI18n()); gencodeService.writFile( context, conftempalte, conf, gencodeService.getModuleMetaInfo().getEncodecharset()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }