Exemple #1
0
 public ISelecter whereRightLike(String column, Object value) {
   Rule r = new Rule();
   r.setColumn(column);
   r.setOpStart(" like ");
   wheres.add(r);
   paramWheres.add("%" + value);
   return this;
 }
Exemple #2
0
 public ISelecter column(String... column) {
   for (String c : column) {
     Rule rule = new Rule();
     rule.setColumn(c);
     cols.add(rule);
   }
   return this;
 }
Exemple #3
0
 public ISelecter where(String sql) {
   Rule r = new Rule();
   r.setColumn(sql);
   r.setOpStart("");
   r.setTag("");
   r.setOpEnd("");
   wheres.add(r);
   return this;
 }
Exemple #4
0
 public IExecuter whereSql(String sql, Object[] values) {
   Rule r = new Rule();
   r.setColumn(sql);
   r.setOpStart("");
   r.setTag("");
   r.setOpEnd("");
   wheres.add(r);
   for (Object v : values) {
     paramWheres.add(v);
   }
   return this;
 }
Exemple #5
0
 public ISelecter whereNq(String column, Object value) {
   Rule r = new Rule();
   r.setColumn(column);
   if (null != value) {
     r.setOpStart("!=");
     paramWheres.add(value);
   } else {
     r.setOpStart(" IS NOT NULL");
     r.setTag("");
   }
   wheres.add(r);
   return this;
 }
Exemple #6
0
 protected IExecuter whereNotIn(String column, Object... value) {
   Rule r = new Rule();
   r.setColumn(column);
   r.setOpStart(" not in (");
   r.setOpEnd(")");
   StringBuilder tag = new StringBuilder();
   List<Object> l = objectsToList(value);
   for (Object o : l) {
     tag.append(",?");
     paramWheres.add(o);
   }
   r.setTag(l.size() > 0 ? tag.toString().substring(1) : "");
   wheres.add(r);
   return this;
 }
Exemple #7
0
 protected String getWhereSql() {
   StringBuffer sql = new StringBuffer();
   for (int i = 0, l = wheres.size(); i < l; i++) {
     if (i < 1) {
       sql.append(" WHERE");
     } else {
       sql.append(" AND");
     }
     sql.append(" ");
     Rule r = wheres.get(i);
     sql.append(r.getColumn());
     sql.append(r.getOpStart());
     sql.append(r.getTag());
     sql.append(r.getOpEnd());
   }
   return sql.toString();
 }