parent
56b02c0a11
commit
693f8c6dd3
@ -85,12 +85,16 @@ public class MybatisParameterHandler extends DefaultParameterHandler {
|
||||
if (parameter instanceof Map) {
|
||||
// 处理单参数使用注解标记的时候,尝试提取et来获取实体参数
|
||||
Map<?, ?> map = (Map<?, ?>) parameter;
|
||||
if (map.containsKey(Constants.ENTITY)) {
|
||||
Object et = map.get(Constants.ENTITY);
|
||||
if (et != null) {
|
||||
entity = et;
|
||||
tableInfo = TableInfoHelper.getTableInfo(entity.getClass());
|
||||
}
|
||||
Object et = null;
|
||||
if(map.containsKey(Constants.ENTITY)){
|
||||
et = map.get(Constants.ENTITY);
|
||||
|
||||
} else if(map.containsKey(Constants.MP_FILL_ET)){
|
||||
et = map.get(Constants.MP_FILL_ET);
|
||||
}
|
||||
if (et != null) {
|
||||
entity = et;
|
||||
tableInfo = TableInfoHelper.getTableInfo(entity.getClass());
|
||||
}
|
||||
} else {
|
||||
tableInfo = TableInfoHelper.getTableInfo(parameter.getClass());
|
||||
|
@ -85,7 +85,7 @@ public class DeleteByIds extends AbstractMethod {
|
||||
String sqlSet = "SET ";
|
||||
if (CollectionUtils.isNotEmpty(fieldInfos)) {
|
||||
sqlSet += SqlScriptUtils.convertIf(fieldInfos.stream()
|
||||
.map(i -> i.getSqlSet(Constants.ENTITY + StringPool.DOT)).collect(joining(EMPTY)), String.format("%s != null", Constants.ENTITY), true);
|
||||
.map(i -> i.getSqlSet(Constants.MP_FILL_ET + StringPool.DOT)).collect(joining(EMPTY)), String.format("%s != null", Constants.MP_FILL_ET), true);
|
||||
}
|
||||
sqlSet += StringPool.EMPTY + tableInfo.getLogicDeleteSql(false, false);
|
||||
return String.format(sqlMethod.getSql(), tableInfo.getTableName(),
|
||||
|
@ -213,7 +213,7 @@ public interface BaseMapper<T> extends Mapper<T> {
|
||||
TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (useFill && tableInfo.isWithLogicDelete() && tableInfo.isWithUpdateFill()) {
|
||||
params.put(Constants.ENTITY, tableInfo.newInstance());
|
||||
params.put(Constants.MP_FILL_ET, tableInfo.newInstance());
|
||||
}
|
||||
params.put(Constants.COLL, collections);
|
||||
return sqlSession.delete(mapperInterface.getName() + StringPool.DOT + SqlMethod.DELETE_BY_IDS.getMethod(), params);
|
||||
|
@ -52,6 +52,14 @@ public interface Constants extends StringPool, Serializable {
|
||||
* 实体类
|
||||
*/
|
||||
String ENTITY = "et";
|
||||
|
||||
/**
|
||||
* 填充实体
|
||||
*
|
||||
* @since 3.5.8
|
||||
*/
|
||||
String MP_FILL_ET = "mpFillEt";
|
||||
|
||||
/**
|
||||
* 实体类 带后缀 ==> .
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user