/** * @param limit limit * @param offset offset * @param whereStatement where cause * @param args args * @return Page * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public Page<T> selectPage(int limit, int offset, String whereStatement, Object... args) { Query query = model.dialect().select(model, whereStatement, args); query.use(db()); Page<T> r = (Page<T>) query.getPage(getResultCreator(query), limit, offset); return r; }
/** * @param limit limit * @param offset offset * @param example Example * @return Page * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public Page<T> selectPageByExample(int limit, int offset, Example example) { Query w = QEH.getQuery(example); Query query = model.dialect().select(model, w.getSql(), w.getParameters()); query.use(db()); Page<T> r = (Page<T>) query.getPage(getResultCreator(query), limit, offset); return r; }
/** * @param example Example * @return the first record * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public T selectOneByExample(Example example) { Query w = QEH.getQuery(example); Query query = model.dialect().selectOne(model, w.getSql(), w.getParameters()); query.use(db()); T r = (T) query.getResult(getResultCreator(query)); return r; }
/** * @param example Example * @return DataTable * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public DataTable<T> selectByExample(Example example) { Query w = QEH.getQuery(example); Query query = model.dialect().select(model, w.getSql(), w.getParameters()); query.use(db()); DataTable<T> r = (DataTable<T>) query.getList(getResultCreator(query)); return r; }
/** * @param whereStatement where cause * @param args args * @return DataTable * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public DataTable<T> select(String whereStatement, Object... args) { Query query = model.dialect().select(model, whereStatement, args); query.use(db()); return (DataTable<T>) query.getList(getResultCreator(query)); }
/** * @param whereStatement where cause * @param args args * @return count of records * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public long count(String whereStatement, Object... args) { Query query = model.dialect().count(model, whereStatement, args); query.use(db()); return query.getResult(Long.class); }
/** * @param example Example * @return count of records * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String, Object...) */ public long count(Example example) { Query w = QEH.getQuery(example); return count(w.getSql(), w.getParameters()); }
public long count() { Query query = model.dialect().count(model, null); query.use(db()); return query.getResult(Long.class); }
/** * @param whereStatement where cause * @param args args * @return the first record * @see com.tsc9526.monalisa.core.resources.HelpDoc#helpQuery(int,int,Example,String,Object...) */ public T selectOne(String whereStatement, Object... args) { Query query = model.dialect().selectOne(model, whereStatement, args); query.use(db()); T r = (T) query.getResult(getResultCreator(query)); return r; }