diff --git a/modules/i3plus-pojo-base-mongo/pom.xml b/modules/i3plus-pojo-base-mongo/pom.xml
deleted file mode 100644
index 5868e20..0000000
--- a/modules/i3plus-pojo-base-mongo/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- i3plus-pojo
- i3plus.pojo
- 1.0-TEST-SNAPSHOT
- ../../pom.xml
-
- 4.0.0
-
- i3plus-pojo-base-mongo
-
-
-
- org.springframework.boot
- spring-boot-starter-data-mongodb
-
-
- i3plus.pojo
- i3plus-pojo-base
-
-
- i3plus.pojo
- i3plus-pojo-platform
-
-
-
-
\ No newline at end of file
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/dao/BaseMongoRepository.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/dao/BaseMongoRepository.java
deleted file mode 100644
index a399769..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/dao/BaseMongoRepository.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package cn.estsh.i3plus.pojo.base.jpa.dao;
-
-import cn.estsh.i3plus.pojo.base.common.Pager;
-import org.bson.conversions.Bson;
-import org.springframework.data.mongodb.repository.MongoRepository;
-import org.springframework.data.repository.NoRepositoryBean;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @Description : 自定义Repository的方法接口
- * @Reference : MongoRepository
- * @Author : alwaysfrin
- * @CreateDate : 2018-09-13 10:34
- * @Modify:
- **/
-@NoRepositoryBean
-public interface BaseMongoRepository extends MongoRepository {
-
- T getById(long id);
-
- List findByProperty(String propertyName, Object value);
-
- List findByProperty(String propertyName, Object value,String orderByParam, int ascOrDesc);
-
- List findByPropertyLike(String propertyName, Object value);
-
- List findByPropertyLike(String propertyName, Object value,String orderByParam, int ascOrDesc);
-
- T getByProperty(String propertyName, Object value);
-
- List findByBson(Bson bson);
-
- List findByBson(Bson bson,String orderByParam, int ascOrDesc);
-
- int findByBsonCount(Bson bson);
-
- List findByBsonPager(Bson bson,Pager pager);
-
- List findByBsonPager(Bson bson,Pager pager,String orderByParam, int ascOrDesc);
-
- int listCount();
-
- List listPager(Pager pager);
-
- List listPager(Pager pager,String orderByParam, int ascOrDesc);
-
- long deleteByProperty(Bson bson);
- long deleteByPropertyIn(String propName, Object[] propValues);
- long deleteByIds(ID[] ids);
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseMongoRepositoryImpl.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseMongoRepositoryImpl.java
deleted file mode 100644
index ef58910..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/daoimpl/BaseMongoRepositoryImpl.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package cn.estsh.i3plus.pojo.base.jpa.daoimpl;
-
-import cn.estsh.i3plus.pojo.base.common.Pager;
-import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
-import cn.estsh.i3plus.pojo.base.jpa.dao.BaseMongoRepository;
-import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
-import com.alibaba.fastjson.JSONObject;
-import com.mongodb.BasicDBObject;
-import com.mongodb.Block;
-import com.mongodb.client.FindIterable;
-import com.mongodb.client.model.CountOptions;
-import com.mongodb.client.model.Filters;
-import com.mongodb.client.model.Sorts;
-import org.apache.commons.lang3.StringUtils;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-import org.bson.json.JsonMode;
-import org.bson.json.JsonWriterSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DuplicateKeyException;
-import org.springframework.data.mapping.context.MappingContext;
-import org.springframework.data.mongodb.core.MongoOperations;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
-import org.springframework.data.mongodb.core.query.Query;
-import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
-import org.springframework.data.mongodb.repository.support.SimpleMongoRepository;
-
-import javax.persistence.Id;
-import java.io.Serializable;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-
-/**
- * @Description : 自定义mongodb持久化接口实现
- * @Reference :
- * @Author : alwaysfrin
- * @CreateDate : 2018-09-13 11:24
- * @Modify:
- **/
-public class BaseMongoRepositoryImpl extends SimpleMongoRepository
- implements BaseMongoRepository {
- public static final Logger LOGGER = LoggerFactory.getLogger(BaseMongoRepositoryImpl.class);
-
- /**
- * 持久化上下文
- */
- private final MongoOperations mongoOperations;
- private final MongoEntityInformation entityInformation;
- private final MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mongoContext;
- private final Class entityClass;
- private SnowflakeIdMaker snowflakeIdMaker;
-
- public BaseMongoRepositoryImpl(MongoEntityInformation metadata, MongoOperations mongoOperations,SnowflakeIdMaker snowflakeIdMaker) {
- super(metadata, mongoOperations);
- this.entityInformation = metadata;
- this.mongoOperations = mongoOperations;
- this.entityClass = this.entityInformation.getJavaType();
- mongoContext = mongoOperations.getConverter().getMappingContext();
- this.snowflakeIdMaker = snowflakeIdMaker;
- }
-
- /**
- * 重写新增方法
- * @param entity
- * @param
- * @return
- */
- @Override
- public S insert(S entity) {
- innerSave(entity);
- return entity;
- }
-
- /**
- * 保存对象
- * @param item 保存对象
- * @return
- */
- private T innerSave(T item) {
- try {
- if(item==null)return null;
- Class> clazz = item.getClass();
-
- //获取主键
- Field idField = clazz.getField("id");
- if(idField == null){
- idField = clazz.getField("primaryKey");
- }
- if(idField == null){
- // 遍历所有属性,以@Id声明确认主键
- Field[] fields = clazz.getFields();
- for(Field f : fields){
- if(f.getAnnotation(Id.class) != null){
- idField = f;
- break;
- }
- }
- }
-
- if(idField != null){
- Class> type = idField.getType();
- Object val = idField.get(item);
- if((type == long.class || type == Long.class) && (val == null || Long.parseLong(val.toString()) == 0)){
- // long类型主键,以snowflake为主键
- idField.set(item, snowflakeIdMaker.nextId() + System.currentTimeMillis());
- } else if(type == String.class && (val==null || "".equals(val))){
- // String类型主键,以UUID为主键
- idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase());
- }
- }
-
-// try {
- this.mongoOperations.insert(item, this.entityInformation.getCollectionName());
-// }catch (DuplicateKeyException dke){
-// LOGGER.error("【出现重复主键】");
-// //出现重复主键,再次插入
-// if(idField != null){
-// Class> type = idField.getType();
-// Object val = idField.get(item);
-// if((type == long.class || type == Long.class) && (val == null || Long.parseLong(val.toString()) == 0)){
-// // long类型主键,以snowflake为主键
-// idField.set(item, snowflakeIdMaker.nextId());
-// } else if(type == String.class && (val==null || "".equals(val))){
-// // String类型主键,以UUID为主键
-// idField.set(item, UUID.randomUUID().toString().replace("-", "").toLowerCase());
-// }
-// }
-//
-// this.mongoOperations.insert(item, this.entityInformation.getCollectionName());
-// }
- if(idField != null){
- return item;
- }else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public Optional findById(ID id) {
- T entity = this.mongoOperations.findById(id, this.entityInformation.getJavaType(), this.entityInformation.getCollectionName());
-
- if(entity != null) {
- return Optional.of(entity);
- }else{
- return null;
- }
- }
-
- @Override
- public T getById(long id) {
- return this.mongoOperations.findById(id, this.entityInformation.getJavaType(), this.entityInformation.getCollectionName());
- }
-
- @Override
- public List findByProperty(String propertyName, Object value) {
- return findByProperty(propertyName,value,null,0);
- }
-
- @Override
- public List findByProperty(String propertyName, Object value, String orderByParam, int ascOrDesc) {
- Bson bson = Filters.and(
- Filters.eq(propertyName, value)
- );
-
- return findByBson(bson,orderByParam,ascOrDesc);
- }
-
- @Override
- public List findByPropertyLike(String propertyName, Object value) {
- return findByPropertyLike(propertyName,value,null,0);
- }
-
- @Override
- public List findByPropertyLike(String propertyName, Object value, String orderByParam, int ascOrDesc) {
- Bson bson = Filters.and(
- Filters.regex(propertyName, value.toString())
- );
-
- return findByBson(bson,orderByParam,ascOrDesc);
- }
-
- @Override
- public T getByProperty(String propertyName, Object value) {
- List tList = this.findByProperty(propertyName,value);
- if(tList.size() > 0){
- return tList.iterator().next();
- }else{
- return null;
- }
- }
-
- /**
- * 根据bson查询
- * @param bson
- * @return
- */
- public List findByBson(Bson bson) {
- return findByBson(bson,null,0);
- }
-
- @Override
- public List findByBson(Bson bson, String orderByParam, int ascOrDesc) {
- List dList = new ArrayList<>();
- Block saveBlock = new Block() {
- @Override
- public void apply(final Document document) {
- dList.add(document);
- }
- };
-
- FindIterable findIter = null;
- if(bson != null) {
- findIter = mongoOperations.getCollection(this.entityInformation.getCollectionName()).find(bson);
- }else{
- findIter = mongoOperations.getCollection(this.entityInformation.getCollectionName()).find();
- }
- if(StringUtils.isNotBlank(orderByParam) && ascOrDesc != 0){
- //排序
- if(ascOrDesc == CommonEnumUtil.ASC_OR_DESC.ASC.getValue()){
- findIter.sort(Sorts.ascending(orderByParam));
- }else{
- findIter.sort(Sorts.descending(orderByParam));
- }
- }
- findIter.forEach(saveBlock);
-
- return packObjectListFromDocument(dList);
- }
-
- @Override
- public int findByBsonCount(Bson bson) {
- if(bson == null){
- return (int) mongoOperations.getCollection(this.entityInformation.getCollectionName()).count();
- }else {
- return (int) mongoOperations.getCollection(this.entityInformation.getCollectionName()).count(bson);
- }
- }
-
- private List packObjectListFromDocument(List dList) {
- //将获取的document转为对象
- List resultList = new ArrayList<>();
- // 设置为宽松模式
- JsonWriterSettings jsonWriterSettings = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build();
- for(Document d : dList){
- resultList.add(JSONObject.parseObject(d.toJson(jsonWriterSettings), entityClass));
- }
-
- return resultList;
- }
-
- @Override
- public List findByBsonPager(Bson bson, Pager pager) {
- return findByBsonPager(bson,pager,null,0);
- }
-
- @Override
- public List findByBsonPager(Bson bson, Pager pager, String orderByParam, int ascOrDesc) {
- List dList = new ArrayList<>();
- Block saveBlock = new Block() {
- @Override
- public void apply(final Document document) {
- dList.add(document);
- }
- };
-
- FindIterable findIter = null;
- if(bson == null) {
- findIter = mongoOperations.getCollection(this.entityInformation.getCollectionName()).find();
- }else{
- findIter = mongoOperations.getCollection(this.entityInformation.getCollectionName()).find(bson);
- }
- if(StringUtils.isNotBlank(orderByParam) && ascOrDesc != 0){
- //排序
- if(ascOrDesc == CommonEnumUtil.ASC_OR_DESC.ASC.getValue()){
- findIter.sort(Sorts.ascending(orderByParam));
- }else{
- findIter.sort(Sorts.descending(orderByParam));
- }
- }else{
- //根据id排序
- findIter.sort(new BasicDBObject("_id", 1));
- }
- findIter.skip(pager.getStartRow()).limit(pager.getPageSize());
- findIter.forEach(saveBlock);
-
- return packObjectListFromDocument(dList);
- }
-
- @Override
- public int listCount() {
- return (int) mongoOperations.getCollection(this.entityInformation.getCollectionName()).count();
- }
-
- @Override
- public List listPager(Pager pager) {
- return listPager(pager,null,0);
- }
-
- @Override
- public List listPager(Pager pager, String orderByParam, int ascOrDesc) {
- List dList = new ArrayList<>();
- Block saveBlock = new Block() {
- @Override
- public void apply(final Document document) {
- dList.add(document);
- }
- };
- FindIterable findIter = mongoOperations.getCollection(this.entityInformation.getCollectionName()).find();
- if(StringUtils.isNotBlank(orderByParam) && ascOrDesc != 0){
- //排序
- if(ascOrDesc == CommonEnumUtil.ASC_OR_DESC.ASC.getValue()){
- findIter.sort(Sorts.ascending(orderByParam));
- }else{
- findIter.sort(Sorts.descending(orderByParam));
- }
- }else{
- //根据id排序
- findIter.sort(new BasicDBObject("_id", 1));
- }
- findIter.skip(pager.getStartRow()).limit(pager.getPageSize());
- findIter.forEach(saveBlock);
- return packObjectListFromDocument(dList);
- }
-
- @Override
- public long deleteByProperty(Bson bson) {
- return mongoOperations.getCollection(this.entityInformation.getCollectionName()).deleteMany(bson).getDeletedCount();
- }
-
- @Override
- public long deleteByPropertyIn(String propName, Object[] propValues) {
- Bson bson = Filters.and(
- Filters.in(propName, propValues)
- );
- return deleteByProperty(bson);
- }
-
- @Override
- public long deleteByIds(ID[] ids) {
- return deleteByPropertyIn("_id",ids);
- }
-
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/factory/BaseMongoRepositoryFactoryBean.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/factory/BaseMongoRepositoryFactoryBean.java
deleted file mode 100644
index f864c1e..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/jpa/factory/BaseMongoRepositoryFactoryBean.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package cn.estsh.i3plus.pojo.base.jpa.factory;
-
-import cn.estsh.i3plus.pojo.base.jpa.daoimpl.BaseMongoRepositoryImpl;
-import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.mongodb.core.MongoOperations;
-import org.springframework.data.mongodb.repository.MongoRepository;
-import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
-import org.springframework.data.mongodb.repository.support.MongoRepositoryFactory;
-import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
-import org.springframework.data.repository.core.RepositoryInformation;
-import org.springframework.data.repository.core.RepositoryMetadata;
-import org.springframework.data.repository.core.support.RepositoryFactorySupport;
-
-import java.io.Serializable;
-
-/**
- * @Description : 自定义mongodb持久化工厂类
- * @Reference :
- * @Author : alwaysfrin
- * @CreateDate : 2018-09-13 14:55
- * @Modify:
- **/
-public class BaseMongoRepositoryFactoryBean, T, I extends Serializable> extends MongoRepositoryFactoryBean {
- public static final Logger LOGGER = LoggerFactory.getLogger(BaseMongoRepositoryFactoryBean.class);
-
- @Autowired
- public SnowflakeIdMaker snowflakeIdMaker;
-
- public BaseMongoRepositoryFactoryBean(Class extends R> repositoryInterface) {
- super(repositoryInterface);
- }
-
- @Override
- protected RepositoryFactorySupport getFactoryInstance(MongoOperations operations) {
- //LOGGER.info("【初始mongo持久仓】");
- //生成持久mongo仓库实例
- return new BaseMongoRepositoryFactory(operations,snowflakeIdMaker);
- }
-
- //创建一个内部类,该类不用在外部访问
- private static class BaseMongoRepositoryFactory extends MongoRepositoryFactory {
- private final MongoOperations mongoOperations;
- //private final MappingContext extends MongoPersistentEntity>, MongoPersistentProperty> mappingContext;
- private final SnowflakeIdMaker snowflakeIdMaker;
-
- public BaseMongoRepositoryFactory(MongoOperations mongoOperations,SnowflakeIdMaker snowflakeIdMaker) {
- super(mongoOperations);
- this.mongoOperations = mongoOperations;
- this.snowflakeIdMaker = snowflakeIdMaker;
- //this.mappingContext = mongoOperations.getConverter().getMappingContext();
- }
-
- //设置具体的实现类是BaseRepositoryImpl
- @Override
- protected Object getTargetRepository(RepositoryInformation information) {
- MongoEntityInformation, Serializable> entityInformation = getEntityInformation(information.getDomainType());
- return new BaseMongoRepositoryImpl(entityInformation, mongoOperations,snowflakeIdMaker);
- }
-
- //设置具体的实现类的class
- @Override
- protected Class> getRepositoryBaseClass(RepositoryMetadata metadata) {
- return BaseMongoRepositoryImpl.class;
- }
- }
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/tool/BsonPackTool.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/tool/BsonPackTool.java
deleted file mode 100644
index f355b4b..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/base/tool/BsonPackTool.java
+++ /dev/null
@@ -1,816 +0,0 @@
-package cn.estsh.i3plus.pojo.base.tool;
-
-import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.mongodb.Block;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.model.Filters;
-import com.mongodb.client.model.Sorts;
-import org.apache.commons.lang3.StringUtils;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-import org.springframework.data.mongodb.core.MongoOperations;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.regex.Pattern;
-
-/**
- * @Description :
- * @Reference :
- * @Author : alwaysfrin
- * @CreateDate : 2018-11-01 16:26
- * @Modify:
- *
- * (>) 大于 - $gt
- * (<) 小于 - $lt
- * (>=) 大于等于 - $gte
- * (<= ) 小于等于 - $lte
- * $ne ----------- not equal !=
- * $eq -------- equal =
- *
- * 查询 title 包含"库"字的文档:
- * db.col.find({title:/库/})
- *
- * 查询 title 字段以"教"字开头的文档:
- * db.col.find({title:/^库/})
- *
- * 查询 titl e字段以"教"字结尾的文档:
- * db.col.find({title:/库$/})
- **/
-public class BsonPackTool {
-
- /**
- * 防止sql注入
- * @param data
- * @return
- */
- public static String getSafeParam(Object data){
- return data.toString().replaceAll(";","")
- .replaceAll("'","")
- .replaceAll("\"","")
- .replaceAll("/","")
- .replaceAll("\\\\","")
- .replaceAll("delete","")
- .replaceAll("update","")
- .replaceAll("insert","");
- }
-
- /**
- * 单页查询,获取查询document结果集合
- * @param mongoOperations
- * @param tableName 查询的表名
- * @param bson 查询条件
- * @param skip 忽略的条数
- * @param limit 查询的条数
- * @return document结果集合
- */
- public static List query(MongoOperations mongoOperations, String tableName, Bson bson, int skip, int limit) {
- List newLins = new ArrayList<>();
- Block saveBlock = new Block() {
- @Override
- public void apply(final Document document) {
- newLins.add(document);
- }
- };
-
- //查询
- MongoCollection collection = mongoOperations.getCollection(tableName);
- 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;
- }
-
- /**
- * 分页查询
- * @param mongoOperations
- * @param tableName 表名
- * @param bson 查询条件
- * @param pageSize 单页查询条数
- * @return 查询结果集合
- */
- public static List queryPages(MongoOperations mongoOperations, String tableName, Bson bson, int pageSize) {
- //分页查询
- List list = new ArrayList<>();
- long count = mongoOperations.getCollection(tableName).count(bson);
- int loops = (int)((count + pageSize - 1) / pageSize);
- List newFinds = null;
- for(int i = 0; i < loops; i++) {
- newFinds = query(mongoOperations, tableName, bson, i * pageSize, pageSize);
- list.addAll(newFinds);
- }
- return list;
- }
-
- /**
- * 封装日期
- * @param startDate 开始日期
- * @param endDate 开始日期和结束日期,以逗号分隔(分为开始时间和结束时间)
- * @param columnName HQL里对应的时间字段
- * @param bson 封装的bson
- * @param isShowTime 是否包含时分秒
- */
- public static Bson timeBuilder( String startDate,String endDate, String columnName, Bson bson, boolean isShowTime) {
- if (startDate == null || startDate.trim().length() == 0) {
- startDate = "1900-01-01";
- } else {
- startDate = getSafeParam(startDate);
- startDate = startDate.trim();
- }
- if (isShowTime && startDate.trim().length()<=11) {
- startDate+= " 00:00:00";
- }
- if (endDate == null || endDate.trim().length() == 0) {
- endDate = "2100-01-01";
- } else {
- endDate = getSafeParam(endDate);
- endDate = endDate.trim();
- }
- if (isShowTime&& endDate.trim().length()<=11) {
- endDate+= " 23:59:59";
- }
- 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;
- }
-
- /**
- * 封装日期
- * @param date 开始日期和结束日期,以逗号分隔(分为开始时间和结束时间)
- * @param columnName HQL里对应的时间字段
- * @param bson 封装的bson
- * @param showToday 如果没有开始时间和结束时间,是否查询当天时间,还是查询所有时间。true:查询当天时间,false:查询所有
- * @param isShowTime 是否包含时分秒
- */
- public static Bson timeBuilder( String date, String columnName, Bson bson, boolean showToday,boolean isShowTime) {
- if(date != null && !"null".equals(date) && date.trim().length() > 0){
- date = getSafeParam(date);
-
- String today = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
- if(date.length() == 1 || ",".equals(date)){
- //只有一个逗号
- date = "";
- }
-
- String[] time = date.split(",");
- if(time.length == 1){
- //只有开始日期,没有结束日期
- 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";
- } else {
- time[0] = time[0].trim();
- }
- if (isShowTime && time[0].trim().length()<=11) {
- time[0]+= " 00:00:00";
- }
- if (time[1] == null || time[1].trim().length() == 0) {
- time[1] = "2100-01-01";
- } else {
- time[1] = time[1].trim();
- }
- if (isShowTime&& time[1].trim().length()<=11) {
- time[1]+= " 23:59:59";
- }
- 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 (showToday) {
- if (isShowTime) {
- 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{
- 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]) //小于等于结束日期
- );
- }
- }
- }
- }
- }
- return bson;
- }
-
- /**
- * 查询方位分装
- * @param columnName 列名称
- * @param bson
- * @param startTime 开始值
- * @param endTime 结束之
- * @return
- */
- public static Bson timeBuilder(String columnName, Bson bson, String startTime,String endTime) {
- if( Objects.nonNull(bson) && StringUtils.isNotBlank(columnName) &&StringUtils.isNotBlank(startTime)&& StringUtils.isNotBlank(endTime)){
- bson = Filters.and(
- bson,
- Filters.gte(columnName, startTime), //大于等于开始日期
- Filters.lte(columnName, endTime) //小于等于结束日期
- );
- }
- return bson;
- }
-
- /**
- * 大于日期
- * @param dateTime 日期
- * @param columnName HQL里对应的时间字段
- * @param bson 封装的bson
- * @param isShowTime 是否包含时分秒
- */
- public static Bson timeMore( String dateTime, String columnName, Bson bson, boolean isShowTime) {
- if (dateTime == null || dateTime.trim().length() == 0) {
- dateTime = "1900-01-01";
- } else {
- dateTime = getSafeParam(dateTime);
- dateTime = dateTime.trim();
- }
- if (isShowTime && dateTime.trim().length()<=11) {
- dateTime+= " 00:00:00";
- }
- if(bson == null) {
- bson = Filters.and(
- Filters.gte(columnName, dateTime) //大于等于开始日期
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.gte(columnName, dateTime) //大于等于开始日期
- );
- }
-
- return bson;
- }
-
- /**
- * 小于日期
- * @param dateTime 日期
- * @param columnName HQL里对应的时间字段
- * @param bson 封装的bson
- * @param isShowTime 是否包含时分秒
- */
- public static Bson timeLess( String dateTime, String columnName, Bson bson, boolean isShowTime) {
- if (dateTime == null || dateTime.trim().length() == 0) {
- dateTime = "2100-01-01";
- } else {
- dateTime = getSafeParam(dateTime);
- dateTime = dateTime.trim();
- }
- if (isShowTime&& dateTime.trim().length()<=11) {
- dateTime+= " 23:59:59";
- }
- if(bson == null) {
- bson = Filters.and(
- Filters.lte(columnName, dateTime) //小于等于结束日期
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.lte(columnName, dateTime) //小于等于结束日期
- );
- }
-
- return bson;
- }
-
- /**
- * 封装String对象成like语句
- * @param str 对象值
- * @param columnName 列名
- * @param bson
- */
- public static Bson getStringLikerPack(String str,String columnName, Bson bson) {
- if (str != null && str.trim().length() > 0) {
- str = getSafeParam(str);
-
- if(bson == null) {
- bson = Filters.and(
- Filters.regex(columnName, str) //like
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.regex(columnName, str)//like
- );
- }
- }
-
- return bson;
- }
-
- /**
- * 封装String对象成like语句
- * @param str 对象值
- * @param columnName 列名
- * @param bson
- */
- public static Bson getStringLikerPackOr(String str,String columnName, Bson bson) {
- if (str != null && str.trim().length() > 0) {
- str = getSafeParam(str);
-
- 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;
- }
-
- /**
- * 封装String对象成like语句(右侧模糊)
- * @param str 对象值
- * @param columnName 列名
- * @param bson
- */
- public static Bson getStringRightLikerPack(String str,String columnName, Bson bson) {
- if (str != null && str.trim().length() > 0) {
- str = getSafeParam(str);
- if(bson == null) {
- bson = Filters.and(
- Filters.regex(columnName, str + "^") //like
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.regex(columnName, str + "^") //like
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装String对象成like语句(左侧模糊)
- * @param str 对象值
- * @param columnName 列名
- * @param bson
- */
- public static Bson getStringLeftLikerPack(String str,String columnName, Bson bson) {
- if (str != null && str.trim().length() > 0) {
- str = getSafeParam(str);
- if(bson == null) {
- bson = Filters.and(
- Filters.regex(columnName, "^" + str) //like
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.regex(columnName, "^" + str) //like
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装String对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getStringEqualPack(String data,String columnName, Bson bson) {
- if(data != null && data.trim().length() > 0){
- data = getSafeParam(data);
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumEqualPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Long.parseLong(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumEqualPackForZero(Object data,String columnName, Bson bson) {
- if(data!=null&&Long.parseLong(data.toString()) >= 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumWithZeroEqualPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Long.parseLong(data.toString()) >= 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成大于语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumBiggerPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Long.parseLong(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.gt(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.gt(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成小于语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumSmallerPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Long.parseLong(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.lt(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.lt(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装double对象成大于语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getDoubleBiggerPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Double.parseDouble(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.gt(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.gt(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装double对象成小于语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getDoubleSmallerPack(Object data,String columnName, Bson bson) {
- if(data!=null&&Double.parseDouble(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.lt(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.lt(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumEqualPack(Object data,String columnName, Bson bson,Integer expvalue) {
- if(data!=null&&Long.parseLong(data.toString()) > (long)expvalue){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装double对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumEqualPackDouble(Object data,String columnName, Bson bson) {
- if(data!=null&&Double.parseDouble(data.toString()) > 0){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumEqualPackDouble(Object data,String columnName, Bson bson,Integer expvalue) {
- if(data!=null&&Double.parseDouble(data.toString()) > (double)expvalue){
- if(bson == null) {
- bson = Filters.and(
- Filters.eq(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.eq(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装long或者int的整数对象成equal语句(不等于)
- * @param columnName 列名
- * @param bson
- */
- public static Bson getNumNOEqualPack(Object data,String columnName, Bson bson) {
- if(data!=null){
- if(bson == null) {
- bson = Filters.and(
- Filters.ne(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.ne(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装in查询语句
- * @param data
- * @param columnName
- * @param bson
- */
- public static Bson getInPack(String data,String columnName, Bson bson){
- if (data!=null&&data.trim().length()>0) {
- data = getSafeParam(data);
- if(bson == null) {
- bson = Filters.and(
- Filters.in(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.in(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装in String查询语句
- * @param data
- * @param columnName
- * @param bson
- */
- public static Bson getInPackString(String data,String columnName, Bson bson){
- if (data != null && data.trim().length()>0) {
- data = getSafeParam(data);
- //判断最后一位是不是逗号
- if(data.lastIndexOf(",") != (data.length()-1)){
- data += ",";
- }
- String[] dataArray = data.substring(0, data.length()-1).split(",");
- data = "";
- for (int i = 0 ; i < dataArray.length ;i++) {
- if(i == dataArray.length -1){
- data += "'" + dataArray[i] + "'";
- }else{
- data += "'" + dataArray[i] + "',";
- }
- }
- if(bson == null) {
- bson = Filters.and(
- Filters.in(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.in(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装in String查询语句
- * @param data
- * @param columnName
- * @param bson
- */
- public static Bson getNotInPackString(String data,String columnName, Bson bson){
- if (data != null && data.trim().length()>0) {
- data = getSafeParam(data);
- //判断最后一位是不是逗号
- if(data.lastIndexOf(",") != (data.length()-1)){
- data += ",";
- }
- String[] dataArray = data.substring(0, data.length()-1).split(",");
- data = "";
- for (int i = 0 ; i < dataArray.length ;i++) {
- if(i == dataArray.length -1){
- data += "'" + dataArray[i] + "'";
- }else{
- data += "'" + dataArray[i] + "',";
- }
- }
- if(bson == null) {
- bson = Filters.and(
- Filters.nin(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.nin(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 封装not in查询语句
- * @param data
- * @param columnName
- * @param bson
- */
- public static Bson getNotInPack(String data,String columnName, Bson bson){
- if (data!=null&&data.trim().length()>0) {
- data = getSafeParam(data);
- if(bson == null) {
- bson = Filters.and(
- Filters.nin(columnName, data)
- );
- }else{
- bson = Filters.and(
- bson,
- Filters.nin(columnName, data)
- );
- }
- }
- return bson;
- }
-
- /**
- * 将MONGODB的BSON转成对象
- * @param dList
- * @param entityClass
- * @return
- */
- public List> packDocumentToObjectList(List dList,Class entityClass){
- //将获取的document转为对象
- List resultList = new ArrayList();
- for(Document d : dList){
- resultList.add(JSONObject.parseObject(d.toJson(), entityClass));
- }
-
- return resultList;
- }
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogExceptionRepository.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogExceptionRepository.java
deleted file mode 100644
index 6fe78cc..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogExceptionRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.estsh.i3plus.pojo.platform.platrepositorymongo;
-
-import cn.estsh.i3plus.pojo.base.jpa.dao.BaseMongoRepository;
-import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
-
-/**
- * @Description : 异常记录表(使用Mongodb)
- * @Reference :
- * @Author : frin
- * @Date : 2018-11-8 12:03:00
- * @Modify :
- **/
-public interface SysLogExceptionRepository extends BaseMongoRepository {
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogOperateRepository.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogOperateRepository.java
deleted file mode 100644
index e33b7c7..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogOperateRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.estsh.i3plus.pojo.platform.platrepositorymongo;
-
-import cn.estsh.i3plus.pojo.base.jpa.dao.BaseMongoRepository;
-import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
-
-/**
- * @Description : 操作日志表(使用Mongodb)
- * @Reference :
- * @Author : wei.peng
- * @Date : 2018-10-22 12:03:00.118
- * @Modify :
- **/
-public interface SysLogOperateRepository extends BaseMongoRepository {
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogSystemRepository.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogSystemRepository.java
deleted file mode 100644
index eddc176..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogSystemRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.estsh.i3plus.pojo.platform.platrepositorymongo;
-
-import cn.estsh.i3plus.pojo.base.jpa.dao.BaseMongoRepository;
-import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
-
-/**
- * @Description : 系统日志表
- * @Reference :
- * @Author : wei.peng
- * @Date : 2018-10-22 12:03:00.158
- * @Modify :
- **/
-public interface SysLogSystemRepository extends BaseMongoRepository {
-}
diff --git a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogTaskTimeRepository.java b/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogTaskTimeRepository.java
deleted file mode 100644
index 1ce1eef..0000000
--- a/modules/i3plus-pojo-base-mongo/src/main/java/cn/estsh/i3plus/pojo/platform/platrepositorymongo/SysLogTaskTimeRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package cn.estsh.i3plus.pojo.platform.platrepositorymongo;
-
-import cn.estsh.i3plus.pojo.base.jpa.dao.BaseMongoRepository;
-import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
-
-/**
- * @Description :
- * @Reference :
- * @Author : yunhao
- * @CreateDate : 2018-12-20 22:35
- * @Modify:
- **/
-public interface SysLogTaskTimeRepository extends BaseMongoRepository {
-}
diff --git a/pom.xml b/pom.xml
index f611147..eea185f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,6 @@
modules/i3plus-pojo-ptl
modules/i3plus-pojo-ics
modules/i3plus-pojo-mdm
- modules/i3plus-pojo-base-mongo