mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:同步2.0版本
This commit is contained in:
@@ -77,23 +77,20 @@
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-mapper.version}</version>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.orange.demo.common.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 主要用于标记逻辑删除字段。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DeletedFlagColumn {
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典缓存同步的AOP。该AOP的优先级必须比事务切面的优先级高,因此会在事务外执行该切面的代码。
|
||||
*
|
||||
@@ -39,23 +41,23 @@ public class DictCacheSyncAspect {
|
||||
Object arg = joinPoint.getArgs()[0];
|
||||
if ("saveNew".equals(methodName)) {
|
||||
Object data = joinPoint.proceed();
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
// 这里参数必须使用saveNew方法的返回对象,因为里面包含实际主键值。
|
||||
service.putDictionaryCache(data);
|
||||
return data;
|
||||
} else if ("update".equals(methodName)) {
|
||||
Object data = joinPoint.proceed();
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
// update的方法返回的是boolean,因此这里的参数需要使用第一个参数即可。
|
||||
service.putDictionaryCache(arg);
|
||||
return data;
|
||||
} else {
|
||||
// remove
|
||||
BaseDictService<Object, Object> service =
|
||||
(BaseDictService<Object, Object>) joinPoint.getTarget();
|
||||
service.removeDictionaryCache(arg);
|
||||
BaseDictService<Object, Serializable> service =
|
||||
(BaseDictService<Object, Serializable>) joinPoint.getTarget();
|
||||
service.removeDictionaryCache((Serializable) arg);
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.orange.demo.common.core.base.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||
import com.orange.demo.common.core.base.service.IBaseService;
|
||||
import com.orange.demo.common.core.constant.AggregationKind;
|
||||
@@ -18,7 +19,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.LinkedList;
|
||||
@@ -37,7 +38,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseController<M, V, K> {
|
||||
public abstract class BaseController<M, V, K extends Serializable> {
|
||||
|
||||
/**
|
||||
* 当前Service关联的主Model实体对象的Class。
|
||||
@@ -68,7 +69,7 @@ public abstract class BaseController<M, V, K> {
|
||||
domainVoClass = (Class<V>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
if (null != field.getAnnotation(Id.class)) {
|
||||
if (null != field.getAnnotation(TableId.class)) {
|
||||
idFieldName = field.getName();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.orange.demo.common.core.base.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import tk.mybatis.mapper.additional.insert.InsertListMapper;
|
||||
import tk.mybatis.mapper.annotation.RegisterMapper;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,8 +14,7 @@ import java.util.Map;
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@RegisterMapper
|
||||
public interface BaseDaoMapper<M> extends Mapper<M>, InsertListMapper<M> {
|
||||
public interface BaseDaoMapper<M> extends BaseMapper<M> {
|
||||
|
||||
/**
|
||||
* 根据指定的表名、显示字段列表、过滤条件字符串和分组字段,返回聚合计算后的查询结果。
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.orange.demo.common.core.base.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -17,24 +17,24 @@ public class BaseModel {
|
||||
/**
|
||||
* 创建者Id。
|
||||
*/
|
||||
@Column(name = "create_user_id")
|
||||
@TableField(value = "create_user_id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建时间。
|
||||
*/
|
||||
@Column(name = "create_time")
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者Id。
|
||||
*/
|
||||
@Column(name = "update_user_id")
|
||||
@TableField(value = "update_user_id")
|
||||
private Long updateUserId;
|
||||
|
||||
/**
|
||||
* 更新时间。
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@TableField(value = "update_time")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orange.demo.common.core.exception.MyRuntimeException;
|
||||
import com.orange.demo.common.core.cache.DictionaryCache;
|
||||
@@ -8,8 +9,8 @@ import com.orange.demo.common.core.object.TokenData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ import java.util.*;
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseDictService<M, K> extends BaseService<M, K> implements IBaseDictService<M, K> {
|
||||
public abstract class BaseDictService<M, K extends Serializable> extends BaseService<M, K> implements IBaseDictService<M, K> {
|
||||
|
||||
/**
|
||||
* 缓存池对象。
|
||||
@@ -89,15 +90,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
if (tenantIdField != null) {
|
||||
ReflectUtil.setFieldValue(data, tenantIdField, TokenData.takeFromRequest().getTenantId());
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(data, GlobalDeletedFlag.NORMAL);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection [setDeletedFlagMethod] in BaseDictService.update.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
}
|
||||
return mapper().updateByPrimaryKey(data) == 1;
|
||||
return mapper().updateById(data) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +102,7 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean remove(K id) {
|
||||
return this.removeById(id);
|
||||
return mapper().deleteById(id) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,15 +111,16 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
* @param id 主键Id。
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public M getById(K id) {
|
||||
M data = dictionaryCache.get(id);
|
||||
public M getById(Serializable id) {
|
||||
M data = dictionaryCache.get((K) id);
|
||||
if (data != null) {
|
||||
return data;
|
||||
}
|
||||
data = super.getById(id);
|
||||
if (data != null) {
|
||||
this.dictionaryCache.put(id, data);
|
||||
this.dictionaryCache.put((K) id, data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -220,8 +214,10 @@ public abstract class BaseDictService<M, K> extends BaseService<M, K> implements
|
||||
List<M> dataList = this.getInList((Set<K>) inFilterValues);
|
||||
return dataList.size() == inFilterValues.size();
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, null);
|
||||
return mapper().selectCountByExample(e) == inFilterValues.size();
|
||||
String columnName = this.safeMapToColumnName(inFilterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in(columnName, inFilterValues);
|
||||
return mapper().selectCount(queryWrapper) == inFilterValues.size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orange.demo.common.core.annotation.*;
|
||||
@@ -8,6 +13,7 @@ import com.orange.demo.common.core.base.client.BaseClient;
|
||||
import com.orange.demo.common.core.constant.AggregationKind;
|
||||
import com.orange.demo.common.core.constant.AggregationType;
|
||||
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||
import com.orange.demo.common.core.exception.InvalidDataFieldException;
|
||||
import com.orange.demo.common.core.exception.MyRuntimeException;
|
||||
import com.orange.demo.common.core.exception.RemoteDataBuildException;
|
||||
import com.orange.demo.common.core.object.*;
|
||||
@@ -21,12 +27,8 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -47,7 +49,7 @@ import static java.util.stream.Collectors.*;
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
public abstract class BaseService<M, K extends Serializable> extends ServiceImpl<BaseDaoMapper<M>, M> implements IBaseService<M, K> {
|
||||
/**
|
||||
* 当前Service关联的主Model实体对象的Class。
|
||||
*/
|
||||
@@ -156,6 +158,11 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
|
||||
private static final String AND_OP = " AND ";
|
||||
|
||||
@Override
|
||||
public BaseDaoMapper<M> getBaseMapper() {
|
||||
return mapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数,在实例化的时候,一次性完成所有有关主Model对象信息的加载。
|
||||
*/
|
||||
@@ -163,7 +170,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
public BaseService() {
|
||||
modelClass = (Class<M>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
idFieldClass = (Class<K>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
|
||||
this.tableName = modelClass.getAnnotation(Table.class).name();
|
||||
this.tableName = modelClass.getAnnotation(TableName.class).value();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
initializeField(field);
|
||||
@@ -171,10 +178,10 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
|
||||
private void initializeField(Field field) {
|
||||
if (idFieldName == null && null != field.getAnnotation(Id.class)) {
|
||||
if (idFieldName == null && null != field.getAnnotation(TableId.class)) {
|
||||
idFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
idColumnName = c == null ? idFieldName : c.name();
|
||||
TableId c = field.getAnnotation(TableId.class);
|
||||
idColumnName = c == null ? idFieldName : c.value();
|
||||
setIdFieldMethod = ReflectUtil.getMethod(
|
||||
modelClass, "set" + StringUtils.capitalize(idFieldName), idFieldClass);
|
||||
getIdFieldMethod = ReflectUtil.getMethod(
|
||||
@@ -182,21 +189,18 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
if (updateTimeFieldName == null && null != field.getAnnotation(JobUpdateTimeColumn.class)) {
|
||||
updateTimeFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
updateTimeColumnName = c == null ? updateTimeFieldName : c.name();
|
||||
updateTimeColumnName = this.safeMapToColumnName(updateTimeFieldName);
|
||||
}
|
||||
if (deletedFlagFieldName == null && null != field.getAnnotation(DeletedFlagColumn.class)) {
|
||||
if (deletedFlagFieldName == null && null != field.getAnnotation(TableLogic.class)) {
|
||||
deletedFlagFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
deletedFlagColumnName = c == null ? deletedFlagFieldName : c.name();
|
||||
deletedFlagColumnName = this.safeMapToColumnName(deletedFlagFieldName);
|
||||
setDeletedFlagMethod = ReflectUtil.getMethod(
|
||||
modelClass, "set" + StringUtils.capitalize(deletedFlagFieldName), Integer.class);
|
||||
}
|
||||
if (tenantIdFieldName == null && null != field.getAnnotation(TenantFilterColumn.class)) {
|
||||
tenantIdField = field;
|
||||
tenantIdFieldName = field.getName();
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
tenantIdColumnName = c == null ? tenantIdFieldName : c.name();
|
||||
tenantIdColumnName = this.safeMapToColumnName(tenantIdFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,31 +223,6 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于主键Id删除数据。如果包含逻辑删除字段,则进行逻辑删除。
|
||||
*
|
||||
* @param id 主键Id值。
|
||||
* @return true删除成功,false数据不存在。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean removeById(K id) {
|
||||
if (this.deletedFlagFieldName == null) {
|
||||
return mapper().deleteByPrimaryKey(id) == 1;
|
||||
}
|
||||
try {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria().andEqualTo(idFieldName, id);
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
M data = modelClass.newInstance();
|
||||
setDeletedFlagMethod.invoke(data, GlobalDeletedFlag.DELETED);
|
||||
return mapper().updateByExampleSelective(data, e) == 1;
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to call reflection method in BaseService.removeById.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据过滤条件删除数据。
|
||||
*
|
||||
@@ -253,25 +232,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Integer removeBy(M filter) {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().delete(filter);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
if (field.getAnnotation(Transient.class) == null) {
|
||||
this.assembleCriteriaByFilter(filter, field, c);
|
||||
}
|
||||
}
|
||||
try {
|
||||
M deletedObject = modelClass.newInstance();
|
||||
this.setDeletedFlagMethod.invoke(deletedObject, GlobalDeletedFlag.DELETED);
|
||||
return mapper().updateByExampleSelective(deletedObject, e);
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to call reflection method in BaseService.removeBy.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
return mapper().delete(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,27 +260,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (fieldName.equals(this.idFieldName)) {
|
||||
return this.existId((K) fieldValue);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria().andEqualTo(fieldName, fieldValue);
|
||||
return mapper().selectCountByExample(e) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键Id关联的数据。
|
||||
*
|
||||
* @param id 主键Id
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
@Override
|
||||
public M getById(K id) {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectByPrimaryKey(id);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria()
|
||||
.andEqualTo(idFieldName, id)
|
||||
.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectOneByExample(e);
|
||||
String columnName = MyModelUtil.mapToColumnName(fieldName, modelClass);
|
||||
return mapper().selectCount(new QueryWrapper<M>().eq(columnName, fieldValue)) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,12 +277,9 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (filterField.equals(idFieldName)) {
|
||||
return this.getById((K) filterValue);
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria().andEqualTo(filterField, filterValue);
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectOneByExample(e);
|
||||
String columnName = this.safeMapToColumnName(filterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<M>().eq(columnName, filterValue);
|
||||
return mapper().selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,12 +304,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getAllList() {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectAll();
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
e.createCriteria().andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(Wrappers.emptyWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,14 +315,11 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getAllListByOrder(String... orderByProperties) {
|
||||
Example e = new Example(modelClass);
|
||||
for (String orderByProperty : orderByProperties) {
|
||||
e.orderBy(orderByProperty);
|
||||
String[] columns = new String[orderByProperties.length];
|
||||
for (int i = 0; i < orderByProperties.length; i++) {
|
||||
columns[i] = this.safeMapToColumnName(orderByProperties[i]);
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
e.and().andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(new QueryWrapper<M>().orderByAsc(columns));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,8 +348,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (CollectionUtils.isEmpty(inFilterValues)) {
|
||||
return true;
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, null);
|
||||
return mapper().selectCountByExample(e) == inFilterValues.size();
|
||||
String column = this.safeMapToColumnName(inFilterField);
|
||||
return mapper().selectCount(new QueryWrapper<M>().in(column, inFilterValues)) == inFilterValues.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,8 +388,58 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (CollectionUtils.isEmpty(inFilterValues)) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
Example e = this.makeDefaultInListExample(inFilterField, inFilterValues, orderBy);
|
||||
return mapper().selectByExample(e);
|
||||
String column = this.safeMapToColumnName(inFilterField);
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<M>().in(column, inFilterValues);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
queryWrapper.last(orderBy);
|
||||
}
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回符合主键 in (idValues) 条件的所有数据。同时返回关联数据。
|
||||
*
|
||||
* @param idValues 主键值集合。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
@Override
|
||||
public List<M> getInListWithRelation(Set<K> idValues, MyRelationParam relationParam) {
|
||||
List<M> resultList = this.getInList(idValues);
|
||||
this.buildRelationForDataList(resultList, relationParam);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据。同时返回关联数据。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
@Override
|
||||
public <T> List<M> getInListWithRelation(String inFilterField, Set<T> inFilterValues, MyRelationParam relationParam) {
|
||||
List<M> resultList = this.getInList(inFilterField, inFilterValues);
|
||||
this.buildRelationForDataList(resultList, relationParam);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据,并根据orderBy字段排序。同时返回关联数据。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
* @param orderBy 排序字段。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
@Override
|
||||
public <T> List<M> getInListWithRelation(
|
||||
String inFilterField, Set<T> inFilterValues, String orderBy, MyRelationParam relationParam) {
|
||||
List<M> resultList = this.getInList(inFilterField, inFilterValues, orderBy);
|
||||
this.buildRelationForDataList(resultList, relationParam);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -469,16 +450,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public int getCountByFilter(M filter) {
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().selectCount(filter);
|
||||
}
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(filter, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().selectCount(filter);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection [setDeletedFlagMethod] in BaseService.getCountByFilter.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
return mapper().selectCount(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,42 +472,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByFilter(M filter) {
|
||||
if (filter == null) {
|
||||
return this.getAllList();
|
||||
}
|
||||
if (deletedFlagFieldName == null) {
|
||||
return mapper().select(filter);
|
||||
}
|
||||
try {
|
||||
setDeletedFlagMethod.invoke(filter, GlobalDeletedFlag.NORMAL);
|
||||
return mapper().select(filter);
|
||||
} catch (Exception ex) {
|
||||
log.error("Failed to call reflection code of BaseService.getListByFilter.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void assembleCriteriaByFilter(M filter, Field field, Example.Criteria c) {
|
||||
int modifiers = field.getModifiers();
|
||||
// transient类型的字段不能作为查询条件
|
||||
int transientMask = 128;
|
||||
if ((modifiers & transientMask) != 0 || Modifier.isStatic(modifiers)) {
|
||||
return;
|
||||
}
|
||||
if (field.getName().equals(deletedFlagFieldName)) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
} else {
|
||||
ReflectUtil.setAccessible(field);
|
||||
try {
|
||||
Object o = field.get(filter);
|
||||
if (o != null) {
|
||||
c.andEqualTo(field.getName(), field.get(filter));
|
||||
}
|
||||
} catch (IllegalAccessException ex) {
|
||||
log.error("Failed to call reflection code of BaseService.getListByFilter.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
return mapper().selectList(new QueryWrapper<>(filter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,17 +484,14 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByParentId(String parentIdFieldName, K parentId) {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria();
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>();
|
||||
String parentIdColumn = this.safeMapToColumnName(parentIdFieldName);
|
||||
if (parentId != null) {
|
||||
c.andEqualTo(parentIdFieldName, parentId);
|
||||
queryWrapper.eq(parentIdColumn, parentId);
|
||||
} else {
|
||||
c.andIsNull(parentIdFieldName);
|
||||
queryWrapper.isNull(parentIdColumn);
|
||||
}
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,32 +521,21 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
*/
|
||||
@Override
|
||||
public List<M> getListByCondition(List<String> selectList, M filter, String whereClause, String orderBy) {
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = null;
|
||||
QueryWrapper<M> queryWrapper = new QueryWrapper<>(filter);
|
||||
if (CollectionUtils.isNotEmpty(selectList)) {
|
||||
String[] selectFields = new String[selectList.size()];
|
||||
selectList.toArray(selectFields);
|
||||
e.selectProperties(selectFields);
|
||||
}
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
e.setOrderByClause(orderBy);
|
||||
}
|
||||
if (filter != null) {
|
||||
c = e.createCriteria();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
if (field.getAnnotation(Transient.class) == null) {
|
||||
this.assembleCriteriaByFilter(filter, field, c);
|
||||
}
|
||||
String[] columns = new String[selectList.size()];
|
||||
for (int i = 0; i < selectList.size(); i++) {
|
||||
columns[i] = this.safeMapToColumnName(selectList.get(i));
|
||||
}
|
||||
queryWrapper.select(columns);
|
||||
}
|
||||
if (StringUtils.isNotBlank(whereClause)) {
|
||||
if (c == null) {
|
||||
c = e.createCriteria();
|
||||
}
|
||||
c.andCondition(whereClause);
|
||||
queryWrapper.apply(whereClause);
|
||||
}
|
||||
return mapper().selectByExample(e);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
queryWrapper.last(" ORDER BY " + orderBy);
|
||||
}
|
||||
return mapper().selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -911,9 +834,10 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
continue;
|
||||
}
|
||||
Object masterIdValue = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
Example e = new Example(relationStruct.relationManyToMany.relationModelClass());
|
||||
e.createCriteria().andEqualTo(relationStruct.masterIdField.getName(), masterIdValue);
|
||||
List<?> manyToManyList = relationStruct.manyToManyMapper.selectByExample(e);
|
||||
String masterIdColumn = this.safeMapToColumnName(relationStruct.masterIdField.getName());
|
||||
Map<String, Object> filterMap = new HashMap<>(1);
|
||||
filterMap.put(masterIdColumn, masterIdValue);
|
||||
List<?> manyToManyList = relationStruct.manyToManyMapper.selectByMap(filterMap);
|
||||
ReflectUtil.setFieldValue(dataObject, relationStruct.relationField, manyToManyList);
|
||||
}
|
||||
}
|
||||
@@ -1304,7 +1228,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (CollectionUtils.isEmpty(masterIdSet)) {
|
||||
continue;
|
||||
}
|
||||
BaseService<Object, Object> relationService = relationStruct.localService;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.localService;
|
||||
List<Object> relationList =
|
||||
relationService.getInList(relationStruct.relationOneToOne.slaveIdField(), masterIdSet);
|
||||
MyModelUtil.makeOneToOneRelation(
|
||||
@@ -1313,8 +1237,8 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
if (withDict && relationStruct.relationOneToOne.loadSlaveDict()
|
||||
&& CollectionUtils.isNotEmpty(relationList)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
BaseService<Object, Object> proxyTarget =
|
||||
(BaseService<Object, Object>) AopTargetUtil.getTarget(relationService);
|
||||
BaseService<Object, Serializable> proxyTarget =
|
||||
(BaseService<Object, Serializable>) AopTargetUtil.getTarget(relationService);
|
||||
// 关联常量字典
|
||||
proxyTarget.buildConstDictForDataList(relationList, ignoreFields);
|
||||
// 关联本地字典。
|
||||
@@ -1343,14 +1267,14 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
Object id = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
if (id != null) {
|
||||
BaseService<Object, Object> relationService = relationStruct.localService;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.localService;
|
||||
Object relationObject = relationService.getOne(relationStruct.relationOneToOne.slaveIdField(), id);
|
||||
ReflectUtil.setFieldValue(dataObject, relationStruct.relationField, relationObject);
|
||||
// 仅仅当需要加载从表字典关联时,才去加载。
|
||||
if (withDict && relationStruct.relationOneToOne.loadSlaveDict() && relationObject != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
BaseService<Object, Object> proxyTarget =
|
||||
(BaseService<Object, Object>) AopTargetUtil.getTarget(relationService);
|
||||
BaseService<Object, Serializable> proxyTarget =
|
||||
(BaseService<Object, Serializable>) AopTargetUtil.getTarget(relationService);
|
||||
// 关联常量字典
|
||||
proxyTarget.buildConstDictForData(relationObject, ignoreFields);
|
||||
// 关联本地字典。
|
||||
@@ -1382,7 +1306,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
.collect(toSet());
|
||||
// 从主表集合中,抽取主表关联字段的集合,再以in list形式去从表中查询。
|
||||
if (CollectionUtils.isNotEmpty(masterIdSet)) {
|
||||
BaseService<Object, Object> relationService = relationStruct.localService;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.localService;
|
||||
List<Object> relationList =
|
||||
relationService.getInList(relationStruct.relationOneToMany.slaveIdField(), masterIdSet);
|
||||
MyModelUtil.makeOneToManyRelation(
|
||||
@@ -1407,7 +1331,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
Object id = ReflectUtil.getFieldValue(dataObject, relationStruct.masterIdField);
|
||||
if (id != null) {
|
||||
BaseService<Object, Object> relationService = relationStruct.localService;
|
||||
BaseService<Object, Serializable> relationService = relationStruct.localService;
|
||||
Set<Object> masterIdSet = new HashSet<>(1);
|
||||
masterIdSet.add(id);
|
||||
List<Object> relationObject = relationService.getInList(
|
||||
@@ -1799,32 +1723,97 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过(In-list)条件和orderBy条件,构建Example对象,以供后续的查询操作使用。
|
||||
* 因为Mybatis Plus中QueryWrapper的条件方法都要求传入数据表字段名,因此提供该函数将
|
||||
* Java实体对象的字段名转换为数据表字段名,如果不存在会抛出异常。
|
||||
* 另外在MyModelUtil.mapToColumnName有一级缓存,对于查询过的对象字段都会放到缓存中,
|
||||
* 下次映射转换的时候,会直接从缓存获取。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的字段值集合。
|
||||
* @param orderBy 排序字段。
|
||||
* @param <T> in 属性字段的类型。
|
||||
* @return 构建后的Example对象。
|
||||
* @param fieldName Java实体对象的字段名。
|
||||
* @return 对应的数据表字段名。
|
||||
*/
|
||||
protected <T> Example makeDefaultInListExample(String inFilterField, Collection<T> inFilterValues, String orderBy) {
|
||||
Set<T> inFilterValueSet;
|
||||
Example e = new Example(modelClass);
|
||||
if (StringUtils.isNotBlank(orderBy)) {
|
||||
e.setOrderByClause(orderBy);
|
||||
protected String safeMapToColumnName(String fieldName) {
|
||||
String columnName = MyModelUtil.mapToColumnName(fieldName, modelClass);
|
||||
if (columnName == null) {
|
||||
throw new InvalidDataFieldException(modelClass.getSimpleName(), fieldName);
|
||||
}
|
||||
if (inFilterValues instanceof Set) {
|
||||
inFilterValueSet = (Set<T>) inFilterValues;
|
||||
} else {
|
||||
inFilterValueSet = new HashSet<>(inFilterValues.size());
|
||||
inFilterValueSet.addAll(inFilterValues);
|
||||
return columnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
* 相比于其他重载方法,该方法会将参数中的主键id,设置到UpdateWrapper的过滤条件中。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @param id 实体对象的主键值。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
protected UpdateWrapper<M> createUpdateQueryForNullValue(M o, K id) {
|
||||
UpdateWrapper<M> uw = createUpdateQueryForNullValue(o, modelClass);
|
||||
try {
|
||||
M filter = modelClass.newInstance();
|
||||
this.setIdFieldMethod.invoke(filter, id);
|
||||
uw.setEntity(filter);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to call reflection code of BaseService.createUpdateQueryForNullValue.", e);
|
||||
throw new MyRuntimeException(e);
|
||||
}
|
||||
Example.Criteria c = e.createCriteria();
|
||||
c.andIn(inFilterField, inFilterValueSet);
|
||||
if (deletedFlagFieldName != null) {
|
||||
c.andEqualTo(deletedFlagFieldName, GlobalDeletedFlag.NORMAL);
|
||||
return uw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
protected UpdateWrapper<M> createUpdateQueryForNullValue(M o) {
|
||||
return createUpdateQueryForNullValue(o, modelClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 因为Mybatis Plus在update的时候,不能将实体对象中值为null的字段,更新为null,
|
||||
* 而且忽略更新,在全部更新场景下,这个是非常重要的,所以我们写了这个函数绕开这一问题。
|
||||
* 该函数会遍历实体对象中,所有不包含@Transient注解,没有transient修饰符的字段,如果
|
||||
* 当前对象的该字段值为null,则会调用UpdateWrapper的set方法,将该字段赋值为null。
|
||||
*
|
||||
* @param o 实体对象。
|
||||
* @param clazz 实体对象的class。
|
||||
* @return 创建后的UpdateWrapper。
|
||||
*/
|
||||
public static <T> UpdateWrapper<T> createUpdateQueryForNullValue(T o, Class<T> clazz) {
|
||||
UpdateWrapper<T> uw = new UpdateWrapper<>();
|
||||
Field[] fields = ReflectUtil.getFields(clazz);
|
||||
List<String> nullColumnList = new LinkedList<>();
|
||||
for (Field field : fields) {
|
||||
TableField tableField = field.getAnnotation(TableField.class);
|
||||
if (tableField == null || tableField.exist()) {
|
||||
int modifiers = field.getModifiers();
|
||||
// transient类型的字段不能作为查询条件,静态字段和逻辑删除都不考虑。
|
||||
int transientMask = 128;
|
||||
if ((modifiers & transientMask) == 1
|
||||
|| Modifier.isStatic(modifiers)
|
||||
|| field.getAnnotation(TableLogic.class) != null) {
|
||||
continue;
|
||||
}
|
||||
// 仅当实体对象参数中,当前字段值为null的时候,才会赋值给UpdateWrapper。
|
||||
// 以便在后续的更新中,可以将这些null字段的值设置到数据库表对应的字段中。
|
||||
if (ReflectUtil.getFieldValue(o, field) == null) {
|
||||
nullColumnList.add(MyModelUtil.safeMapToColumnName(field.getName(), clazz));
|
||||
}
|
||||
}
|
||||
}
|
||||
return e;
|
||||
if (CollectionUtils.isNotEmpty(nullColumnList)) {
|
||||
for (String nullColumn : nullColumnList) {
|
||||
uw.set(nullColumn, null);
|
||||
}
|
||||
}
|
||||
return uw;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -1914,7 +1903,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.localService = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToOne.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.localService = (BaseService<Object, Object>)
|
||||
relationStruct.localService = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToOne.slaveServiceClass());
|
||||
}
|
||||
localRelationOneToOneStructList.add(relationStruct);
|
||||
@@ -1930,7 +1919,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.localService = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToMany.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.localService = (BaseService<Object, Object>)
|
||||
relationStruct.localService = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToMany.slaveServiceClass());
|
||||
}
|
||||
localRelationOneToManyStructList.add(relationStruct);
|
||||
@@ -1977,7 +1966,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.localService =
|
||||
ApplicationContextHolder.getBean(StringUtils.uncapitalize(relationDict.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.localService = (BaseService<Object, Object>)
|
||||
relationStruct.localService = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationDict.slaveServiceClass());
|
||||
}
|
||||
localRelationDictStructList.add(relationStruct);
|
||||
@@ -1999,7 +1988,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.localService = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationOneToManyAggregation.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.localService = (BaseService<Object, Object>)
|
||||
relationStruct.localService = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationOneToManyAggregation.slaveServiceClass());
|
||||
}
|
||||
localRelationOneToManyAggrStructList.add(relationStruct);
|
||||
@@ -2018,7 +2007,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
relationStruct.localService = ApplicationContextHolder.getBean(
|
||||
StringUtils.uncapitalize(relationManyToManyAggregation.slaveServiceName()));
|
||||
} else {
|
||||
relationStruct.localService = (BaseService<Object, Object>)
|
||||
relationStruct.localService = (BaseService<Object, Serializable>)
|
||||
ApplicationContextHolder.getBean(relationManyToManyAggregation.slaveServiceClass());
|
||||
}
|
||||
localRelationManyToManyAggrStructList.add(relationStruct);
|
||||
@@ -2411,7 +2400,7 @@ public abstract class BaseService<M, K> implements IBaseService<M, K> {
|
||||
|
||||
static class LocalRelationStruct extends RelationStruct {
|
||||
private Field equalOneToOneRelationField;
|
||||
private BaseService<Object, Object> localService;
|
||||
private BaseService<Object, Serializable> localService;
|
||||
private BaseDaoMapper<Object> manyToManyMapper;
|
||||
private Map<Object, String> dictMap;
|
||||
private RelationDict relationDict;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -10,7 +11,7 @@ import java.util.List;
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface IBaseDictService<M, K> extends IBaseService<M, K> {
|
||||
public interface IBaseDictService<M, K extends Serializable> extends IBaseService<M, K> {
|
||||
|
||||
/**
|
||||
* 重新加载数据库中所有当前表数据到系统内存。
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.orange.demo.common.core.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.orange.demo.common.core.object.MyRelationParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@@ -14,15 +16,7 @@ import java.util.function.Supplier;
|
||||
* @author Jerry
|
||||
* @date 2020-08-08
|
||||
*/
|
||||
public interface IBaseService<M, K> {
|
||||
|
||||
/**
|
||||
* 基于主键Id删除数据。如果包含逻辑删除字段,则进行逻辑删除。
|
||||
*
|
||||
* @param id 主键Id值。
|
||||
* @return true删除成功,false数据不存在。
|
||||
*/
|
||||
boolean removeById(K id);
|
||||
public interface IBaseService<M, K extends Serializable> extends IService<M>{
|
||||
|
||||
/**
|
||||
* 根据过滤条件删除数据。
|
||||
@@ -50,14 +44,6 @@ public interface IBaseService<M, K> {
|
||||
*/
|
||||
boolean existId(K id);
|
||||
|
||||
/**
|
||||
* 获取主键Id关联的数据。
|
||||
*
|
||||
* @param id 主键Id。
|
||||
* @return 主键关联的数据,不存在返回null。
|
||||
*/
|
||||
M getById(K id);
|
||||
|
||||
/**
|
||||
* 返回符合 filterField = filterValue 条件的一条数据。
|
||||
*
|
||||
@@ -135,6 +121,37 @@ public interface IBaseService<M, K> {
|
||||
*/
|
||||
<T> List<M> getInList(String inFilterField, Set<T> inFilterValues, String orderBy);
|
||||
|
||||
/**
|
||||
* 返回符合主键 in (idValues) 条件的所有数据。同时返回关联数据。
|
||||
*
|
||||
* @param idValues 主键值集合。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
List<M> getInListWithRelation(Set<K> idValues, MyRelationParam relationParam);
|
||||
|
||||
/**
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据。同时返回关联数据。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
<T> List<M> getInListWithRelation(String inFilterField, Set<T> inFilterValues, MyRelationParam relationParam);
|
||||
|
||||
/**
|
||||
* 返回符合 inFilterField in (inFilterValues) 条件的所有数据,并根据orderBy字段排序。同时返回关联数据。
|
||||
*
|
||||
* @param inFilterField 参与(In-list)过滤的Java字段。
|
||||
* @param inFilterValues 参与(In-list)过滤的Java字段值集合。
|
||||
* @param orderBy 排序字段。
|
||||
* @param relationParam 实体对象数据组装的参数构建器。
|
||||
* @return 检索后的数据列表。
|
||||
*/
|
||||
<T> List<M> getInListWithRelation(
|
||||
String inFilterField, Set<T> inFilterValues, String orderBy, MyRelationParam relationParam);
|
||||
|
||||
/**
|
||||
* 用参数对象作为过滤条件,获取数据数量。
|
||||
*
|
||||
|
||||
@@ -5,10 +5,13 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.orange.demo.common.core.constant.AppDeviceType;
|
||||
import com.orange.demo.common.core.validator.AddGroup;
|
||||
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.groups.Default;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -109,11 +112,75 @@ public class MyCommonUtil {
|
||||
* @return 没有错误返回null,否则返回具体的错误信息。
|
||||
*/
|
||||
public static <T> String getModelValidationError(T model, Class<?>...groups) {
|
||||
Set<ConstraintViolation<T>> constraintViolations = VALIDATOR.validate(model, groups);
|
||||
if (!constraintViolations.isEmpty()) {
|
||||
Iterator<ConstraintViolation<T>> it = constraintViolations.iterator();
|
||||
ConstraintViolation<T> constraint = it.next();
|
||||
return constraint.getMessage();
|
||||
if (model != null) {
|
||||
Set<ConstraintViolation<T>> constraintViolations = VALIDATOR.validate(model, groups);
|
||||
if (!constraintViolations.isEmpty()) {
|
||||
Iterator<ConstraintViolation<T>> it = constraintViolations.iterator();
|
||||
ConstraintViolation<T> constraint = it.next();
|
||||
return constraint.getMessage();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断模型对象是否通过校验,没有通过返回具体的校验错误信息。
|
||||
*
|
||||
* @param model 带校验的model。
|
||||
* @param forUpdate 是否为更新。
|
||||
* @return 没有错误返回null,否则返回具体的错误信息。
|
||||
*/
|
||||
public static <T> String getModelValidationError(T model, boolean forUpdate) {
|
||||
if (model != null) {
|
||||
Set<ConstraintViolation<T>> constraintViolations;
|
||||
if (forUpdate) {
|
||||
constraintViolations = VALIDATOR.validate(model, Default.class, UpdateGroup.class);
|
||||
} else {
|
||||
constraintViolations = VALIDATOR.validate(model, Default.class, AddGroup.class);
|
||||
}
|
||||
if (!constraintViolations.isEmpty()) {
|
||||
Iterator<ConstraintViolation<T>> it = constraintViolations.iterator();
|
||||
ConstraintViolation<T> constraint = it.next();
|
||||
return constraint.getMessage();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断模型对象是否通过校验,没有通过返回具体的校验错误信息。
|
||||
*
|
||||
* @param modelList 带校验的model列表。
|
||||
* @param groups Validate绑定的校验组。
|
||||
* @return 没有错误返回null,否则返回具体的错误信息。
|
||||
*/
|
||||
public static <T> String getModelValidationError(List<T> modelList, Class<?>... groups) {
|
||||
if (CollUtil.isNotEmpty(modelList)) {
|
||||
for (T model : modelList) {
|
||||
String errorMessage = getModelValidationError(model, groups);
|
||||
if (StrUtil.isNotBlank(errorMessage)) {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断模型对象是否通过校验,没有通过返回具体的校验错误信息。
|
||||
*
|
||||
* @param modelList 带校验的model列表。
|
||||
* @param forUpdate 是否为更新。
|
||||
* @return 没有错误返回null,否则返回具体的错误信息。
|
||||
*/
|
||||
public static <T> String getModelValidationError(List<T> modelList, boolean forUpdate) {
|
||||
if (CollUtil.isNotEmpty(modelList)) {
|
||||
for (T model : modelList) {
|
||||
String errorMessage = getModelValidationError(model, forUpdate);
|
||||
if (StrUtil.isNotBlank(errorMessage)) {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,22 +2,19 @@ package com.orange.demo.common.core.util;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.orange.demo.common.core.exception.InvalidDataFieldException;
|
||||
import com.orange.demo.common.core.annotation.*;
|
||||
import com.orange.demo.common.core.exception.MyRuntimeException;
|
||||
import com.orange.demo.common.core.object.TokenData;
|
||||
import com.orange.demo.common.core.object.Tuple2;
|
||||
import com.orange.demo.common.core.upload.UploadStoreInfo;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -96,6 +93,9 @@ public class MyModelUtil {
|
||||
* @return copy后的目标类型对象集合。
|
||||
*/
|
||||
public static <S, T> List<T> copyCollectionTo(Collection<S> sourceCollection, Class<T> targetClazz) {
|
||||
if (sourceCollection == null) {
|
||||
return null;
|
||||
}
|
||||
List<T> targetList = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(sourceCollection)) {
|
||||
for (S source : sourceCollection) {
|
||||
@@ -207,8 +207,20 @@ public class MyModelUtil {
|
||||
if (field == null) {
|
||||
return null;
|
||||
}
|
||||
Column c = field.getAnnotation(Column.class);
|
||||
String columnName = c == null ? fieldName : c.name();
|
||||
TableField c = field.getAnnotation(TableField.class);
|
||||
String columnName = null;
|
||||
if (c == null) {
|
||||
TableId id = field.getAnnotation(TableId.class);
|
||||
if (id != null) {
|
||||
columnName = id.value();
|
||||
}
|
||||
}
|
||||
if (columnName == null) {
|
||||
columnName = c == null ? CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, fieldName) : c.value();
|
||||
if (StringUtils.isBlank(columnName)) {
|
||||
columnName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, fieldName);
|
||||
}
|
||||
}
|
||||
// 这里缺省情况下都是按照整型去处理,因为他覆盖太多的类型了。
|
||||
// 如Integer/Long/Double/BigDecimal,可根据实际情况完善和扩充。
|
||||
String typeName = field.getType().getSimpleName();
|
||||
@@ -231,8 +243,8 @@ public class MyModelUtil {
|
||||
* @return Model对象对应的数据表名称。
|
||||
*/
|
||||
public static String mapToTableName(Class<?> modelClazz) {
|
||||
Table t = modelClazz.getAnnotation(Table.class);
|
||||
return t == null ? null : t.name();
|
||||
TableName t = modelClazz.getAnnotation(TableName.class);
|
||||
return t == null ? null : t.value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,43 +617,6 @@ public class MyModelUtil {
|
||||
return isMap ? BeanUtil.beanToMap(model) : model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换过滤对象到与其等效的Example对象。
|
||||
*
|
||||
* @param filterModel 过滤对象。
|
||||
* @param modelClass 过滤对象的Class对象。
|
||||
* @param <T> 过滤对象类型。
|
||||
* @return 转换后的Example对象。
|
||||
*/
|
||||
public static <T> Example convertFilterModelToExample(T filterModel, Class<T> modelClass) {
|
||||
if (filterModel == null) {
|
||||
return null;
|
||||
}
|
||||
Example e = new Example(modelClass);
|
||||
Example.Criteria c = e.createCriteria();
|
||||
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||
for (Field field : fields) {
|
||||
if (field.getAnnotation(Transient.class) == null) {
|
||||
int modifiers = field.getModifiers();
|
||||
// transient类型的字段不能作为查询条件
|
||||
if ((modifiers & 128) != 0 || Modifier.isStatic(modifiers)) {
|
||||
continue;
|
||||
}
|
||||
ReflectUtil.setAccessible(field);
|
||||
try {
|
||||
Object o = field.get(filterModel);
|
||||
if (o != null) {
|
||||
c.andEqualTo(field.getName(), field.get(filterModel));
|
||||
}
|
||||
} catch (IllegalAccessException ex) {
|
||||
log.error("Failed to call reflection code.", ex);
|
||||
throw new MyRuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传字段的存储信息。
|
||||
*
|
||||
|
||||
@@ -64,23 +64,20 @@
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||
|
||||
@@ -65,23 +65,20 @@
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||
|
||||
@@ -82,23 +82,20 @@
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.1.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
<modules>
|
||||
<module>common-core</module>
|
||||
<module>common-log</module>
|
||||
<module>common-datafilter</module>
|
||||
<module>common-xxljob</module>
|
||||
<module>common-redis</module>
|
||||
<module>common-sequence</module>
|
||||
<module>common-swagger</module>
|
||||
|
||||
Reference in New Issue
Block a user