for (int k=0; k<pageSize && rs.next(); k++) { Model<?> ar = modelClass.newInstance(); Map<String, Object> attrs = CPI.getAttrs(ar); for (int i=1; i<=columnCount; i++) { Object value;
@SuppressWarnings("rawtypes") public Page<Record> takeOverDbPaginate(Connection conn, int pageNumber, int pageSize, Boolean isGroupBySql, String totalRowSql, StringBuilder findSql, Object... paras) throws SQLException { List result = CPI.query(conn, totalRowSql, paras); int size = result.size(); if (isGroupBySql == null) {
while (rs.next()) { Record record = new Record(); CPI.setColumnsMap(record, config.getContainerFactory().getColumnsMap()); Map<String, Object> columns = record.getColumns(); for (int i=1; i<=columnCount; i++) {
while (rs.next()) { Model<?> ar = modelClass.newInstance(); Map<String, Object> attrs = CPI.getAttrs(ar); for (int i=1; i<=columnCount; i++) { Object value;
@SuppressWarnings({"rawtypes", "unchecked"}) public Page<? extends Model> takeOverModelPaginate(Connection conn, Class<? extends Model> modelClass, int pageNumber, int pageSize, Boolean isGroupBySql, String totalRowSql, StringBuilder findSql, Object... paras) throws Exception { List result = CPI.query(conn, totalRowSql, paras); int size = result.size(); if (isGroupBySql == null) {
while (rs.next()) { Record record = new Record(); CPI.setColumnsMap(record, config.getContainerFactory().getColumnsMap()); Map<String, Object> columns = record.getColumns(); for (int i=1; i<=columnCount; i++) {
protected String doRenderOtherToJson(Object value, int depth) { if (value instanceof Model) { Map map = com.jfinal.plugin.activerecord.CPI.getAttrs((Model) value); addGetterAttrs(map, value); return mapToJson(map, depth); } return super.otherToJson(value, depth); }
long totalRow = 0; int totalPage = 0; List result = CPI.query(conn, "select count(*) " + DbKit.replaceFormatSqlOrderBy(sqlExceptSelect), paras); int size = result.size(); if (size == 1)
while (rs.next()) { Record record = new Record(); CPI.setColumnsMap(record, config.getContainerFactory().getColumnsMap()); Map<String, Object> columns = record.getColumns(); for (int i=1; i<=columnCount; i++) {
Map map = com.jfinal.plugin.activerecord.CPI.getAttrs((Model)value); return mapToJson(map, depth);
long totalRow = 0; int totalPage = 0; List result = CPI.query(conn, "select count(*) " + DbKit.replaceFormatSqlOrderBy(sqlExceptSelect), paras); int size = result.size(); if (size == 1)
while (rs.next()) { Record record = new Record(); CPI.setColumnsMap(record, config.getContainerFactory().getColumnsMap()); Map<String, Object> columns = record.getColumns(); for (int i=1; i<=columnCount; i++) {
while (rs.next()) { Model<?> ar = modelClass.newInstance(); Map<String, Object> attrs = CPI.getAttrs(ar); for (int i=1; i<=columnCount; i++) { Object value;
@SuppressWarnings({"rawtypes", "unchecked"}) public Page<? extends Model> takeOverModelPaginate(Connection conn, Class<? extends Model> modelClass, int pageNumber, int pageSize, Boolean isGroupBySql, String totalRowSql, StringBuilder findSql, Object... paras) throws Exception { List result = CPI.query(conn, totalRowSql, paras); int size = result.size(); if (isGroupBySql == null) {
private Object handleObject(Object value, int depth) { if(value == null || (depth--) <= 0) return value; if (value instanceof List) return handleList((List)value, depth); else if (value instanceof Model) return handleMap(CPI.getAttrs((Model)value), depth); else if (value instanceof Record) return handleMap(((Record)value).getColumns(), depth); else if(value instanceof Map) return handleMap((Map)value, depth); else if (value instanceof Page) return handlePage((Page)value, depth); else if (value instanceof Object[]) return handleArray((Object[])value, depth); else return value; }
@SuppressWarnings("rawtypes") public Page<Record> takeOverDbPaginate(Connection conn, int pageNumber, int pageSize, Boolean isGroupBySql, String totalRowSql, StringBuilder findSql, Object... paras) throws SQLException { List result = CPI.query(conn, totalRowSql, paras); int size = result.size(); if (isGroupBySql == null) {
/** * 将model转为json字符串 * @param model * @return JsonString */ public static String toJson(Model<? extends Model<?>> model) { return toJson(CPI.getAttrs(model)); }
/** * 将Collection<Model>转换为json字符串 * @param models jfinal model * @return JsonString */ public static String toJson(Collection<Model<? extends Model<?>>> models) { List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); for (Model<? extends Model<?>> model : models) { list.add(CPI.getAttrs(model)); } return toJson(list); }
/** * 将model转为json字符串 * @param model jfinal model * @return JsonString */ public static String toJson(Model<? extends Model<?>> model) { return toJson(CPI.getAttrs(model)); }
/** * 将Collection<Model>转换为json字符串 * @param models * @return JsonString */ public static String toJson(Collection<Model<? extends Model<?>>> models) { List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); for (Model<? extends Model<?>> model : models) { list.add(CPI.getAttrs(model)); } return toJson(list); }