|
|
|
@ -76,8 +76,13 @@ public class BsonPackTool {
|
|
|
|
|
|
|
|
|
|
//查询
|
|
|
|
|
MongoCollection<Document> collection = mongoOperations.getCollection(tableName);
|
|
|
|
|
collection.find(bson).skip(skip).limit(limit).forEach(saveBlock);
|
|
|
|
|
collection.count(bson);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
collection.count();
|
|
|
|
|
collection.find().skip(skip).limit(limit).forEach(saveBlock);
|
|
|
|
|
}else {
|
|
|
|
|
collection.count(bson);
|
|
|
|
|
collection.find(bson).skip(skip).limit(limit).forEach(saveBlock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return newLins;
|
|
|
|
|
}
|
|
|
|
@ -95,8 +100,9 @@ public class BsonPackTool {
|
|
|
|
|
List<Document> list = new ArrayList<>();
|
|
|
|
|
long count = mongoOperations.getCollection(tableName).count(bson);
|
|
|
|
|
int loops = (int)((count + pageSize - 1) / pageSize);
|
|
|
|
|
List<Document> newFinds = null;
|
|
|
|
|
for(int i = 0; i < loops; i++) {
|
|
|
|
|
List<Document> newFinds = query(mongoOperations, tableName, bson, i * pageSize, pageSize);
|
|
|
|
|
newFinds = query(mongoOperations, tableName, bson, i * pageSize, pageSize);
|
|
|
|
|
list.addAll(newFinds);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
@ -131,11 +137,18 @@ public class BsonPackTool {
|
|
|
|
|
if (isShowTime&& endDate.trim().length()<=11) {
|
|
|
|
|
endDate+= " 23:59:59";
|
|
|
|
|
}
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName,startDate), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName,endDate) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gte(columnName, startDate), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, endDate) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName, startDate), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, endDate) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -160,11 +173,16 @@ public class BsonPackTool {
|
|
|
|
|
String[] time = date.split(",");
|
|
|
|
|
if(time.length == 1){
|
|
|
|
|
//只有开始日期,没有结束日期
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
//Filters.eq(columnName,time[0])
|
|
|
|
|
Filters.regex(columnName, "^"+time[0]) //like 日期%^
|
|
|
|
|
);
|
|
|
|
|
if(bson == null){
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.regex(columnName, "^" + time[0]) //like 日期%^
|
|
|
|
|
);
|
|
|
|
|
}else {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, "^" + time[0]) //like 日期%^
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}else if (time.length == 2 && ((time[0] != null && time[0].trim().length() > 0) || (time[1] != null & time[1].trim().length() > 0))) {
|
|
|
|
|
if (time[0] == null || time[0].trim().length() == 0) {
|
|
|
|
|
time[0] = "1900-01-01";
|
|
|
|
@ -182,26 +200,46 @@ public class BsonPackTool {
|
|
|
|
|
if (isShowTime&& time[1].trim().length()<=11) {
|
|
|
|
|
time[1]+= " 23:59:59";
|
|
|
|
|
}
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName,time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName,time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gte(columnName, time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName, time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (showTaday) {
|
|
|
|
|
if (isShowTime) {
|
|
|
|
|
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName,time[0] + " 00:00:00"), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName,time[1] + " 23:59:59") //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gte(columnName, time[0] + " 00:00:00"), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1] + " 23:59:59") //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName, time[0] + " 00:00:00"), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1] + " 23:59:59") //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName,time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName,time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gte(columnName, time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gte(columnName, time[0]), //大于等于开始日期
|
|
|
|
|
Filters.lte(columnName, time[1]) //小于等于结束日期
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -219,10 +257,16 @@ public class BsonPackTool {
|
|
|
|
|
if (str != null && str.trim().length() > 0) {
|
|
|
|
|
str = getSafeParam(str);
|
|
|
|
|
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return bson;
|
|
|
|
@ -238,12 +282,18 @@ public class BsonPackTool {
|
|
|
|
|
if (str != null && str.trim().length() > 0) {
|
|
|
|
|
str = getSafeParam(str);
|
|
|
|
|
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.or(
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.or(
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
);
|
|
|
|
|
}else {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.or(
|
|
|
|
|
Filters.regex(columnName, str) //like
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -257,10 +307,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getStringRightLikerPack(String str,String columnName, Bson bson) {
|
|
|
|
|
if (str != null && str.trim().length() > 0) {
|
|
|
|
|
str = getSafeParam(str);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, str + "^") //like
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.regex(columnName, str + "^") //like
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, str + "^") //like
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -274,10 +330,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getStringLeftLikerPack(String str,String columnName, Bson bson) {
|
|
|
|
|
if (str != null && str.trim().length() > 0) {
|
|
|
|
|
str = getSafeParam(str);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, "^" + str) //like
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.regex(columnName, "^" + str) //like
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.regex(columnName, "^" + str) //like
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -290,10 +352,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getStringEqualPack(String data,String columnName, Bson bson) {
|
|
|
|
|
if(data != null && data.trim().length() > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -306,10 +374,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumEqualPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -322,10 +396,17 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumEqualPackForZero(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) >= 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -338,10 +419,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumWithZeroEqualPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) >= 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -354,10 +441,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumBiggerPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -370,10 +463,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumSmallerPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -386,10 +485,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getDoubleBiggerPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Double.parseDouble(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.gt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -402,10 +507,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getDoubleSmallerPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Double.parseDouble(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.lt(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -418,10 +529,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumEqualPack(Object data,String columnName, Bson bson,Integer expvalue) {
|
|
|
|
|
if(data!=null&&Long.parseLong(data.toString()) > (long)expvalue){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -434,10 +551,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumEqualPackDouble(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null&&Double.parseDouble(data.toString()) > 0){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -450,10 +573,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumEqualPackDouble(Object data,String columnName, Bson bson,Integer expvalue) {
|
|
|
|
|
if(data!=null&&Double.parseDouble(data.toString()) > (double)expvalue){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.eq(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -466,10 +595,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNumNOEqualPack(Object data,String columnName, Bson bson) {
|
|
|
|
|
if(data!=null){
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.ne(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.ne(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.ne(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -483,10 +618,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getInPack(String data,String columnName, Bson bson){
|
|
|
|
|
if (data!=null&&data.trim().length()>0) {
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -513,10 +654,16 @@ public class BsonPackTool {
|
|
|
|
|
data += "'" + dataArray[i] + "',";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.in(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -543,10 +690,16 @@ public class BsonPackTool {
|
|
|
|
|
data += "'" + dataArray[i] + "',";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
@ -560,10 +713,16 @@ public class BsonPackTool {
|
|
|
|
|
public static Bson getNotInPack(String data,String columnName, Bson bson){
|
|
|
|
|
if (data!=null&&data.trim().length()>0) {
|
|
|
|
|
data = getSafeParam(data);
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
if(bson == null) {
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}else{
|
|
|
|
|
bson = Filters.and(
|
|
|
|
|
bson,
|
|
|
|
|
Filters.nin(columnName, data)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bson;
|
|
|
|
|
}
|
|
|
|
|