예제 #1
0
  /**
   * @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;
  }
예제 #2
0
  /**
   * @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;
  }
예제 #3
0
  /**
   * @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;
  }
예제 #4
0
  /**
   * @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;
  }
예제 #5
0
  /**
   * @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));
  }
예제 #6
0
 /**
  * @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);
 }
예제 #7
0
  /**
   * @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());
  }
예제 #8
0
 public long count() {
   Query query = model.dialect().count(model, null);
   query.use(db());
   return query.getResult(Long.class);
 }
예제 #9
0
 /**
  * @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;
 }