Exemple #1
0
 public Model findDefault(Integer siteId, Integer type) {
   JPAQuery query = new JPAQuery(this.em);
   QModel model = QModel.model;
   query.from(model);
   BooleanBuilder exp = new BooleanBuilder();
   exp = exp.and(model.site.id.eq(siteId));
   exp = exp.and(model.type.eq(type));
   query.where(exp);
   query.orderBy(model.seq.asc());
   query.limit(1);
   List<Model> list = query.list(model);
   return !list.isEmpty() ? list.get(0) : null;
 }
Exemple #2
0
 public List<Model> findList(Integer siteId, Integer type) {
   JPAQuery query = new JPAQuery(this.em);
   QModel model = QModel.model;
   query.from(model);
   BooleanBuilder exp = new BooleanBuilder();
   exp = exp.and(model.site.id.eq(siteId));
   if (type != null) {
     exp = exp.and(model.type.eq(type));
   }
   query.where(exp);
   query.orderBy(model.seq.asc());
   return query.list(model);
 }