69 lines
1.5 KiB
Java
69 lines
1.5 KiB
Java
package aiyh.utils.sqlUtil.whereUtil.impl;
|
|
|
|
import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator;
|
|
import aiyh.utils.sqlUtil.whereUtil.Where;
|
|
import aiyh.utils.sqlUtil.whereUtil.WhereOperator;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author EBU7-dev1-ayh
|
|
* @date 2021/8/23 0023 13:18
|
|
* 实现类
|
|
*/
|
|
|
|
@Deprecated
|
|
public class WhereImpl implements Where {
|
|
private final WhereOperator whereOperator;
|
|
private final StringBuilder sqlBuilder;
|
|
private final InnerWhereImpl innerWhere;
|
|
|
|
{
|
|
this.whereOperator = new WhereOperatorImpl(this);
|
|
this.sqlBuilder = new StringBuilder("where 1 = 1 ");
|
|
this.innerWhere = new InnerWhereImpl(this);
|
|
}
|
|
|
|
@Override
|
|
public WhereOperator whereAnd(String key) {
|
|
this.sqlBuilder.append(" and ");
|
|
this.sqlBuilder.append(key);
|
|
return this.whereOperator;
|
|
}
|
|
|
|
@Override
|
|
public WhereOperator whereOr(String key) {
|
|
this.sqlBuilder.append(" or ");
|
|
this.sqlBuilder.append(key);
|
|
return this.whereOperator;
|
|
}
|
|
|
|
@Override
|
|
public InnerWhereOperator andInnerWhere(String key){
|
|
this.sqlBuilder.append(" and ( ");
|
|
this.sqlBuilder.append(key);
|
|
return innerWhere.getWhereOperator();
|
|
}
|
|
|
|
@Override
|
|
public InnerWhereOperator orInnerWhere(String key){
|
|
this.sqlBuilder.append(" or ( ");
|
|
this.sqlBuilder.append(key);
|
|
return innerWhere.getWhereOperator();
|
|
}
|
|
|
|
public void whereAppend(Object key){
|
|
this.sqlBuilder.append(key);
|
|
}
|
|
|
|
@Override
|
|
public String getSql(){
|
|
return this.sqlBuilder.toString().replace(" 1 = 1 and", "").replace(" 1 = 1 or","");
|
|
}
|
|
|
|
@Override
|
|
public List<Object> getArgs() {
|
|
return null;
|
|
}
|
|
}
|