package aiyh.utils.sqlUtil.whereUtil.impl; import aiyh.utils.sqlUtil.whereUtil.InnerWhere; import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; import weaver.conn.RecordSet; import java.util.List; /** * @author EBU7-dev1-ayh * @date 2021/8/23 0023 13:23 */ @Deprecated public class InnerWhereOperatorImpl implements InnerWhereOperator { private final InnerWhereImpl where; private String DB_TYPE; { // 获取当前数据库的类型 this.DB_TYPE = (new RecordSet()).getDBType(); } public InnerWhereOperatorImpl(InnerWhereImpl where) { this.where = where; } @Override public InnerWhere whereNull() { this.where.whereAppend(" is null "); return this.where; } @Override public InnerWhere whereNotNull() { this.where.whereAnd(" is not null "); return this.where; } @Override public InnerWhere whereEqual(Object value) { this.where.whereAppend(" = "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere whereNotEqual(Object value) { this.where.whereAppend(" <> "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere greaterThan(Object value) { this.where.whereAppend(" > "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere lessThan(Object value) { this.where.whereAppend(" < "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere greaterOrEqual(Object value) { this.where.whereAppend(" >= "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere lessThanOrEqual(Object value) { this.where.whereAppend(" <= "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere BetweenAnd(Object start, Object end) { this.where.whereAppend(" between "); this.where.whereAppend("'"); this.where.whereAppend(start); this.where.whereAppend("'"); this.where.whereAppend(" and "); this.where.whereAppend("'"); this.where.whereAppend(end); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere whereIn(Object... values) { this.where.whereAppend(" in ( "); for (int i = 0; i < values.length; i++) { this.where.whereAppend("'"); this.where.whereAppend(values[i]); this.where.whereAppend("'"); if (i < values.length - 1) { this.where.whereAppend(","); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereInList(List list) { this.where.whereAppend(" in ( "); for (int i = 0; i < list.size(); i++) { this.where.whereAppend("'"); this.where.whereAppend(list.get(i)); this.where.whereAppend("'"); if (i < list.size() - 1) { this.where.whereAppend(","); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereNotIn(Object... values) { this.where.whereAppend(" not in ( "); for (int i = 0; i < values.length; i++) { this.where.whereAppend("'"); this.where.whereAppend(values[i]); this.where.whereAppend("'"); if (i < values.length - 1) { this.where.whereAppend(","); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereNotInList(List list) { this.where.whereAppend(" not in ( "); for (int i = 0; i < list.size(); i++) { this.where.whereAppend("'"); this.where.whereAppend(list.get(i)); this.where.whereAppend("'"); if (i < list.size() - 1) { this.where.whereAppend(", "); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere inSql(Object sql) { this.where.whereAppend(" in ( "); this.where.whereAppend(sql); this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere notInSql(Object sql) { this.where.whereAppend(" not in ( "); this.where.whereAppend(sql); this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereLike(Object value) { this.where.whereAppend(" like "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere whereNotLike(Object value) { this.where.whereAppend(" not like "); this.where.whereAppend("'"); this.where.whereAppend(value); this.where.whereAppend("'"); return this.where; } @Override public InnerWhere whereExists(Object... values) { this.where.whereAppend(" exists ( "); for (int i = 0; i < values.length; i++) { this.where.whereAppend("'"); this.where.whereAppend(values[i]); this.where.whereAppend("'"); if (i < values.length - 1) { this.where.whereAppend(","); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereNotExists(Object... values) { this.where.whereAppend(" not exists ( "); for (int i = 0; i < values.length; i++) { this.where.whereAppend("'"); this.where.whereAppend(values[i]); this.where.whereAppend("'"); if (i < values.length - 1) { this.where.whereAppend(","); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereExistsList(List list) { this.where.whereAppend(" exists ( "); for (int i = 0; i < list.size(); i++) { this.where.whereAppend("'"); this.where.whereAppend(list.get(i)); this.where.whereAppend("'"); if (i < list.size() - 1) { this.where.whereAppend(", "); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereNotExistsList(List list) { this.where.whereAppend(" not exists ( "); for (int i = 0; i < list.size(); i++) { this.where.whereAppend("'"); this.where.whereAppend(list.get(i)); this.where.whereAppend("'"); if (i < list.size() - 1) { this.where.whereAppend(", "); } } this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereExistsSql(Object sql) { this.where.whereAppend(" exists ( "); this.where.whereAppend(sql); this.where.whereAppend(" ) "); return this.where; } @Override public InnerWhere whereNotExistsSql(Object sql) { this.where.whereAppend(" not exists ( "); this.where.whereAppend(sql); this.where.whereAppend(" ) "); return this.where; } }