Tabnine Logo
QueryCriteria$Criteria
Code IndexAdd Tabnine to your IDE (free)

How to use
QueryCriteria$Criteria
in
cn.uncode.dal.criteria

Best Java code snippets using cn.uncode.dal.criteria.QueryCriteria$Criteria (Showing top 11 results out of 315)

origin: uncodecn/uncode-dal-all

Jongo jongo = new Jongo(db);
for(Criteria criteria:queryCriteria.getOredCriteria()){
  for(Criterion criterion:criteria.getAllCriteria()){
    coditon = buildCriteria(criterion, coditon);
origin: uncodecn/uncode-dal-all

com.mongodb.client.MongoDatabase db = database.getMongoDB();
for(Criteria criteria:queryCriteria.getOredCriteria()){
  for(Criterion criterion:criteria.getAllCriteria()){
    coditon = buildCriteria(criterion, coditon);
origin: uncodecn/uncode-dal-all

Jongo jongo = new Jongo(db);
for(Criteria criteria:queryCriteria.getOredCriteria()){
  for(Criterion criterion:criteria.getAllCriteria()){
    coditon = buildCriteria(criterion, coditon);
origin: uncodecn/uncode-dal-all

/**
 * 快速封装查询条件
 * @param condition Condition条件枚举
 * @param filed 字段
 * @param value 值
 * @return
 */
public Criteria append(Condition condition, String filed, Object value){
  if(condition == Condition.EQUAL){
    andColumnEqualTo(filed, value);
  }else if(condition == Condition.NOT_EQUAL){
    andColumnNotEqualTo(filed, value);
  }else if(condition == Condition.GREATER_THAN){
    andColumnGreaterThan(filed, value);
  }else if(condition == Condition.GREATER_THAN_OR_EQUAL){
    andColumnGreaterThanOrEqualTo(filed, value);
  }else if(condition == Condition.LESS_THAN){
    andColumnLessThan(filed, value);
  }else if(condition == Condition.LESS_THAN_OR_EQUAL){
    andColumnLessThanOrEqualTo(filed, value);
  }else if(condition == Condition.LIKE){
    andColumnLike(filed, value);
  }else if(condition == Condition.SQL){
    andColumnSql(value.toString());
  }else{
    andColumnEqualTo(filed, value);
  }
  return this;
}

origin: uncodecn/uncode-dal-all

@Override
public int _deleteByCriteria(Table table) {
  Map<String, Object> coditon = new HashMap<String, Object>();
  try {
    QueryCriteria queryCriteria = table.getQueryCriteria();
    DB db = database.getDB();
    Jongo jongo = new Jongo(db);
    for(Criteria criteria:queryCriteria.getOredCriteria()){
      for(Criterion criterion:criteria.getAllCriteria()){
        coditon = buildCriteria(criterion, coditon);
      }
    }
    Find find = jongo.getCollection(queryCriteria.getTable()).find(JsonUtils.objToJson(coditon));
    Iterator<Map> iterator = find.as(Map.class).iterator();  
    while (iterator.hasNext()) {
      Map<String, Object> map = iterator.next();
      if (null != map) {
        if(map.containsKey("_id")){
          jongo.getCollection(table.getTableName()).remove(new ObjectId(String.valueOf(map.get("_id"))));
        }
      }
    }
  } catch (MongoException e) {
    LOG.error("mongo delete error", e);
  }
  return 1;
}
origin: uncodecn/uncode-dal-all

@Override
public int _updateByCriteria(Table table) {
  Map<String, Object> coditon = new HashMap<String, Object>();
  try {
    QueryCriteria queryCriteria = table.getQueryCriteria();
    com.mongodb.client.MongoDatabase db = database.getMongoDB();
    for(Criteria criteria:queryCriteria.getOredCriteria()){
      for(Criterion criterion:criteria.getAllCriteria()){
        coditon = buildCriteria(criterion, coditon);
      }
    }
    Map<String, Object> vaule = new HashMap<String, Object>();
    vaule.put("$set", table.getParams());
    db.getCollection(queryCriteria.getTable()).updateMany(Document.parse((JSON.serialize(coditon))), Document.parse(JSON.serialize(vaule)));
    LOG.debug("updateByCriteria->collection:"+table.getTableName()+",value:"+JSON.serialize(vaule)+",condition:"+JSON.serialize(coditon));
  } catch (MongoException e) {
    LOG.error("mongo update error", e);
  }
  return 1;
}
origin: uncodecn/uncode-dal-all

@Override
public int _countByCriteria(Table table) {
  int count = 0;
  Map<String, Object> coditon = new HashMap<String, Object>();
  try {
    QueryCriteria queryCriteria = table.getQueryCriteria();
    com.mongodb.client.MongoDatabase db = database.getMongoDB();
    for(Criteria criteria:queryCriteria.getOredCriteria()){
      for(Criterion criterion:criteria.getAllCriteria()){
        coditon = buildCriteria(criterion, coditon);
      }
    }
    long size = db.getCollection(queryCriteria.getTable()).count(Document.parse((JSON.serialize(coditon))));
    LOG.debug("countByCriteria->collection:"+queryCriteria.getTable()+",script:"+JSON.serialize(coditon));
    count = (int) size;
  } catch (MongoException e) {
    LOG.error("mongo find error", e);
  }
  LOG.debug("_countByCriteria->result:"+count);
  return count;
}
origin: uncodecn/uncode-dal-all

public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((orderByClause == null) ? 0 : orderByClause.hashCode());
  result = prime * result + ((database == null) ? 0 : database.hashCode());
  result = prime * result + ((table == null) ? 0 : table.hashCode());
  result = prime * result + ((version == null) ? 0 : version.hashCode());
  result = prime * result + ((groupBy == null) ? 0 : groupBy.hashCode());
  result = prime * result + (distinct ? 1231 : 1237);
  result = prime * result + (selectOne ? 1231 : 1237);
  result = prime * result + pageIndex + pageSize;
  result = prime * result + recordIndex + limit;
  if (oredCriteria != null) {
    for (Criteria criteria : oredCriteria) {
      for (Criterion cter : criteria.getAllCriteria()) {
        result = prime * result + ((cter== null)?0:cter.hashCode());
      }
    }
  }
  return result;
}

origin: uncodecn/uncode-dal-all

@Override
public int _countByCriteria(Table table) {
  int count = 0;
  Map<String, Object> coditon = new HashMap<String, Object>();
  try {
    QueryCriteria queryCriteria = table.getQueryCriteria();
    DB db = database.getDB();
    Jongo jongo = new Jongo(db);
    for(Criteria criteria:queryCriteria.getOredCriteria()){
      for(Criterion criterion:criteria.getAllCriteria()){
        coditon = buildCriteria(criterion, coditon);
      }
    }
    long size = jongo.getCollection(queryCriteria.getTable()).count(JsonUtils.objToJson(coditon));
    count = (int) size;
  } catch (MongoException e) {
    LOG.error("mongo find error", e);
  }
  return count;
}
origin: uncodecn/uncode-dal-all

@Override
public int _deleteByCriteria(Table table) {
  Map<String, Object> coditon = new HashMap<String, Object>();
  try {
    QueryCriteria queryCriteria = table.getQueryCriteria();
    com.mongodb.client.MongoDatabase db = database.getMongoDB();
    for(Criteria criteria:queryCriteria.getOredCriteria()){
      for(Criterion criterion:criteria.getAllCriteria()){
        coditon = buildCriteria(criterion, coditon);
      }
    }
    db.getCollection(queryCriteria.getTable()).deleteMany(Document.parse((JSON.serialize(coditon))));
    LOG.debug("deleteByCriteria->collection:"+table.getTableName()+",condition:"+JSON.serialize(coditon));
  } catch (MongoException e) {
    LOG.error("mongo delete error", e);
  }
  return 1;
}
origin: uncodecn/uncode-dal-all

protected Criteria createCriteriaInternal() {
  Criteria criteria = new Criteria();
  return criteria;
}
cn.uncode.dal.criteriaQueryCriteria$Criteria

Most used methods

  • getAllCriteria
  • <init>
  • andColumnEqualTo
  • andColumnGreaterThan
  • andColumnGreaterThanOrEqualTo
  • andColumnLessThan
  • andColumnLessThanOrEqualTo
  • andColumnLike
  • andColumnNotEqualTo
  • andColumnSql
  • append
    快速封装查询条件
  • getCriteria
  • append,
  • getCriteria,
  • isValid

Popular in Java

  • Start an intent from android
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • findViewById (Activity)
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JButton (javax.swing)
  • JFrame (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now