toOptional();
-
- /**
- * Factory method for failure.
- *
- * @param e throwable to create the failed Try with
- * @param Type
- * @return a new Failure
- */
-
- public static Try failure(Throwable e) {
- return new Failure<>(e);
- }
-
- /**
- * Factory method for success.
- *
- * @param x value to create the successful Try with
- * @param Type
- * @return a new Success
- */
- public static Try successful(U x) {
- return new Success<>(x);
- }
+
+ protected Try() {
+ }
+
+ public static Try ofFailable(TrySupplier f) {
+ Objects.requireNonNull(f);
+
+ try {
+ return Try.successful(f.get());
+ } catch (Throwable t) {
+ return Try.failure(t);
+ }
+ }
+
+ /**
+ * Transform success or pass on failure.
+ * Takes an optional type parameter of the new type.
+ * You need to be specific about the new type if changing type
+ *
+ * Try.ofFailable(() -> "1").<Integer>map((x) -> Integer.valueOf(x))
+ *
+ * @param f function to apply to successful value.
+ * @param new type (optional)
+ * @return Success<U> or Failure<U>
+ */
+
+ public abstract Try map(TryMapFunction super T, ? extends U> f);
+
+ /**
+ * Transform success or pass on failure, taking a Try<U> as the result.
+ * Takes an optional type parameter of the new type.
+ * You need to be specific about the new type if changing type.
+ *
+ * Try.ofFailable(() -> "1").<Integer>flatMap((x) -> Try.ofFailable(() -> Integer.valueOf(x)))
+ * returns Integer(1)
+ *
+ * @param f function to apply to successful value.
+ * @param new type (optional)
+ * @return new composed Try
+ */
+ public abstract Try flatMap(TryMapFunction super T, Try> f);
+
+ /**
+ * Specifies a result to use in case of failure.
+ * Gives access to the exception which can be pattern matched on.
+ *
+ * Try.ofFailable(() -> "not a number")
+ * .<Integer>flatMap((x) -> Try.ofFailable(() ->Integer.valueOf(x)))
+ * .recover((t) -> 1)
+ * returns Integer(1)
+ *
+ * @param f function to execute on successful result.
+ * @return new composed Try
+ */
+
+ public abstract T recover(Function super Throwable, T> f);
+
+ /**
+ * Try applying f(t) on the case of failure.
+ *
+ * @param f function that takes throwable and returns result
+ * @return a new Try in the case of failure, or the current Success.
+ */
+ public abstract Try recoverWith(TryMapFunction super Throwable, Try> f);
+
+ /**
+ * Return a value in the case of a failure.
+ * This is similar to recover but does not expose the exception type.
+ *
+ * @param value return the try's value or else the value specified.
+ * @return new composed Try
+ */
+ public abstract T orElse(T value);
+
+ /**
+ * Return another try in the case of failure.
+ * Like recoverWith but without exposing the exception.
+ *
+ * @param f return the value or the value from the new try.
+ * @return new composed Try
+ */
+ public abstract Try orElseTry(TrySupplier f);
+
+ /**
+ * Gets the value T on Success or throws the cause of the failure.
+ *
+ * @return T
+ * @throws Throwable produced by the supplier function argument
+ */
+
+ public abstract T orElseThrow(Supplier extends X> exceptionSupplier) throws X;
+
+ /**
+ * Gets the value T on Success or throws the cause of the failure.
+ *
+ * @return T
+ * @throws Throwable
+ */
+ public abstract T get() throws Throwable;
+
+ /**
+ * Gets the value T on Success or throws the cause of the failure wrapped into a RuntimeException
+ *
+ * @return T
+ * @throws RuntimeException
+ */
+ public abstract T getUnchecked();
+
+ public abstract boolean isSuccess();
+
+ /**
+ * Performs the provided action, when successful
+ *
+ * @param action action to run
+ * @return new composed Try
+ * @throws E if the action throws an exception
+ */
+ public abstract Try onSuccess(TryConsumer action) throws E;
+
+ /**
+ * Performs the provided action, when failed
+ *
+ * @param action action to run
+ * @return new composed Try
+ * @throws E if the action throws an exception
+ */
+ public abstract Try onFailure(TryConsumer action) throws E;
+
+ /**
+ * If a Try is a Success and the predicate holds true, the Success is passed further.
+ * Otherwise (Failure or predicate doesn't hold), pass Failure.
+ *
+ * @param pred predicate applied to the value held by Try
+ * @return For Success, the same success if predicate holds true, otherwise Failure
+ */
+ public abstract Try filter(Predicate pred);
+
+ /**
+ * Try contents wrapped in Optional.
+ *
+ * @return Optional of T, if Success, Empty if Failure or null value
+ */
+ public abstract Optional toOptional();
+
+ /**
+ * Factory method for failure.
+ *
+ * @param e throwable to create the failed Try with
+ * @param Type
+ * @return a new Failure
+ */
+
+ public static Try failure(Throwable e) {
+ return new Failure<>(e);
+ }
+
+ /**
+ * Factory method for success.
+ *
+ * @param x value to create the successful Try with
+ * @param Type
+ * @return a new Success
+ */
+ public static Try successful(U x) {
+ return new Success<>(x);
+ }
}
class Success extends Try {
- private final T value;
-
- public Success(T value) {
- this.value = value;
- }
-
- @Override
- public Try flatMap(TryMapFunction super T, Try> f) {
- Objects.requireNonNull(f);
- try {
- return f.apply(value);
- } catch (Throwable t) {
- return Try.failure(t);
- }
- }
-
- @Override
- public T recover(Function super Throwable, T> f) {
- Objects.requireNonNull(f);
- return value;
- }
-
- @Override
- public Try recoverWith(TryMapFunction super Throwable, Try> f) {
- Objects.requireNonNull(f);
- return this;
- }
-
- @Override
- public T orElse(T value) {
- return this.value;
- }
-
- @Override
- public Try orElseTry(TrySupplier f) {
- Objects.requireNonNull(f);
- return this;
- }
-
- @Override
- public T orElseThrow(Supplier extends X> exceptionSupplier) throws X {
- return value;
- }
-
- @Override
- public T get() throws Throwable {
- return value;
- }
-
- @Override
- public T getUnchecked() {
- return value;
- }
-
- @Override
- public Try map(TryMapFunction super T, ? extends U> f) {
- Objects.requireNonNull(f);
- try {
- return new Success<>(f.apply(value));
- } catch (Throwable t) {
- return Try.failure(t);
- }
- }
-
- @Override
- public boolean isSuccess() {
- return true;
- }
-
- @Override
- public Try onSuccess(TryConsumer action) throws E {
- action.accept(value);
- return this;
- }
-
- @Override
- public Try filter(Predicate p) {
- Objects.requireNonNull(p);
-
- if (p.test(value)) {
- return this;
- } else {
- return Try.failure(new NoSuchElementException("Predicate does not match for " + value));
- }
- }
-
- @Override
- public Optional toOptional() {
- return Optional.ofNullable(value);
- }
-
- @Override
- public Try onFailure(TryConsumer action) {
- return this;
- }
+ private final T value;
+
+ public Success(T value) {
+ this.value = value;
+ }
+
+ @Override
+ public Try flatMap(TryMapFunction super T, Try> f) {
+ Objects.requireNonNull(f);
+ try {
+ return f.apply(value);
+ } catch (Throwable t) {
+ return Try.failure(t);
+ }
+ }
+
+ @Override
+ public T recover(Function super Throwable, T> f) {
+ Objects.requireNonNull(f);
+ return value;
+ }
+
+ @Override
+ public Try recoverWith(TryMapFunction super Throwable, Try> f) {
+ Objects.requireNonNull(f);
+ return this;
+ }
+
+ @Override
+ public T orElse(T value) {
+ return this.value;
+ }
+
+ @Override
+ public Try orElseTry(TrySupplier f) {
+ Objects.requireNonNull(f);
+ return this;
+ }
+
+ @Override
+ public T orElseThrow(Supplier extends X> exceptionSupplier) throws X {
+ return value;
+ }
+
+ @Override
+ public T get() throws Throwable {
+ return value;
+ }
+
+ @Override
+ public T getUnchecked() {
+ return value;
+ }
+
+ @Override
+ public Try map(TryMapFunction super T, ? extends U> f) {
+ Objects.requireNonNull(f);
+ try {
+ return new Success<>(f.apply(value));
+ } catch (Throwable t) {
+ return Try.failure(t);
+ }
+ }
+
+ @Override
+ public boolean isSuccess() {
+ return true;
+ }
+
+ @Override
+ public Try onSuccess(TryConsumer action) throws E {
+ action.accept(value);
+ return this;
+ }
+
+ @Override
+ public Try filter(Predicate p) {
+ Objects.requireNonNull(p);
+
+ if (p.test(value)) {
+ return this;
+ } else {
+ return Try.failure(new NoSuchElementException("Predicate does not match for " + value));
+ }
+ }
+
+ @Override
+ public Optional toOptional() {
+ return Optional.ofNullable(value);
+ }
+
+ @Override
+ public Try onFailure(TryConsumer action) {
+ return this;
+ }
}
class Failure extends Try {
- private final Throwable e;
-
- Failure(Throwable e) {
- this.e = e;
- }
-
- @Override
- public Try map(TryMapFunction super T, ? extends U> f) {
- Objects.requireNonNull(f);
- return Try.failure(e);
- }
-
- @Override
- public Try flatMap(TryMapFunction super T, Try> f) {
- Objects.requireNonNull(f);
- return Try.failure(e);
- }
-
- @Override
- public T recover(Function super Throwable, T> f) {
- Objects.requireNonNull(f);
- return f.apply(e);
- }
-
- @Override
- public Try recoverWith(TryMapFunction super Throwable, Try> f) {
- Objects.requireNonNull(f);
- try{
- return f.apply(e);
- }catch(Throwable t){
- return Try.failure(t);
- }
- }
-
- @Override
- public T orElse(T value) {
- return value;
- }
-
- @Override
- public Try orElseTry(TrySupplier f) {
- Objects.requireNonNull(f);
- return Try.ofFailable(f);
- }
-
- @Override
- public T orElseThrow(Supplier extends X> exceptionSupplier) throws X {
- throw exceptionSupplier.get();
- }
-
- @Override
- public T get() throws Throwable {
- throw e;
- }
-
- @Override
- public T getUnchecked() {
- throw new RuntimeException(e);
- }
-
- @Override
- public boolean isSuccess() {
- return false;
- }
-
- @Override
- public Try onSuccess(TryConsumer action) {
- return this;
- }
-
- @Override
- public Try filter(Predicate pred) {
- return this;
- }
-
- @Override
- public Optional toOptional() {
- return Optional.empty();
- }
-
- @Override
- public Try onFailure(TryConsumer action) throws E {
- action.accept(e);
- return this;
- }
+ private final Throwable e;
+
+ Failure(Throwable e) {
+ this.e = e;
+ }
+
+ @Override
+ public Try map(TryMapFunction super T, ? extends U> f) {
+ Objects.requireNonNull(f);
+ return Try.failure(e);
+ }
+
+ @Override
+ public Try flatMap(TryMapFunction super T, Try> f) {
+ Objects.requireNonNull(f);
+ return Try.failure(e);
+ }
+
+ @Override
+ public T recover(Function super Throwable, T> f) {
+ Objects.requireNonNull(f);
+ return f.apply(e);
+ }
+
+ @Override
+ public Try recoverWith(TryMapFunction super Throwable, Try> f) {
+ Objects.requireNonNull(f);
+ try {
+ return f.apply(e);
+ } catch (Throwable t) {
+ return Try.failure(t);
+ }
+ }
+
+ @Override
+ public T orElse(T value) {
+ return value;
+ }
+
+ @Override
+ public Try orElseTry(TrySupplier f) {
+ Objects.requireNonNull(f);
+ return Try.ofFailable(f);
+ }
+
+ @Override
+ public T orElseThrow(Supplier extends X> exceptionSupplier) throws X {
+ throw exceptionSupplier.get();
+ }
+
+ @Override
+ public T get() throws Throwable {
+ throw e;
+ }
+
+ @Override
+ public T getUnchecked() {
+ throw new RuntimeException(e);
+ }
+
+ @Override
+ public boolean isSuccess() {
+ return false;
+ }
+
+ @Override
+ public Try onSuccess(TryConsumer action) {
+ return this;
+ }
+
+ @Override
+ public Try filter(Predicate pred) {
+ return this;
+ }
+
+ @Override
+ public Optional toOptional() {
+ return Optional.empty();
+ }
+
+ @Override
+ public Try onFailure(TryConsumer action) throws E {
+ action.accept(e);
+ return this;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/aiyh/utils/httpUtil/HttpManager.java b/src/main/java/aiyh/utils/httpUtil/HttpManager.java
index d01fffc..41a7222 100644
--- a/src/main/java/aiyh/utils/httpUtil/HttpManager.java
+++ b/src/main/java/aiyh/utils/httpUtil/HttpManager.java
@@ -75,10 +75,11 @@ public class HttpManager {
return true;
}).build();
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
- sslsf = new SSLConnectionSocketFactory(sslContext,
- new String[]{"TLSv1"},
- null,
- hostnameVerifier);
+ sslsf = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
+ // sslsf = new SSLConnectionSocketFactory(sslContext,
+ // new String[]{"TLSv1"},
+ // null,
+ // hostnameVerifier);
} catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
throw new RuntimeException(e);
}
diff --git a/src/main/java/aiyh/utils/mapper/UtilMapper.java b/src/main/java/aiyh/utils/mapper/UtilMapper.java
index e9f3960..07170c3 100644
--- a/src/main/java/aiyh/utils/mapper/UtilMapper.java
+++ b/src/main/java/aiyh/utils/mapper/UtilMapper.java
@@ -2,6 +2,7 @@ package aiyh.utils.mapper;
import aiyh.utils.annotation.recordset.*;
import aiyh.utils.entity.DocImageInfo;
+import aiyh.utils.entity.FieldViewInfo;
import aiyh.utils.entity.SelectValueEntity;
import aiyh.utils.entity.WorkflowNodeConfig;
@@ -17,139 +18,158 @@ import java.util.Map;
@SqlMapper
public interface UtilMapper {
-
- /**
- * 查询日志级别是否开启Debug模式
- *
- * @return 是否开启Debug模式
- */
- @Select("select param_value from $t{configTableName} where only_mark = 'enableDebugLog'")
- public Boolean selectLogLevel(@ParamMapper("configTableName") String configTableName);
-
-
- /**
- * 根据唯一标识查询参数值
- *
- * @param onlyMark 唯一标识
- * @return 参数值
- */
- @Select("select param_value from $t{configTableName} where only_mark = #{onlyMark} and enable_param = 1")
- public String selectCusConfigParam(@ParamMapper("onlyMark") String onlyMark,
- @ParamMapper("configTableName") String cusConfigTableName);
-
-
- /**
- * 查询文件名
- *
- * @param imageFileId 查询文件名
- * @return 文件名
- */
- @Select("select imagefilename from imagefile where imagefileid = #{imageFileId}")
- String selectFileNameByImageFileId(@ParamMapper("imageFileId") int imageFileId);
-
- /**
- * 查询流程主表
- *
- * @param workflowId 流程id
- * @return 流程表名
- */
- @Select("select bill.tablename from workflow_bill bill join workflow_base base on base.formid = bill.id where base.id = #{workflowId}")
- String selectWorkfowMainTable(@ParamMapper("workflowId") String workflowId);
-
-
- @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid = #{docId}")
- DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
-
- @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
- List selectDocImageInfos(@ParamMapper("docIds") String docIds);
-
- @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in (${docIds})")
- List selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
-
-
- @Select("select id,workflow_type,mark_only,workflow_nodes,enable_nodes from uf_node_config where enable_nodes = 1 and workflow_type in ($t{allVersion}) and mark_only = #{markOnly}")
- WorkflowNodeConfig selectNodeConfig(@ParamMapper("allVersion") String allVersion, @ParamMapper("markOnly") String markOnly);
-
- /**
- * 查询下拉框值
- *
- * @param tableName 表明
- * @param fileName 字段名
- * @return 下拉框
- */
- @Select("select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, ws.selectname,ws.selectvalue " +
- "from workflow_billfield wbf left join workflow_bill wb on wbf.billid = wb.id " +
- "left join workflow_selectitem ws on ws.fieldid = wbf.id where wb.tablename = #{tableName} and fieldname = #{fileName}")
- List selectSelectFieldValue(@ParamMapper("tableName") String tableName, @ParamMapper("fileName") String fileName);
-
- @Select("select ws.selectname " +
- "from workflow_billfield wbf left join workflow_bill wb on wbf.billid = wb.id " +
- "left join workflow_selectitem ws on ws.fieldid = wbf.id where wb.tablename = #{tableName} and fieldname = #{fileName} and selectvalue = #{value}")
- String selectSelectFieldValueByValue(@ParamMapper("tableName") String tableName, @ParamMapper("fileName") String fileName,
- @ParamMapper("value") String value);
-
- /**
- * 查询文件信息
- *
- * @param imageFileId 查询文件名
- * @return 文件名
- */
- @Select("select * from imagefile where imagefileid = #{imageFileId}")
- Map selectFileInfoByImageFileId(@ParamMapper("imageFileId") int imageFileId);
-
- /**
- * 删除文件信息
- *
- * @param imageFileId 文件ID
- * @return 是否删除成功
- */
- @Delete("delete from imagefile where imagefileid = #{imageFileId}")
- boolean deleteImageFileInfo(@ParamMapper("imageFileId") Integer imageFileId);
-
- /**
- * 插入自定义配置数据
- *
- * @param onlyMark 唯一标识
- * @param value 参数值
- * @param desc 描述
- * @return 是否插入成功
- */
- @Update("update $t{configTableName} set only_mark = #{onlyMark},param_value = #{paramValue}, \n" +
- "param_desc = #{paramDesc} where id = #{id}")
- boolean updateConfigValueById(@ParamMapper("onlyMark") String onlyMark,
- @ParamMapper("paramValue") String value,
- @ParamMapper("paramDesc") String desc,
- @ParamMapper("id") String id,
- @ParamMapper("configTableName") String configTableName);
-
- /**
- * 修改自定义配置数据
- *
- * @param onlyMark 唯一标识
- * @param value 值
- * @param desc 描述
- * @return 是否更新成功
- */
- @Update("update $t{configTableName} set param_value = #{paramValue}, \n" +
- "param_desc = #{paramDesc} where only_mark = #{onlyMark}")
- boolean updateConfigValueByOnlyMark(@ParamMapper("onlyMark") String onlyMark,
- @ParamMapper("paramValue") String value,
- @ParamMapper("paramDesc") String desc,
- @ParamMapper("configTableName") String configTableName);
-
- /**
- * selectBillTableByFromId 根据fromId查询billTable表明
- * 2023/2/6 13:40
- * ************************************************************
- *
- * @param fromId fromId
- * @return String 表名
- * @author youHong.ai
- * ******************************************
- */
- @Select("select * from workflow_bill where id = #{fromId}")
- String selectBillTableByFromId(@ParamMapper("fromId") String fromId);
-
- @Delete("delete from $t{tableName} where id = #{dataId}")
- void deleteModeId(@ParamMapper("tableName") String tableName, @ParamMapper("dataId") Integer dataId);
+
+ /**
+ * 查询日志级别是否开启Debug模式
+ *
+ * @return 是否开启Debug模式
+ */
+ @Select("select param_value from $t{configTableName} where only_mark = 'enableDebugLog'")
+ Boolean selectLogLevel(@ParamMapper("configTableName") String configTableName);
+
+
+ /**
+ * 根据唯一标识查询参数值
+ *
+ * @param onlyMark 唯一标识
+ * @return 参数值
+ */
+ @Select("select param_value from $t{configTableName} where only_mark = #{onlyMark} and enable_param = 1")
+ String selectCusConfigParam(@ParamMapper("onlyMark") String onlyMark,
+ @ParamMapper("configTableName") String cusConfigTableName);
+
+
+ /**
+ * 查询文件名
+ *
+ * @param imageFileId 查询文件名
+ * @return 文件名
+ */
+ @Select("select imagefilename from imagefile where imagefileid = #{imageFileId}")
+ String selectFileNameByImageFileId(@ParamMapper("imageFileId") int imageFileId);
+
+ /**
+ * 查询流程主表
+ *
+ * @param workflowId 流程id
+ * @return 流程表名
+ */
+ @Select("select bill.tablename from workflow_bill bill join workflow_base base on base.formid = bill.id where base.id = #{workflowId}")
+ String selectWorkfowMainTable(@ParamMapper("workflowId") String workflowId);
+
+
+ @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid = #{docId}")
+ DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
+
+ @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
+ List selectDocImageInfos(@ParamMapper("docIds") String docIds);
+
+ @Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in (${docIds})")
+ List selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
+
+
+ @Select("select id,workflow_type,mark_only,workflow_nodes,enable_nodes from uf_node_config where enable_nodes = 1 and workflow_type in ($t{allVersion}) and mark_only = #{markOnly}")
+ WorkflowNodeConfig selectNodeConfig(@ParamMapper("allVersion") String allVersion, @ParamMapper("markOnly") String markOnly);
+
+ /**
+ * 查询下拉框值
+ *
+ * @param tableName 表明
+ * @param fileName 字段名
+ * @return 下拉框
+ */
+ @Select("select wbf.id,wbf.fieldname,wbf.fieldlabel,wb.tablename, ws.selectname,ws.selectvalue " +
+ "from workflow_billfield wbf left join workflow_bill wb on wbf.billid = wb.id " +
+ "left join workflow_selectitem ws on ws.fieldid = wbf.id where wb.tablename = #{tableName} and fieldname = #{fileName}")
+ List selectSelectFieldValue(@ParamMapper("tableName") String tableName, @ParamMapper("fileName") String fileName);
+
+ @Select("select ws.selectname " +
+ "from workflow_billfield wbf left join workflow_bill wb on wbf.billid = wb.id " +
+ "left join workflow_selectitem ws on ws.fieldid = wbf.id where wb.tablename = #{tableName} and fieldname = #{fileName} and selectvalue = #{value}")
+ String selectSelectFieldValueByValue(@ParamMapper("tableName") String tableName, @ParamMapper("fileName") String fileName,
+ @ParamMapper("value") String value);
+
+ /**
+ * 查询文件信息
+ *
+ * @param imageFileId 查询文件名
+ * @return 文件名
+ */
+ @Select("select * from imagefile where imagefileid = #{imageFileId}")
+ Map selectFileInfoByImageFileId(@ParamMapper("imageFileId") int imageFileId);
+
+ /**
+ * 删除文件信息
+ *
+ * @param imageFileId 文件ID
+ * @return 是否删除成功
+ */
+ @Delete("delete from imagefile where imagefileid = #{imageFileId}")
+ boolean deleteImageFileInfo(@ParamMapper("imageFileId") Integer imageFileId);
+
+ /**
+ * 插入自定义配置数据
+ *
+ * @param onlyMark 唯一标识
+ * @param value 参数值
+ * @param desc 描述
+ * @return 是否插入成功
+ */
+ @Update("update $t{configTableName} set only_mark = #{onlyMark},param_value = #{paramValue}, \n" +
+ "param_desc = #{paramDesc} where id = #{id}")
+ boolean updateConfigValueById(@ParamMapper("onlyMark") String onlyMark,
+ @ParamMapper("paramValue") String value,
+ @ParamMapper("paramDesc") String desc,
+ @ParamMapper("id") String id,
+ @ParamMapper("configTableName") String configTableName);
+
+ /**
+ * 修改自定义配置数据
+ *
+ * @param onlyMark 唯一标识
+ * @param value 值
+ * @param desc 描述
+ * @return 是否更新成功
+ */
+ @Update("update $t{configTableName} set param_value = #{paramValue}, \n" +
+ "param_desc = #{paramDesc} where only_mark = #{onlyMark}")
+ boolean updateConfigValueByOnlyMark(@ParamMapper("onlyMark") String onlyMark,
+ @ParamMapper("paramValue") String value,
+ @ParamMapper("paramDesc") String desc,
+ @ParamMapper("configTableName") String configTableName);
+
+ /**
+ * selectBillTableByFromId 根据fromId查询billTable表明
+ * 2023/2/6 13:40
+ * ************************************************************
+ *
+ * @param fromId fromId
+ * @return String 表名
+ * @author youHong.ai
+ * ******************************************
+ */
+ @Select("select * from workflow_bill where id = #{fromId}")
+ String selectBillTableByFromId(@ParamMapper("fromId") String fromId);
+
+ /**
+ * 删除指定表数据
+ *
+ * @param tableName 表名
+ * @param dataId 数据id
+ */
+ @Delete("delete from $t{tableName} where id = #{dataId}")
+ void deleteModeId(@ParamMapper("tableName") String tableName, @ParamMapper("dataId") Integer dataId);
+
+
+ /**
+ * 根据字段id查询字段信息
+ *
+ * @param id 字段id
+ * @return 字段信息
+ */
+ @Select("select id,fieldname field_name,tablename table_name,\n" +
+ " billid bill_id,fieldtype field_type,\n" +
+ " fieldhtmltype field_html_type\n" +
+ "from workflow_field_table_view where id = #{id}")
+ FieldViewInfo selectFieldInfo(Integer id);
}
diff --git a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
index 29145e3..55220f9 100644
--- a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
+++ b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
@@ -21,463 +21,478 @@ import java.util.List;
public class RecordsetUtil implements InvocationHandler {
-
-
- public static final String SQL_LOG = "sql_log";
- private final RsThreadLocalManager rsManager = new RsThreadLocalManager();
-
- private boolean autoCommit = true;
-
- public T getMapper(Class tClass) {
- return getMapper(tClass, true);
- }
-
- public T getMapper(Class tClass, boolean autoCommit) {
- if (tClass == null) {
- throw new BindingException("class is null!");
- }
- if (tClass.getAnnotation(SqlMapper.class) == null) {
- throw new BindingException("can not find SqlMapper annotation!");
- }
- this.autoCommit = autoCommit;
- return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, this);
- }
-
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- if (autoCommit) {
- return invokeRs(proxy, method, args);
- }
- return invokeRsTrans(proxy, method, args);
- }
-
-
- private Object invokeRs(Object proxy, Method method, Object[] args) {
- RecordSet rs = rsManager.getRs(method.getDeclaringClass().getName());
- if (rs == null) {
- rsManager.setRecordSet(method.getDeclaringClass().getName());
- rs = rsManager.getRs(method.getDeclaringClass().getName());
- }
- SqlHandler sqlHandler = new SqlHandler();
- ResultMapper resultMapper = new ResultMapper();
- Select select = method.getAnnotation(Select.class);
- if (select != null) {
- // 查询
- String sql = select.value();
- boolean custom = select.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
- throw new CustomerException("The sql statement does not match, the @Select annotation can only getDataId the select statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info("解析sql===>" + handler);
- if (handler.getArgs().isEmpty()) {
- rs.executeQuery(handler.getSqlStr());
- } else {
- rs.executeQuery(handler.getSqlStr(), handler.getArgs());
- }
- return resultMapper.mapperResult(rs, method, method.getReturnType());
- }
- Update update = method.getAnnotation(Update.class);
- if (update != null) {
- // 查询
- String sql = update.value();
- boolean custom = update.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
- throw new CustomerException("The sql statement does not match, the @Update annotation can only getDataId the update statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(int.class) || returnType.equals(Integer.class)) {
- if (b) {
- return 1;
- } else {
- return 0;
- }
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- Insert insert = method.getAnnotation(Insert.class);
- if (insert != null) {
- // 查询
- String sql = insert.value();
- boolean custom = insert.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
- throw new CustomerException("The sql statement does not match, the @Insert annotation can only getDataId the insert statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- Delete delete = method.getAnnotation(Delete.class);
- if (delete != null) {
- // 查询
- String sql = delete.value();
- boolean custom = delete.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
- throw new CustomerException("The sql statement does not match, the @Delete annotation can only getDataId the delete statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- boolean hasBatchInsert = method.isAnnotationPresent(BatchInsert.class);
- if (hasBatchInsert) {
- BatchInsert batchInsert = method.getAnnotation(BatchInsert.class);
- String sql = batchInsert.value();
- Class> returnType = method.getReturnType();
- boolean custom = batchInsert.custom();
- BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
- Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
- if (batchSqlResult.getBatchList().isEmpty()) {
- throw new CustomerException("getDataId batch sql error , batch sql args is empty!");
- }
- if (!batchSqlResult.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
- throw new CustomerException("The sql statement does not match, the @Insert annotation can only getDataId the insert statement, please check whether the sql statement matches!");
- }
- boolean b = rs.executeBatchSql(batchSqlResult.getSqlStr(), batchSqlResult.getBatchList());
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
-
- }
- boolean hasBatchUpdate = method.isAnnotationPresent(BatchUpdate.class);
- if (hasBatchUpdate) {
- BatchUpdate batchUpdate = method.getAnnotation(BatchUpdate.class);
- String sql = batchUpdate.value();
- Class> returnType = method.getReturnType();
- boolean custom = batchUpdate.custom();
- BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
- Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
- if (batchSqlResult.getBatchList().isEmpty()) {
- throw new CustomerException("getDataId batch sql error , batch sql args is empty!");
- }
- if (!batchSqlResult.getSqlStr().trim().toLowerCase().startsWith("update ")) {
- throw new CustomerException("The sql statement does not match, the @Update annotation can only getDataId the update statement, please check whether the sql statement matches!");
- }
- boolean b = rs.executeBatchSql(batchSqlResult.getSqlStr(), batchSqlResult.getBatchList());
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
-
- }
- boolean hasBatchDelete = method.isAnnotationPresent(BatchDelete.class);
- if (hasBatchDelete) {
- BatchDelete batchDelete = method.getAnnotation(BatchDelete.class);
- String sql = batchDelete.value();
- Class> returnType = method.getReturnType();
- boolean custom = batchDelete.custom();
- BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
- Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
- if (batchSqlResult.getBatchList().isEmpty()) {
- throw new CustomerException("getDataId batch sql error , batch sql args is empty!");
- }
- if (!batchSqlResult.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
- throw new CustomerException("The sql statement does not match, the @Delete annotation can only getDataId the delete statement, please check whether the sql statement matches!");
- }
- boolean b = rs.executeBatchSql(batchSqlResult.getSqlStr(), batchSqlResult.getBatchList());
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
-
- }
- throw new CustomerException("该方法没有添加注解!请检查是否正确添加注解!@Select、@Update、@Insert、@Delete、@BatchUpdate、@BatchInsert、@BatchDelete");
- }
-
- private Object invokeRsTrans(Object proxy, Method method, Object[] args) {
- RecordSetTrans rs = rsManager.getTrans(method.getDeclaringClass().getName());
- if (rs == null) {
- rsManager.setRecordSetTrans(method.getDeclaringClass().getName());
- rs = rsManager.getTrans(method.getDeclaringClass().getName());
- }
- SqlHandler sqlHandler = new SqlHandler();
- ResultMapper resultMapper = new ResultMapper();
- Select select = method.getAnnotation(Select.class);
- if (select != null) {
- // 查询
- String sql = select.value();
- boolean custom = select.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
- throw new CustomerException("The sql statement does not match, the @Select annotation can only getDataId the select statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info("解析sql===>" + handler);
- try {
- if (handler.getArgs().isEmpty()) {
- rs.executeQuery(handler.getSqlStr());
- } else {
- rs.executeQuery(handler.getSqlStr(), handler.getArgs());
- }
- } catch (Exception e) {
- Util.getLogger(SQL_LOG).error("execute sql error! " + Util.getErrString(e));
- throw new CustomerException("execute sql error!" + e.getMessage());
- }
- return resultMapper.mapperResult(rs, method, method.getReturnType());
- }
-
- Update update = method.getAnnotation(Update.class);
- if (update != null) {
- // 查询
- String sql = update.value();
- boolean custom = update.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
- throw new CustomerException("The sql statement does not match, the @Update annotation can only getDataId the update statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- try {
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- } catch (Exception e) {
- Util.getLogger(SQL_LOG).error("execute sql error! " + Util.getErrString(e));
- throw new CustomerException("execute sql error!" + e.getMessage());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(int.class) || returnType.equals(Integer.class)) {
- if (b) {
- return 1;
- } else {
- return 0;
- }
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- Insert insert = method.getAnnotation(Insert.class);
- if (insert != null) {
- // 查询
- String sql = insert.value();
- boolean custom = insert.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
- throw new CustomerException("The sql statement does not match, the @Insert annotation can only getDataId the insert statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- try {
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- } catch (Exception e) {
- Util.getLogger(SQL_LOG).error("execute sql error! " + Util.getErrString(e));
- throw new CustomerException("execute sql error!" + e.getMessage());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- Delete delete = method.getAnnotation(Delete.class);
- if (delete != null) {
- // 查询
- String sql = delete.value();
- boolean custom = delete.custom();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
- if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
- throw new CustomerException("The sql statement does not match, the @Delete annotation can only getDataId the delete statement, please check whether the sql statement matches!");
- }
- Util.getLogger(SQL_LOG).info(handler.toString());
- Class> returnType = method.getReturnType();
- boolean b;
- try {
- if (handler.getArgs().isEmpty()) {
- b = rs.executeUpdate(handler.getSqlStr());
- } else {
- b = rs.executeUpdate(handler.getSqlStr(), handler.getArgs());
- }
- } catch (Exception e) {
- Util.getLogger(SQL_LOG).error("execute sql error! " + Util.getErrString(e));
- throw new CustomerException("execute sql error!" + e.getMessage());
- }
- if (returnType.equals(void.class)) {
- return null;
- }
- if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
- return b;
- }
- }
- boolean hasBatchInsert = method.isAnnotationPresent(BatchInsert.class);
- if (hasBatchInsert) {
- BatchInsert batchInsert = method.getAnnotation(BatchInsert.class);
- String sql = batchInsert.value();
- Class> returnType = method.getReturnType();
- boolean custom = batchInsert.custom();
- BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
- Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
- List batchList = batchSqlResult.getBatchList();
- if (batchList.isEmpty()) {
- throw new CustomerException("getDataId batch sql error , batch sql args is empty!");
- }
- List> batchListTrans = new ArrayList<>();
- for (List list : batchList) {
- List