|
@@ -69,6 +69,7 @@ import lombok.NonNull;
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
import org.mybatis.spring.SqlSessionTemplate;
|
|
import org.mybatis.spring.SqlSessionTemplate;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -639,6 +640,21 @@ public final class DatabaseContextHolder {
|
|
return query;
|
|
return query;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 数据更新或忽略
|
|
|
|
+ *
|
|
|
|
+ * @param executor 数据更新执行函数
|
|
|
|
+ * @return true/false
|
|
|
|
+ */
|
|
|
|
+ public static boolean modifyIgnore(@NonNull Executor executor) {
|
|
|
|
+ try {
|
|
|
|
+ executor.execute();
|
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 将分页请求参数转换成MyBatis Plus分页参数
|
|
* 将分页请求参数转换成MyBatis Plus分页参数
|
|
*
|
|
*
|