bind命令、choose命令以及其他东西
parent
8b16f9ca57
commit
0d252c6452
|
@ -46,4 +46,5 @@ src/test/resources/font
|
||||||
src/main/resources/WEB-INF/vm/outFile
|
src/main/resources/WEB-INF/vm/outFile
|
||||||
target/
|
target/
|
||||||
*.back
|
*.back
|
||||||
|
src/main/old_src/
|
||||||
|
|
||||||
|
|
|
@ -563,9 +563,11 @@ $(() => {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
complete: (res) => {
|
complete: (res) => {
|
||||||
if (res && res.code === 200) {
|
res.then(r => {
|
||||||
callback();
|
if (r && r.code === 200) {
|
||||||
}
|
callback();
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
6
pom.xml
6
pom.xml
|
@ -56,6 +56,12 @@
|
||||||
<version>${lombok.version}</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 图片efi信息,识别ps,贵酒-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.drewnoakes</groupId>
|
||||||
|
<artifactId>metadata-extractor</artifactId>
|
||||||
|
<version>${metadata-extractor.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- 单元测试-->
|
<!-- 单元测试-->
|
||||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1>流程建模字段信息</h1>
|
||||||
*
|
*
|
||||||
* <p>create: 2023/2/20 11:01</p>
|
* <p>create: 2023/2/20 11:01</p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package aiyh.utils.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>建模表信息</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/14 17:05</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class ModelTableInfo {
|
||||||
|
/** id */
|
||||||
|
@SqlOracleDbFieldAnn("ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SqlOracleDbFieldAnn("INDEX_DESC")
|
||||||
|
private String indexDesc;
|
||||||
|
/** 字段表名 */
|
||||||
|
@SqlOracleDbFieldAnn("TABLE_NAME")
|
||||||
|
private String tableName;
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package aiyh.utils.entity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p></p>
|
* <p>下拉框字段信息</p>
|
||||||
* <p>create 2022/6/10 21:21</p>
|
* <p>create 2022/6/10 21:21</p>
|
||||||
*
|
*
|
||||||
* @author ayh
|
* @author ayh
|
||||||
|
@ -11,10 +11,10 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SelectValueEntity {
|
public class SelectValueEntity {
|
||||||
private String id;
|
private String id;
|
||||||
private String fieldname;
|
private String fieldname;
|
||||||
private String fieldlabel;
|
private String fieldlabel;
|
||||||
private String tablename;
|
private String tablename;
|
||||||
private String selectname;
|
private String selectname;
|
||||||
private Integer selectvalue;
|
private Integer selectvalue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,10 @@ public class HttpUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCredentialsProvider(CredentialsProvider credentialsProvider) {
|
||||||
|
this.credentialsProvider = credentialsProvider;
|
||||||
|
}
|
||||||
|
|
||||||
public HttpUtils(CredentialsProvider credentialsProvider) {
|
public HttpUtils(CredentialsProvider credentialsProvider) {
|
||||||
this.credentialsProvider = credentialsProvider;
|
this.credentialsProvider = credentialsProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package aiyh.utils.mapper;
|
package aiyh.utils.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
import aiyh.utils.entity.DocImageInfo;
|
import aiyh.utils.entity.*;
|
||||||
import aiyh.utils.entity.FieldViewInfo;
|
|
||||||
import aiyh.utils.entity.SelectValueEntity;
|
|
||||||
import aiyh.utils.entity.WorkflowNodeConfig;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -190,4 +187,14 @@ public interface UtilMapper {
|
||||||
" fieldhtmltype field_html_type\n" +
|
" fieldhtmltype field_html_type\n" +
|
||||||
"from workflow_field_table_view where id = #{id}")
|
"from workflow_field_table_view where id = #{id}")
|
||||||
FieldViewInfo selectFieldInfo(Integer id);
|
FieldViewInfo selectFieldInfo(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询建模表表信息</h2>
|
||||||
|
*
|
||||||
|
* @param id id
|
||||||
|
* @return 建模表信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Select("select id, tablename table_name, indexdesc index_desc from mode_bill_info_view where id = #{id}")
|
||||||
|
ModelTableInfo selectModelTableInfo(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package aiyh.utils.recordset;
|
||||||
|
|
||||||
|
import com.alibaba.druid.sql.SQLUtils;
|
||||||
|
import com.alibaba.druid.sql.parser.ParserException;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>格式化sql字符串</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/5 11:45</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class FormatSqlUtil {
|
||||||
|
private static String dbType = null;
|
||||||
|
private static RecordSet recordSet = null;
|
||||||
|
|
||||||
|
public static String formatSql(String sql) {
|
||||||
|
|
||||||
|
if (Objects.isNull(FormatSqlUtil.dbType)) {
|
||||||
|
if (recordSet == null) {
|
||||||
|
recordSet = new RecordSet();
|
||||||
|
}
|
||||||
|
FormatSqlUtil.dbType = recordSet.getDBType();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return SQLUtils.format(sql, dbType);
|
||||||
|
} catch (ParserException e) {
|
||||||
|
return toSqlString(sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String toSqlString(String sql) {
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
}
|
|
@ -64,12 +64,13 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
SqlHandler sqlHandler = new SqlHandler();
|
SqlHandler sqlHandler = new SqlHandler();
|
||||||
ResultMapper resultMapper = new ResultMapper();
|
ResultMapper resultMapper = new ResultMapper();
|
||||||
PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
|
PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
|
||||||
|
String invokeMethod = method.getDeclaringClass().getName() + ":" + method.getName() + " : ";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: {
|
case 1: {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Select annotation can only execute the select statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Select annotation can only execute the select statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info("解析sql===>" + handler);
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
if (handler.getArgs().isEmpty()) {
|
if (handler.getArgs().isEmpty()) {
|
||||||
rs.executeQuery(handler.getSqlStr());
|
rs.executeQuery(handler.getSqlStr());
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,7 +82,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Update annotation can only execute the update statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Update annotation can only execute the update statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
if (handler.getArgs().isEmpty()) {
|
if (handler.getArgs().isEmpty()) {
|
||||||
|
@ -107,7 +108,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Insert annotation can only execute the insert statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Insert annotation can only execute the insert statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
if (handler.getArgs().isEmpty()) {
|
if (handler.getArgs().isEmpty()) {
|
||||||
|
@ -126,7 +127,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Delete annotation can only execute the delete statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Delete annotation can only execute the delete statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
if (handler.getArgs().isEmpty()) {
|
if (handler.getArgs().isEmpty()) {
|
||||||
|
@ -144,7 +145,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
case 5: {
|
case 5: {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
if (batchSqlResult.getBatchList().isEmpty()) {
|
if (batchSqlResult.getBatchList().isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
}
|
}
|
||||||
|
@ -162,7 +163,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
case 6: {
|
case 6: {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
if (batchSqlResult.getBatchList().isEmpty()) {
|
if (batchSqlResult.getBatchList().isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
}
|
}
|
||||||
|
@ -180,7 +181,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
case 7: {
|
case 7: {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
if (batchSqlResult.getBatchList().isEmpty()) {
|
if (batchSqlResult.getBatchList().isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
}
|
}
|
||||||
|
@ -304,6 +305,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
|
|
||||||
private Object invokeRsTrans(Object proxy, Method method, Object[] args, String name) {
|
private Object invokeRsTrans(Object proxy, Method method, Object[] args, String name) {
|
||||||
String mapperKey = method.getDeclaringClass().getName();
|
String mapperKey = method.getDeclaringClass().getName();
|
||||||
|
String invokeMethod = method.getDeclaringClass().getName() + ":" + method.getName() + " : ";
|
||||||
if (!"".equals(name) && null != name) {
|
if (!"".equals(name) && null != name) {
|
||||||
mapperKey += "." + name;
|
mapperKey += "." + name;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +325,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("select ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Select annotation can only execute the select statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Select annotation can only execute the select statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info("解析sql===>" + handler);
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
try {
|
try {
|
||||||
if (handler.getArgs().isEmpty()) {
|
if (handler.getArgs().isEmpty()) {
|
||||||
rs.executeQuery(handler.getSqlStr());
|
rs.executeQuery(handler.getSqlStr());
|
||||||
|
@ -346,7 +348,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("update ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Update annotation can only execute the update statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Update annotation can only execute the update statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
try {
|
try {
|
||||||
|
@ -382,7 +384,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("insert ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Insert annotation can only execute the insert statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Insert annotation can only execute the insert statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
try {
|
try {
|
||||||
|
@ -411,7 +413,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
|
if (!handler.getSqlStr().trim().toLowerCase().startsWith("delete ")) {
|
||||||
throw new CustomerException("The sql statement does not match, the @Delete annotation can only execute the delete statement, please check whether the sql statement matches!");
|
throw new CustomerException("The sql statement does not match, the @Delete annotation can only execute the delete statement, please check whether the sql statement matches!");
|
||||||
}
|
}
|
||||||
Util.getLogger(SQL_LOG).info(handler.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + handler);
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean b;
|
boolean b;
|
||||||
try {
|
try {
|
||||||
|
@ -438,7 +440,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean custom = batchInsert.custom();
|
boolean custom = batchInsert.custom();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
List<List> batchList = batchSqlResult.getBatchList();
|
List<List> batchList = batchSqlResult.getBatchList();
|
||||||
if (batchList.isEmpty()) {
|
if (batchList.isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
|
@ -477,7 +479,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean custom = batchUpdate.custom();
|
boolean custom = batchUpdate.custom();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
if (batchSqlResult.getBatchList().isEmpty()) {
|
if (batchSqlResult.getBatchList().isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
}
|
}
|
||||||
|
@ -518,7 +520,7 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
boolean custom = batchDelete.custom();
|
boolean custom = batchDelete.custom();
|
||||||
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
BatchSqlResultImpl batchSqlResult = sqlHandler.handlerBatch(sql, custom, method, args);
|
||||||
Util.getLogger(SQL_LOG).info(batchSqlResult.toString());
|
Util.getLogger(SQL_LOG).info(invokeMethod + batchSqlResult.toString());
|
||||||
if (batchSqlResult.getBatchList().isEmpty()) {
|
if (batchSqlResult.getBatchList().isEmpty()) {
|
||||||
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
throw new CustomerException("execute batch sql error , batch sql args is empty!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package aiyh.utils.sqlUtil.sqlResult.impl;
|
package aiyh.utils.sqlUtil.sqlResult.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.recordset.FormatSqlUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,27 +12,27 @@ import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class BatchSqlResultImpl implements aiyh.utils.sqlUtil.sqlResult.SqlResult {
|
public class BatchSqlResultImpl implements aiyh.utils.sqlUtil.sqlResult.SqlResult {
|
||||||
private final String sqlStr;
|
private final String sqlStr;
|
||||||
private final List<List> batchList;
|
private final List<List> batchList;
|
||||||
|
|
||||||
public BatchSqlResultImpl(String sqlStr, List<List> batchList) {
|
public BatchSqlResultImpl(String sqlStr, List<List> batchList) {
|
||||||
this.sqlStr = sqlStr;
|
this.sqlStr = sqlStr;
|
||||||
this.batchList = batchList;
|
this.batchList = batchList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSqlStr() {
|
public String getSqlStr() {
|
||||||
return sqlStr;
|
return sqlStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List> getBatchList() {
|
public List<List> getBatchList() {
|
||||||
return batchList;
|
return batchList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BatchSqlResultImpl{" +
|
return "BatchSqlResultImpl{" +
|
||||||
"sqlStr='" + sqlStr + '\'' +
|
"sqlStr='\n" + FormatSqlUtil.formatSql(sqlStr) + "\n'" +
|
||||||
", batchList=" + batchList +
|
", batchList=" + batchList +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package aiyh.utils.sqlUtil.sqlResult.impl;
|
package aiyh.utils.sqlUtil.sqlResult.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.recordset.FormatSqlUtil;
|
||||||
import aiyh.utils.sqlUtil.sqlResult.SqlResult;
|
import aiyh.utils.sqlUtil.sqlResult.SqlResult;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,25 +15,25 @@ import java.util.List;
|
||||||
public class PrepSqlResultImpl implements SqlResult {
|
public class PrepSqlResultImpl implements SqlResult {
|
||||||
private final String sqlStr;
|
private final String sqlStr;
|
||||||
private final List<Object> args;
|
private final List<Object> args;
|
||||||
|
|
||||||
public PrepSqlResultImpl(String sqlStr, List<Object> args) {
|
public PrepSqlResultImpl(String sqlStr, List<Object> args) {
|
||||||
this.sqlStr = sqlStr;
|
this.sqlStr = sqlStr;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSqlStr() {
|
public String getSqlStr() {
|
||||||
return sqlStr;
|
return sqlStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getArgs() {
|
public List<Object> getArgs() {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PrepSqlResultImpl{" +
|
return "PrepSqlResultImpl{" +
|
||||||
"sqlStr='" + sqlStr + '\'' +
|
"sqlStr='\n" + FormatSqlUtil.formatSql(sqlStr) + "\n'" +
|
||||||
", args=" + args +
|
", args=" + args +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package weaver.youhong.ai.yihong.formmode.stagediagram;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.service.ModeExpandSaveService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>保存自定义处理方法</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-02-06 12:57</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ModeExpandQuanJinSaveAction extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
Map<String, String> result = new HashMap<>(8);
|
||||||
|
ModeExpandSaveService service = new ModeExpandSaveService();
|
||||||
|
try {
|
||||||
|
log.info("自定义接口保存动作参数: " + JSON.toJSONString(param));
|
||||||
|
service.updateStageDiagramView(param,
|
||||||
|
"STAGE_DIAGRAM_AMOUNT_TABLE_QJ", "STAGE_DIAGRAM_PROJECT_ID_FIELD_QJ",
|
||||||
|
"STAGE_DIAGRAM_AMOUNT_FIELD_QJ", "MAPPING_CONFIG_MARK_QJ");
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("errmsg", e.getMessage());
|
||||||
|
result.put("flag", "false");
|
||||||
|
log.error("建模自定义保存接口错误:" + e.getMessage() + Util.getErrString(e));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,23 +18,23 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ModeExpandSaveAction extends AbstractModeExpandJavaCodeNew {
|
public class ModeExpandSaveAction extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
private final Logger log = Util.getLogger();
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
Map<String, String> result = new HashMap<>(8);
|
Map<String, String> result = new HashMap<>(8);
|
||||||
ModeExpandSaveService service = new ModeExpandSaveService();
|
ModeExpandSaveService service = new ModeExpandSaveService();
|
||||||
try {
|
try {
|
||||||
log.info("自定义接口保存动作参数: " + JSON.toJSONString(param));
|
log.info("自定义接口保存动作参数: " + JSON.toJSONString(param));
|
||||||
service.updateStageDiagramView(param,
|
service.updateStageDiagramView(param,
|
||||||
"STAGE_DIAGRAM_AMOUNT_TABLE", "STAGE_DIAGRAM_PROJECT_ID_FIELD",
|
"STAGE_DIAGRAM_AMOUNT_TABLE", "STAGE_DIAGRAM_PROJECT_ID_FIELD",
|
||||||
"STAGE_DIAGRAM_AMOUNT_FIELD");
|
"STAGE_DIAGRAM_AMOUNT_FIELD", "MAPPING_CONFIG_MARK");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.put("errmsg", e.getMessage());
|
result.put("errmsg", e.getMessage());
|
||||||
result.put("flag", "false");
|
result.put("flag", "false");
|
||||||
log.error("建模自定义保存接口错误:" + e.getMessage() + Util.getErrString(e));
|
log.error("建模自定义保存接口错误:" + e.getMessage() + Util.getErrString(e));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package weaver.youhong.ai.yihong.formmode.stagediagram.mapper;
|
package weaver.youhong.ai.yihong.formmode.stagediagram.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.ParamMapper;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
import aiyh.utils.annotation.recordset.Select;
|
|
||||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
|
||||||
import aiyh.utils.annotation.recordset.Update;
|
|
||||||
import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo;
|
import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.pojo.StageUpdateFieldConfig;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.pojo.StageUpdateFieldItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,46 +18,117 @@ import java.util.Map;
|
||||||
|
|
||||||
@SqlMapper
|
@SqlMapper
|
||||||
public interface ModeExpandSaveActionMapper {
|
public interface ModeExpandSaveActionMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询台账信息</h2>
|
* <h2>查询台账信息</h2>
|
||||||
*
|
*
|
||||||
* @param projectId 项目id
|
* @param projectId 项目id
|
||||||
* @return 项目台账信息
|
* @return 项目台账信息
|
||||||
*/
|
*/
|
||||||
@Select("select * from uf_stage_node_info where project_id = #{projectId}")
|
@Select("select * from uf_stage_node_info where project_id = #{projectId}")
|
||||||
StageNodeInfo selectStageNodeInfoByProjectId(@ParamMapper("projectId") String projectId);
|
StageNodeInfo selectStageNodeInfoByProjectId(@ParamMapper("projectId") String projectId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>根据唯一标识查询配置表主表ID </h2>
|
* <h2>根据唯一标识查询配置表主表ID </h2>
|
||||||
*
|
*
|
||||||
* @param onlyMark 唯一标识
|
* @param onlyMark 唯一标识
|
||||||
* @return 主表id
|
* @return 主表id
|
||||||
*/
|
*/
|
||||||
@Select("select id from uf_yh_stage_diagram where only_mark = #{onlyMark}")
|
@Select("select id from uf_yh_stage_diagram where only_mark = #{onlyMark}")
|
||||||
Integer selectConfigMainId(@ParamMapper("onlyMark") String onlyMark);
|
Integer selectConfigMainId(@ParamMapper("onlyMark") String onlyMark);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询配置表明细表信息</h2>
|
* <h2>查询配置表明细表信息</h2>
|
||||||
*
|
*
|
||||||
* @param formId 表单id
|
* @param formId 表单id
|
||||||
* @return 明细id
|
* @return 明细id
|
||||||
*/
|
*/
|
||||||
// @Select("select * from uf_yh_stage_diagram_dt1 where mainid = #{mainId} and model_table = #{formId]")
|
@Select("select * from uf_yh_stage_diagram_dt1 where model_table = #{formId}")
|
||||||
// Map<String, Object> selectDetailConfig(@ParamMapper("mainId") Integer mainId, @ParamMapper("formId") String formId);
|
Map<String, Object> selectDetailConfig(@ParamMapper("formId") String formId);
|
||||||
@Select("select * from uf_yh_stage_diagram_dt1 where model_table = #{formId}")
|
|
||||||
Map<String, Object> selectDetailConfig(@ParamMapper("formId") String formId);
|
/**
|
||||||
|
* <h2>查询金额</h2>
|
||||||
@Select("select $t{amountField} from $t{amountTable} where $t{projectIdField} = #{projectId}")
|
*
|
||||||
String selectAmountByProjectId(@ParamMapper("projectId") String projectId,
|
* @param projectId 项目ID
|
||||||
@ParamMapper("projectIdField") String projectIdField,
|
* @param projectIdField 项目id字段
|
||||||
@ParamMapper("amountTable") String amountTable,
|
* @param amountTable 金额表
|
||||||
@ParamMapper("amountField") String amountField);
|
* @param amountField 金额字段
|
||||||
|
* @return 金额
|
||||||
@Update("update uf_stage_node_info set project_id = #{projectId}, amount = #{amount}, " +
|
*/
|
||||||
"current_node = #{nodeName} where id = #{dataId}")
|
@Select("select $t{amountField} from $t{amountTable} where $t{projectIdField} = #{projectId}")
|
||||||
boolean updateStageNodeInfo(@ParamMapper("dataId") Integer dataId,
|
String selectAmountByProjectId(@ParamMapper("projectId") String projectId,
|
||||||
@ParamMapper("projectId") String projectId,
|
@ParamMapper("projectIdField") String projectIdField,
|
||||||
@ParamMapper("nodeName") String nodeName,
|
@ParamMapper("amountTable") String amountTable,
|
||||||
@ParamMapper("amount") String amount);
|
@ParamMapper("amountField") String amountField);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新阶段信息</h2>
|
||||||
|
*
|
||||||
|
* @param dataId 数据ID
|
||||||
|
* @param projectId 项目id
|
||||||
|
* @param nodeName 节点信息
|
||||||
|
* @param amount 钱
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Update("update uf_stage_node_info set project_id = #{projectId}, amount = #{amount}, " +
|
||||||
|
"current_node = #{nodeName} where id = #{dataId}")
|
||||||
|
boolean updateStageNodeInfo(@ParamMapper("dataId") Integer dataId,
|
||||||
|
@ParamMapper("projectId") String projectId,
|
||||||
|
@ParamMapper("nodeName") String nodeName,
|
||||||
|
@ParamMapper("amount") String amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询信息</h2>
|
||||||
|
*
|
||||||
|
* @param onlyMark 唯一标识
|
||||||
|
* @return 查询配置结果
|
||||||
|
*/
|
||||||
|
@Select("select * from uf_yh_stage_diagram where only_mark = #{onlyMark}")
|
||||||
|
@Associations({
|
||||||
|
@Association(property = "baseTable",
|
||||||
|
column = "base_table",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectModelTableInfo",
|
||||||
|
id = @Id(Integer.class))
|
||||||
|
})
|
||||||
|
@CollectionMappings({
|
||||||
|
@CollectionMapping(property = "mappings",
|
||||||
|
column = "id",
|
||||||
|
id = @Id(value = Integer.class, methodId = 1))
|
||||||
|
})
|
||||||
|
StageUpdateFieldConfig selectConfigUpdate(@ParamMapper("onlyMark") String onlyMark);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询配置表明细数据</h2>
|
||||||
|
*
|
||||||
|
* @param mainId 主表id
|
||||||
|
* @return 明细数据
|
||||||
|
*/
|
||||||
|
@CollectionMethod(1)
|
||||||
|
@Select("select * from uf_yh_stage_diagram_dt2 where mainid = #{mainId}")
|
||||||
|
@Associations({
|
||||||
|
@Association(property = "baseTableFiled",
|
||||||
|
column = "base_table_filed",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
|
||||||
|
id = @Id(Integer.class))
|
||||||
|
})
|
||||||
|
List<StageUpdateFieldItem> selectConfigItem(Integer mainId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询自定义sql</h2>
|
||||||
|
*
|
||||||
|
* @param sql 自定义sql
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@Select(custom = true)
|
||||||
|
Map<String, Object> selectCustomerSql(@SqlString String sql);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新自定义信息</h2>
|
||||||
|
*
|
||||||
|
* @param sqlString sqlString
|
||||||
|
* @param projectInfo 项目信息
|
||||||
|
*/
|
||||||
|
@Update(custom = true)
|
||||||
|
void updateCustomerSql(@SqlString String sqlString, Map<String, Object> projectInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package weaver.youhong.ai.yihong.formmode.stagediagram.pojo;
|
||||||
|
|
||||||
|
import aiyh.utils.entity.ModelTableInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/14 17:02</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class StageUpdateFieldConfig {
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 唯一标识 */
|
||||||
|
private String onlyMark;
|
||||||
|
|
||||||
|
/** 建模表信息 */
|
||||||
|
private ModelTableInfo baseTable;
|
||||||
|
|
||||||
|
/** 配置表明细映射 */
|
||||||
|
private List<StageUpdateFieldItem> mappings;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package weaver.youhong.ai.yihong.formmode.stagediagram.pojo;
|
||||||
|
|
||||||
|
import aiyh.utils.entity.FieldViewInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/14 17:09</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class StageUpdateFieldItem {
|
||||||
|
|
||||||
|
/** id */
|
||||||
|
private Integer id;
|
||||||
|
/** 项目基本信息表字段 */
|
||||||
|
private FieldViewInfo baseTableFiled;
|
||||||
|
|
||||||
|
/** 台账字段 */
|
||||||
|
private String targetField;
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package weaver.youhong.ai.yihong.formmode.stagediagram.service;
|
package weaver.youhong.ai.yihong.formmode.stagediagram.service;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import cn.hutool.core.lang.Assert;
|
import aiyh.utils.tool.cn.hutool.core.lang.Assert;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -9,11 +9,10 @@ import weaver.soa.workflow.request.Property;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo;
|
import weaver.youhong.ai.yihong.formmode.stagediagram.dto.StageNodeInfo;
|
||||||
import weaver.youhong.ai.yihong.formmode.stagediagram.mapper.ModeExpandSaveActionMapper;
|
import weaver.youhong.ai.yihong.formmode.stagediagram.mapper.ModeExpandSaveActionMapper;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.pojo.StageUpdateFieldConfig;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.pojo.StageUpdateFieldItem;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>保存自定义处理方法service</h1>
|
* <h1>保存自定义处理方法service</h1>
|
||||||
|
@ -24,86 +23,123 @@ import java.util.Objects;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ModeExpandSaveService {
|
public class ModeExpandSaveService {
|
||||||
|
|
||||||
private final Logger log = Util.getLogger();
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
private final ModeExpandSaveActionMapper mapper = Util.getMapper(ModeExpandSaveActionMapper.class);
|
private final ModeExpandSaveActionMapper mapper = Util.getMapper(ModeExpandSaveActionMapper.class);
|
||||||
|
|
||||||
public void updateStageDiagramView(Map<String, Object> param,
|
public void updateStageDiagramView(Map<String, Object> param,
|
||||||
String amountTable,
|
String amountTable,
|
||||||
String projectIdField,
|
String projectIdField,
|
||||||
String amountField) {
|
String amountField,
|
||||||
/* ******************* 查询当前节点对应的projectId ******************* */
|
String mappingConfigMark) {
|
||||||
String formId = Util.null2String(param.get("formId"));
|
/* ******************* 查询当前节点对应的projectId ******************* */
|
||||||
Map<String, Object> currentNodeConfig = mapper.selectDetailConfig(formId);
|
String formId = Util.null2String(param.get("formId"));
|
||||||
// String stageDiagramProjectFieldName = Util.getCusConfigValue(projectFieldMark);
|
Map<String, Object> currentNodeConfig = mapper.selectDetailConfig(formId);
|
||||||
String stageDiagramProjectFieldName = Util.null2String(currentNodeConfig.get("projectFieldName"));
|
String stageDiagramProjectFieldName = Util.null2String(currentNodeConfig.get("projectFieldName"));
|
||||||
Assert.notBlank(stageDiagramProjectFieldName, "cna not find projectFieldMark from uf_cus_dev_config! the config can not be null!");
|
Assert.notBlank(stageDiagramProjectFieldName, "cna not find projectFieldMark from uf_cus_dev_config! the config can not be null!");
|
||||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
Map<String, String> mainTableValue = getMainTableValue(requestInfo);
|
Map<String, String> mainTableValue = getMainTableValue(requestInfo);
|
||||||
String projectId = mainTableValue.get(stageDiagramProjectFieldName);
|
String projectId = mainTableValue.get(stageDiagramProjectFieldName);
|
||||||
log.info("主表数据:" + JSON.toJSONString(mainTableValue));
|
log.info("主表数据:" + JSON.toJSONString(mainTableValue));
|
||||||
// 获取当前模块id
|
// 获取当前模块id
|
||||||
/* ******************* 查询台账中对应的project是否存在, 台账中不存在则插入,存在则更新 ******************* */
|
/* ******************* 查询台账中对应的project是否存在, 台账中不存在则插入,存在则更新 ******************* */
|
||||||
StageNodeInfo nodeInfo = mapper.selectStageNodeInfoByProjectId(projectId);
|
StageNodeInfo nodeInfo = mapper.selectStageNodeInfoByProjectId(projectId);
|
||||||
log.info("查询到的nodeINFo数据:" + JSON.toJSONString(nodeInfo));
|
log.info("查询到的nodeInFo数据:" + JSON.toJSONString(nodeInfo));
|
||||||
if (Objects.isNull(nodeInfo)) {
|
if (Objects.isNull(nodeInfo)) {
|
||||||
// 不存在项目信息在台账中插入项目信息到台账信息中
|
// 不存在项目信息在台账中插入项目信息到台账信息中
|
||||||
Integer dataId = Util.getModeDataId("uf_stage_node_info", 1);
|
Integer dataId = Util.getModeDataId("uf_stage_node_info", 1);
|
||||||
// 查询配置表信息
|
// 查询配置表信息
|
||||||
// Integer mainId = mapper.selectConfigMainId(Util.getCusConfigValue(onlyMarkCusMark));
|
String nodeName = (String) currentNodeConfig.get("nodeName");
|
||||||
// Map<String, Object> currentNodeConfig = mapper.selectDetailConfig(mainId, formId);
|
log.info("节点名称: " + nodeName);
|
||||||
String nodeName = (String) currentNodeConfig.get("nodeName");
|
String amount = mapper.selectAmountByProjectId(projectId,
|
||||||
log.info("节点名称: " + nodeName);
|
Util.getCusConfigValueNullOrEmpty(projectIdField, ""),
|
||||||
String amount = mapper.selectAmountByProjectId(projectId,
|
Util.getCusConfigValueNullOrEmpty(amountTable, ""),
|
||||||
Util.getCusConfigValueNullOrEmpty(projectIdField, ""),
|
Util.getCusConfigValueNullOrEmpty(amountField, ""));
|
||||||
Util.getCusConfigValueNullOrEmpty(amountTable, ""),
|
|
||||||
Util.getCusConfigValueNullOrEmpty(amountField, ""));
|
boolean update = mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount);
|
||||||
|
if (!update) {
|
||||||
boolean update = mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount);
|
Util.deleteModeId("uf_stage_node_info", dataId);
|
||||||
if (!update) {
|
} else {
|
||||||
Util.deleteModeId("uf_stage_node_info", dataId);
|
Util.rebuildModeDataShare(1, Integer.parseInt(Util.getModeIdByTableName("uf_stage_node_info")),
|
||||||
} else {
|
dataId);
|
||||||
Util.rebuildModeDataShare(1, Integer.parseInt(Util.getModeIdByTableName("uf_stage_node_info")),
|
}
|
||||||
dataId);
|
} else {
|
||||||
}
|
// 存在,更新当前项目的节点信息
|
||||||
} else {
|
Integer dataId = nodeInfo.getId();
|
||||||
// 存在,更新当前项目的节点信息
|
String nodeName = (String) currentNodeConfig.get("nodeName");
|
||||||
Integer dataId = nodeInfo.getId();
|
String amount = mapper.selectAmountByProjectId(projectId,
|
||||||
// Integer mainId = mapper.selectConfigMainId(Util.getCusConfigValue(onlyMarkCusMark));
|
Util.getCusConfigValueNullOrEmpty(projectIdField, ""),
|
||||||
// Map<String, Object> currentNodeConfig = mapper.selectDetailConfig(mainId, formId);
|
Util.getCusConfigValueNullOrEmpty(amountTable, ""),
|
||||||
String nodeName = (String) currentNodeConfig.get("nodeName");
|
Util.getCusConfigValueNullOrEmpty(amountField, ""));
|
||||||
String amount = mapper.selectAmountByProjectId(projectId,
|
mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount);
|
||||||
Util.getCusConfigValueNullOrEmpty(projectIdField, ""),
|
}
|
||||||
Util.getCusConfigValueNullOrEmpty(amountTable, ""),
|
/* ******************* 更新其他字段 ******************* */
|
||||||
Util.getCusConfigValueNullOrEmpty(amountField, ""));
|
String onlyMark = Util.getCusConfigValue(mappingConfigMark);
|
||||||
mapper.updateStageNodeInfo(dataId, projectId, nodeName, amount);
|
StageUpdateFieldConfig stageUpdateFieldConfig = mapper.selectConfigUpdate(onlyMark);
|
||||||
}
|
if (stageUpdateFieldConfig == null) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
List<StageUpdateFieldItem> mappings = stageUpdateFieldConfig.getMappings();
|
||||||
/**
|
if (mappings == null || mappings.isEmpty()) {
|
||||||
* <h2>获取流程主表数据</h2>
|
return;
|
||||||
*
|
}
|
||||||
* @return 流程主表数据
|
StringBuilder selectSql = new StringBuilder();
|
||||||
*/
|
selectSql.append("select ");
|
||||||
protected Map<String, String> getMainTableValue(RequestInfo requestInfo) {
|
StringBuilder update = new StringBuilder();
|
||||||
// 获取主表数据
|
update.append("update uf_stage_node_info set ");
|
||||||
Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
|
|
||||||
return getStringMap(propertyArr);
|
for (StageUpdateFieldItem item : mappings) {
|
||||||
}
|
selectSql.append(item.getBaseTableFiled().getFieldName())
|
||||||
|
.append(",");
|
||||||
@NotNull
|
update.append(" ")
|
||||||
private Map<String, String> getStringMap(Property[] propertyArr) {
|
.append(item.getTargetField().trim())
|
||||||
if (null == propertyArr) {
|
.append(" = ")
|
||||||
return Collections.emptyMap();
|
.append(" #{")
|
||||||
}
|
.append(item.getBaseTableFiled().getFieldName())
|
||||||
Map<String, String> mainTable = new HashMap<>(8);
|
.append("},");
|
||||||
for (Property property : propertyArr) {
|
}
|
||||||
String fieldName = property.getName();
|
selectSql.deleteCharAt(selectSql.length() - 1);
|
||||||
String value = property.getValue();
|
update.deleteCharAt(update.length() - 1);
|
||||||
mainTable.put(fieldName, value);
|
selectSql.append(" from ")
|
||||||
}
|
.append(stageUpdateFieldConfig.getBaseTable().getTableName())
|
||||||
return mainTable;
|
.append(" where ")
|
||||||
}
|
.append(Util.getCusConfigValueNullOrEmpty(projectIdField, ""))
|
||||||
|
.append(" = '")
|
||||||
|
.append(projectId.replace("'", "''"))
|
||||||
|
.append("'");
|
||||||
|
Map<String, Object> projectInfo = mapper.selectCustomerSql(selectSql.toString());
|
||||||
|
Assert.notEmpty(projectInfo, "query project info empty!");
|
||||||
|
update.append(" where project_id = '")
|
||||||
|
.append(projectId.replace("'", "''"))
|
||||||
|
.append("'");
|
||||||
|
mapper.updateCustomerSql(update.toString(), projectInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取流程主表数据</h2>
|
||||||
|
*
|
||||||
|
* @return 流程主表数据
|
||||||
|
*/
|
||||||
|
protected Map<String, String> getMainTableValue(RequestInfo requestInfo) {
|
||||||
|
// 获取主表数据
|
||||||
|
Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
|
||||||
|
return getStringMap(propertyArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Map<String, String> getStringMap(Property[] propertyArr) {
|
||||||
|
if (null == propertyArr) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
Map<String, String> mainTable = new HashMap<>(8);
|
||||||
|
for (Property property : propertyArr) {
|
||||||
|
String fieldName = property.getName();
|
||||||
|
String value = property.getValue();
|
||||||
|
mainTable.put(fieldName, value);
|
||||||
|
}
|
||||||
|
return mainTable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
# ${id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u4E0D\u5BF9\u7ED3\u679C\u8F6C\u4E49\uFF0C#{id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u5E76\u5C06\u7ED3\u679C\u8FDB\u884C\u8F6C\u4E49\u4F7F\u7528?\u4EE3\u66FF\u540E\u62FC\u63A5\u5230sql\u5B57\u7B26\u4E32\u4E2D
|
||||||
|
# #sql{select xx from xxx } \u8868\u793A\u67E5\u8BE2SQL\uFF0C\u5C06\u7ED3\u679C\u7684\u7B2C\u4E00\u4E2A\u5B57\u6BB5\u5F53\u505A\u503C
|
||||||
|
# \u67E5\u8BE2\u7ED3\u679C\u914D\u7F6E
|
||||||
|
aiyh.patentWall.voMapping.dataResource=uf_zlqzsb
|
||||||
|
aiyh.patentWall.voMapping.id=${id}
|
||||||
|
aiyh.patentWall.voMapping.icon=patent.png
|
||||||
|
aiyh.patentWall.voMapping.activeIcon=patent_active.png
|
||||||
|
aiyh.patentWall.voMapping.title=#sql{select imagefilename from docimagefile where docid = #{zlzs} }
|
||||||
|
# labelName labelIndex linkUrl
|
||||||
|
aiyh.patentWall.voMapping.linkList[0].labelName=\u67E5\u770B\u6587\u6863
|
||||||
|
aiyh.patentWall.voMapping.linkList[0].labelIndex=-93792
|
||||||
|
aiyh.patentWall.voMapping.linkList[0].linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
aiyh.patentWall.voMapping.linkList[1].labelName=\u8DF3\u8F6C\u6D41\u7A0B
|
||||||
|
aiyh.patentWall.voMapping.linkList[1].labelIndex=-93793
|
||||||
|
aiyh.patentWall.voMapping.linkList[1].linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
#aiyh.patentWall.voMapping.linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
aiyh.patentWall.voMapping.docId=${zlzs}
|
||||||
|
aiyh.patentWall.voMapping.imageFileId=#sql{select imagefileid from docimagefile where docid = #{zlzs} }
|
||||||
|
|
||||||
|
# \u641C\u7D22\u4FE1\u606F\u914D\u7F6E
|
||||||
|
# type \u8868\u793A\u641C\u7D22\u6846\u7C7B\u578B\uFF0C1-\u9009\u62E9\u6846\uFF0C2-\u5355\u884C\u6587\u672C\uFF0C3-\u65E5\u671F\uFF0C4-\u5355\u4EBA\u529B\u8D44\u6E90\uFF0C5-\u591A\u4EBA\u529B\u8D44\u6E90\uFF0C6-\u6D41\u7A0B\u8DEF\u5F84\uFF0C7-\u591A\u6D41\u7A0B\u8DEF\u5F84\uFF0C8-\u65E5\u671F\u8303\u56F4
|
||||||
|
# name \u6570\u636E\u5E93\u5B57\u6BB5 \u641C\u7D22\u65F6\u9700\u8981\u8FC7\u6EE4\u90A3\u4E2A\u6570\u636E\u5E93\u5B57\u6BB5\u7684\u503C
|
||||||
|
# labelName \u524D\u7AEF\u9ED8\u8BA4\u663E\u793A\u6587\u5B57\u7684labelName
|
||||||
|
# labelIndex \u524D\u7AEF\u663E\u793A\u6587\u5B57\u7684labelIndex
|
||||||
|
# searchType \u641C\u7D22\u7C7B\u578B 1-\u7B49\u4E8E\uFF0C2-\u5927\u4E8E\uFF0C3-\u5C0F\u4E8E\uFF0C4-in\uFF0C5-\u65E5\u671F\u5927\u4E8E\uFF0C6-\u65E5\u671F\u5C0F\u4E8E\uFF0C7-\u65E5\u671F\u7B49\u4E8E,8-\u65E5\u671F\u8303\u56F4
|
||||||
|
aiyh.patentWall.search.dataResource=uf_zlqzsb
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[0].type=2
|
||||||
|
aiyh.patentWall.search.inputs[0].dbFieldName=zlqr
|
||||||
|
aiyh.patentWall.search.inputs[0].labelName=\u4E13\u5229\u6743\u4EBA
|
||||||
|
aiyh.patentWall.search.inputs[0].labelIndex=-95588
|
||||||
|
aiyh.patentWall.search.inputs[0].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[0].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[1].type=2
|
||||||
|
aiyh.patentWall.search.inputs[1].dbFieldName=fmrsjr
|
||||||
|
aiyh.patentWall.search.inputs[1].labelName=\u53D1\u660E\u4EBA/\u8BBE\u8BA1\u4EBA
|
||||||
|
aiyh.patentWall.search.inputs[1].labelIndex=-95589
|
||||||
|
aiyh.patentWall.search.inputs[1].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[1].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[2].type=2
|
||||||
|
aiyh.patentWall.search.inputs[2].dbFieldName=zlcpmc
|
||||||
|
aiyh.patentWall.search.inputs[2].labelName=\u4E13\u5229\u4EA7\u54C1\u540D\u79F0
|
||||||
|
aiyh.patentWall.search.inputs[2].labelIndex=-95590
|
||||||
|
aiyh.patentWall.search.inputs[2].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[2].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[3].type=1
|
||||||
|
aiyh.patentWall.search.inputs[3].dbFieldName=zllx
|
||||||
|
aiyh.patentWall.search.inputs[3].labelName=\u4E13\u5229\u7C7B\u578B
|
||||||
|
aiyh.patentWall.search.inputs[3].labelIndex=-95591
|
||||||
|
aiyh.patentWall.search.inputs[3].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[3].multiple=true
|
||||||
|
aiyh.patentWall.search.inputs[3].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[4].type=3
|
||||||
|
aiyh.patentWall.search.inputs[4].dbFieldName=zlsqrq
|
||||||
|
aiyh.patentWall.search.inputs[4].labelName=\u4E13\u5229\u7533\u8BF7\u65E5\u671F
|
||||||
|
aiyh.patentWall.search.inputs[4].labelIndex=-95592
|
||||||
|
aiyh.patentWall.search.inputs[4].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[4].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[5].type=1
|
||||||
|
aiyh.patentWall.search.inputs[5].dbFieldName=zlzt
|
||||||
|
aiyh.patentWall.search.inputs[5].labelName=\u4E13\u5229\u72B6\u6001
|
||||||
|
aiyh.patentWall.search.inputs[5].labelIndex=-95593
|
||||||
|
aiyh.patentWall.search.inputs[5].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[5].value=
|
||||||
|
|
||||||
|
aiyh.patentWall.search.inputs[6].type=1
|
||||||
|
aiyh.patentWall.search.inputs[6].dbFieldName=sqlx
|
||||||
|
aiyh.patentWall.search.inputs[6].labelName=\u6388\u6743\u7C7B\u578B
|
||||||
|
aiyh.patentWall.search.inputs[6].labelIndex=-95594
|
||||||
|
aiyh.patentWall.search.inputs[6].searchType=1
|
||||||
|
aiyh.patentWall.search.inputs[6].value=
|
||||||
|
|
||||||
|
|
||||||
|
# copyrightWall \u8457\u4F5C\u5899
|
||||||
|
|
||||||
|
aiyh.copyrightWall.voMapping.dataResource=uf_zlqzsb
|
||||||
|
aiyh.copyrightWall.voMapping.id=${id}
|
||||||
|
aiyh.copyrightWall.voMapping.icon=patent.png
|
||||||
|
aiyh.copyrightWall.voMapping.activeIcon=patent_active.png
|
||||||
|
aiyh.copyrightWall.voMapping.title=#sql{select imagefilename from docimagefile where docid = #{zlzs} }
|
||||||
|
# labelName labelIndex linkUrl
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[0].labelName=\u67E5\u770B\u6587\u6863
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[0].labelIndex=-93802
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[0].linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[1].labelName=\u8DF3\u8F6C\u6D41\u7A0B
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[1].labelIndex=-93803
|
||||||
|
aiyh.copyrightWall.voMapping.linkList[1].linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
#aiyh.copyrightWall.voMapping.linkUrl=/spa/document/index.jsp?id=${zlzs}
|
||||||
|
aiyh.copyrightWall.voMapping.docId=${zlzs}
|
||||||
|
aiyh.copyrightWall.voMapping.imageFileId=#sql{select imagefileid from docimagefile where docid = #{zlzs} }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.dataResource=uf_zlqzsb
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[0].type=2
|
||||||
|
aiyh.copyrightWall.search.inputs[0].dbFieldName=zlqr
|
||||||
|
aiyh.copyrightWall.search.inputs[0].labelName=\u4E13\u5229\u6743\u4EBA
|
||||||
|
aiyh.copyrightWall.search.inputs[0].labelIndex=-95595
|
||||||
|
aiyh.copyrightWall.search.inputs[0].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[0].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[1].type=2
|
||||||
|
aiyh.copyrightWall.search.inputs[1].dbFieldName=fmrsjr
|
||||||
|
aiyh.copyrightWall.search.inputs[1].labelName=\u53D1\u660E\u4EBA/\u8BBE\u8BA1\u4EBA
|
||||||
|
aiyh.copyrightWall.search.inputs[1].labelIndex=-95598
|
||||||
|
aiyh.copyrightWall.search.inputs[1].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[1].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[2].type=2
|
||||||
|
aiyh.copyrightWall.search.inputs[2].dbFieldName=zlcpmc
|
||||||
|
aiyh.copyrightWall.search.inputs[2].labelName=\u4E13\u5229\u4EA7\u54C1\u540D\u79F0
|
||||||
|
aiyh.copyrightWall.search.inputs[2].labelIndex=-95597
|
||||||
|
aiyh.copyrightWall.search.inputs[2].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[2].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[3].type=1
|
||||||
|
aiyh.copyrightWall.search.inputs[3].dbFieldName=zllx
|
||||||
|
aiyh.copyrightWall.search.inputs[3].labelName=\u4E13\u5229\u7C7B\u578B
|
||||||
|
aiyh.copyrightWall.search.inputs[3].labelIndex=-95599
|
||||||
|
aiyh.copyrightWall.search.inputs[3].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[3].multiple=true
|
||||||
|
aiyh.copyrightWall.search.inputs[3].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[4].type=3
|
||||||
|
aiyh.copyrightWall.search.inputs[4].dbFieldName=zlsqrq
|
||||||
|
aiyh.copyrightWall.search.inputs[4].labelName=\u4E13\u5229\u7533\u8BF7\u65E5\u671F
|
||||||
|
aiyh.copyrightWall.search.inputs[4].labelIndex=-95600
|
||||||
|
aiyh.copyrightWall.search.inputs[4].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[4].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[5].type=1
|
||||||
|
aiyh.copyrightWall.search.inputs[5].dbFieldName=zlzt
|
||||||
|
aiyh.copyrightWall.search.inputs[5].labelName=\u4E13\u5229\u72B6\u6001
|
||||||
|
aiyh.copyrightWall.search.inputs[5].labelIndex=-95601
|
||||||
|
aiyh.copyrightWall.search.inputs[5].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[5].value=
|
||||||
|
|
||||||
|
aiyh.copyrightWall.search.inputs[6].type=1
|
||||||
|
aiyh.copyrightWall.search.inputs[6].dbFieldName=sqlx
|
||||||
|
aiyh.copyrightWall.search.inputs[6].labelName=\u6388\u6743\u7C7B\u578B
|
||||||
|
aiyh.copyrightWall.search.inputs[6].labelIndex=-95594
|
||||||
|
aiyh.copyrightWall.search.inputs[6].searchType=1
|
||||||
|
aiyh.copyrightWall.search.inputs[6].value=
|
|
@ -0,0 +1,25 @@
|
||||||
|
# ${id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u4E0D\u5BF9\u7ED3\u679C\u8F6C\u4E49\uFF0C#{id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u5E76\u5C06\u7ED3\u679C\u8FDB\u884C\u8F6C\u4E49\u4F7F\u7528?\u4EE3\u66FF\u540E\u62FC\u63A5\u5230sql\u5B57\u7B26\u4E32\u4E2D
|
||||||
|
# #sql{select xx from xxx } \u8868\u793A\u67E5\u8BE2SQL\uFF0C\u5C06\u7ED3\u679C\u7684\u7B2C\u4E00\u4E2A\u5B57\u6BB5\u5F53\u505A\u503C
|
||||||
|
# \u67E5\u8BE2\u7ED3\u679C\u914D\u7F6E
|
||||||
|
aiyh.classificationWall.voMapping.dataResource=uf_zfzy
|
||||||
|
# \u6DFB\u52A0\u8D44\u6E90\u6309\u94AE\u94FE\u63A5
|
||||||
|
aiyh.classificationWall.voMapping.addSourceUrl=http://www.baidu.com
|
||||||
|
aiyh.classificationWall.voMapping.addSourceLabelIndex=-1000
|
||||||
|
aiyh.classificationWall.voMapping.addSourceLabelName=\u6DFB\u52A0\u8D44\u6E90
|
||||||
|
# \u6570\u636EID
|
||||||
|
aiyh.classificationWall.voMapping.id=${id}
|
||||||
|
# \u56FA\u5B9A\u503C\u56FE\u7247\u540D\u79F0ecode\u56FE\u7247\u540D\u79F0
|
||||||
|
aiyh.classificationWall.voMapping.icon=patent.png
|
||||||
|
aiyh.classificationWall.voMapping.activeIcon=patent_active.png
|
||||||
|
# \u4E0B\u811A\u663E\u793A\u7684\u6807\u9898
|
||||||
|
aiyh.classificationWall.voMapping.title=${mc}
|
||||||
|
aiyh.classificationWall.voMapping.titleEn=${mc}
|
||||||
|
# labelName labelIndex linkUrl
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].labelName=\u67E5\u770B\u6587\u6863
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].labelIndex=-93792
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].linkUrl=/spa/document/index.jsp?id=${zyxq}
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].labelName=\u8DF3\u8F6C\u6D41\u7A0B
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].labelIndex=-93793
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].linkUrl=/spa/document/index.jsp?id=${id}
|
||||||
|
aiyh.classificationWall.voMapping.docId=0
|
||||||
|
aiyh.classificationWall.voMapping.imageFileId=0
|
|
@ -0,0 +1,16 @@
|
||||||
|
# \u5047\u671F\u7C7B\u578B\u6620\u5C04\u5173\u7CFB
|
||||||
|
# its\u5E74\u5047\u6620\u5C04OA\u5176\u4ED6
|
||||||
|
holidaySync.its_type.1=9
|
||||||
|
# its\u8C03\u4F11\u6620\u5C04OA\u8C03\u4F11\u5047
|
||||||
|
holidaySync.its_type.2=10
|
||||||
|
|
||||||
|
|
||||||
|
# \u5047\u671F\u4F7F\u7528\u989D
|
||||||
|
holidaySync.its_oa_holiday_viw.used_amount=usedamount
|
||||||
|
holidaySync.its_oa_holiday_viw.total_amount=baseAmount
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# \u6388\u6743\u7801
|
||||||
|
aiyh.client.clientId=100001
|
||||||
|
aiyh.client.clientSecret=1099af237ed347b19a992a5e46520241
|
||||||
|
|
||||||
|
# \u6620\u5C04\u89C4\u5219
|
||||||
|
aiyh.sqlMapper.ee_no=#{loginid}
|
||||||
|
aiyh.sqlMapper.org_code=ford
|
|
@ -0,0 +1,25 @@
|
||||||
|
# ${id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u4E0D\u5BF9\u7ED3\u679C\u8F6C\u4E49\uFF0C#{id}\u8868\u793A\u8BFB\u53D6\u6570\u636E\u5E93\u4E2D\u7684id\uFF0C\u5E76\u5C06\u7ED3\u679C\u8FDB\u884C\u8F6C\u4E49\u4F7F\u7528?\u4EE3\u66FF\u540E\u62FC\u63A5\u5230sql\u5B57\u7B26\u4E32\u4E2D
|
||||||
|
# #sql{select xx from xxx } \u8868\u793A\u67E5\u8BE2SQL\uFF0C\u5C06\u7ED3\u679C\u7684\u7B2C\u4E00\u4E2A\u5B57\u6BB5\u5F53\u505A\u503C
|
||||||
|
# \u67E5\u8BE2\u7ED3\u679C\u914D\u7F6E
|
||||||
|
aiyh.classificationWall.voMapping.dataResource=uf_zfzy
|
||||||
|
# \u6DFB\u52A0\u8D44\u6E90\u6309\u94AE\u94FE\u63A5
|
||||||
|
aiyh.classificationWall.voMapping.addSourceUrl=http://www.baidu.com
|
||||||
|
aiyh.classificationWall.voMapping.addSourceLabelIndex=-1000
|
||||||
|
aiyh.classificationWall.voMapping.addSourceLabelName=\u6DFB\u52A0\u8D44\u6E90
|
||||||
|
# \u6570\u636EID
|
||||||
|
aiyh.classificationWall.voMapping.id=${id}
|
||||||
|
# \u56FA\u5B9A\u503C\u56FE\u7247\u540D\u79F0ecode\u56FE\u7247\u540D\u79F0
|
||||||
|
aiyh.classificationWall.voMapping.icon=patent.png
|
||||||
|
aiyh.classificationWall.voMapping.activeIcon=patent_active.png
|
||||||
|
# \u4E0B\u811A\u663E\u793A\u7684\u6807\u9898
|
||||||
|
aiyh.classificationWall.voMapping.title=${mc}
|
||||||
|
aiyh.classificationWall.voMapping.titleEn=${mc}
|
||||||
|
# labelName labelIndex linkUrl
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].labelName=\u67E5\u770B\u6587\u6863
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].labelIndex=-93792
|
||||||
|
aiyh.classificationWall.voMapping.linkList[0].linkUrl=/spa/document/index.jsp?id=${zyxq}
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].labelName=\u8DF3\u8F6C\u6D41\u7A0B
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].labelIndex=-93793
|
||||||
|
aiyh.classificationWall.voMapping.linkList[1].linkUrl=/spa/document/index.jsp?id=${id}
|
||||||
|
aiyh.classificationWall.voMapping.docId=0
|
||||||
|
aiyh.classificationWall.voMapping.imageFileId=0
|
|
@ -0,0 +1,6 @@
|
||||||
|
aiyh.htmlLabel.porsche.FaDDContractController.pushErr.labelIndex=-1
|
||||||
|
aiyh.htmlLabel.porsche.FaDDContractController.pushErr.defaultStr=\u90AE\u4EF6\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01
|
||||||
|
aiyh.htmlLabel.porsche.FaDDContractController.pushSuccess.labelIndex=-1
|
||||||
|
aiyh.htmlLabel.porsche.FaDDContractController.pushSuccess.defaultStr=\u7B7E\u7F72\u90AE\u4EF6\u53D1\u9001\u6210\u529F\uFF01
|
||||||
|
attachment_sort.AnnexSortAction.sortErr.labelIndex=-1
|
||||||
|
attachment_sort.AnnexSortAction.sortErr.defaultStr=\u6587\u4EF6\u6392\u5E8F\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF01
|
|
@ -0,0 +1,29 @@
|
||||||
|
# \u8BF7\u6C42\u53C2\u6570\u4FE1\u606F
|
||||||
|
# request params config
|
||||||
|
# #{resource_id} replace database hrmresource table's id
|
||||||
|
# #{field} or ${field} replace database hrmresource and cus_fielddata field value
|
||||||
|
# #sql{select name from xxx where id = #{resource_id}} while replace execute customer sql to value
|
||||||
|
# String: Express this value is String; Integer: Express this value is Integer; Boolean: Express this value is Boolean; Double: Express this value is Double
|
||||||
|
# #{resource_id} \u8868\u793A\u4EBA\u529B\u8D44\u6E90\u8868\u4E2D\u7684id
|
||||||
|
# #{field} \u8868\u793A\u4EBA\u529B\u8D44\u6E90\u8868\u4E2D\u6216cus_fielddata\u5373\u81EA\u5B9A\u4E49\u4EBA\u5458\u5361\u7247\u5B57\u6BB5\u7684\u503C
|
||||||
|
# #sql{select name from xx where id = #{xx}} \u8868\u662F\u81EA\u5B9A\u4E49SQL
|
||||||
|
# String: Integer: Boolean: Double: \u5206\u522B\u8868\u793A\u8FD9\u4E2A\u503C\u7C7B\u578B\u4E3Astring\u3001integer\u3001boolean\u3001double\u7C7B\u578B\u7684\u8BF7\u6C42\u53C2\u6570
|
||||||
|
fadada.realNameAuthentication.customerId=String:#{lasyname}
|
||||||
|
fadada.realNameAuthentication.verifiedWay=Integer:#sql{select id from hrmdeptment where id = #{deptId}}
|
||||||
|
fadada.realNameAuthentication.pageModify=Boolean:
|
||||||
|
fadada.realNameAuthentication.isRepeatVerified=Double:
|
||||||
|
fadada.realNameAuthentication.customerName=
|
||||||
|
fadada.realNameAuthentication.customerIdentityType=
|
||||||
|
fadada.realNameAuthentication.customerIdentityNo=
|
||||||
|
fadada.realNameAuthentication.mobile=
|
||||||
|
fadada.realNameAuthentication.identityFrontPath=
|
||||||
|
fadada.realNameAuthentication.notifyUrl=
|
||||||
|
fadada.realNameAuthentication.returnUrl=
|
||||||
|
fadada.realNameAuthentication.isSendSms=
|
||||||
|
fadada.realNameAuthentication.identityBackPath=
|
||||||
|
fadada.realNameAuthentication.resultType=
|
||||||
|
fadada.realNameAuthentication.certType=
|
||||||
|
fadada.realNameAuthentication.applyCert=
|
||||||
|
fadada.realNameAuthentication.certMode=
|
||||||
|
fadada.realNameAuthentication.miniProgram=
|
||||||
|
fadada.realNameAuthentication.mobileDevice=
|
|
@ -0,0 +1,3 @@
|
||||||
|
fadada.baseUrl=http://123.60.67.228:8070/
|
||||||
|
fadada.appKey=BLEshmz8xZPyKRAG4aUiSopt
|
||||||
|
fadada.appId=100000
|
|
@ -0,0 +1,47 @@
|
||||||
|
# \u914D\u7F6E\u89C4\u5219 \u73AF\u5883.\u4E1A\u52A1\u540D\u79F0.\u83B7\u53D6token\u8D26\u53F7\u4FE1\u606F
|
||||||
|
# configuration environment.Business name.token info
|
||||||
|
# oa\u53D1\u677F\u6D41\u7A0B\u63A8\u9001
|
||||||
|
# product environment
|
||||||
|
pro.release.userName=oa005
|
||||||
|
pro.release.password=123456
|
||||||
|
pro.release.systemCode=oa
|
||||||
|
pro.release.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
pro.release.baseUrl=https://jtdcapi.jtexpress.com.cn
|
||||||
|
pro.release.expiration=24
|
||||||
|
# uat test environment
|
||||||
|
uat.release.userName=oa003
|
||||||
|
uat.release.password=JT0725!
|
||||||
|
uat.release.systemCode=oa
|
||||||
|
uat.release.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
uat.release.baseUrl=https://uat-jtdcapi.jtexpress.com.cn
|
||||||
|
uat.release.expiration=24
|
||||||
|
# jms\u5E72\u7EBF\u63A8\u9001
|
||||||
|
# product environment
|
||||||
|
pro.jms.userName=oa005
|
||||||
|
pro.jms.password=123456
|
||||||
|
pro.jms.systemCode=oa
|
||||||
|
pro.jms.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
pro.jms.baseUrl=https://jtdcapi.jtexpress.com.cn
|
||||||
|
pro.jms.expiration=24
|
||||||
|
# uat test environment
|
||||||
|
uat.jms.userName=oa003
|
||||||
|
uat.jms.password=JT0725!
|
||||||
|
uat.jms.systemCode=oa
|
||||||
|
uat.jms.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
uat.jms.baseUrl=https://uat-jtdcapi.jtexpress.com.cn
|
||||||
|
uat.jms.expiration=24
|
||||||
|
# \u9ED8\u8BA4
|
||||||
|
# product environment
|
||||||
|
pro.default.userName=oa005
|
||||||
|
pro.default.password=123456
|
||||||
|
pro.default.systemCode=oa
|
||||||
|
pro.default.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
pro.default.baseUrl=https://jtdcapi.jtexpress.com.cn
|
||||||
|
pro.default.expiration=24
|
||||||
|
# uat test environment
|
||||||
|
uat.default.userName=oa003
|
||||||
|
uat.default.password=JT0725!
|
||||||
|
uat.default.systemCode=oa
|
||||||
|
uat.default.secretKey=5362448sd132d241e5ae27e318qws11d
|
||||||
|
uat.default.baseUrl=https://uat-jtdcapi.jtexpress.com.cn
|
||||||
|
uat.default.expiration=24
|
|
@ -0,0 +1,18 @@
|
||||||
|
# \u4F01\u4E1A\u5FAE\u4FE1\u83B7\u53D6accessToken\u914D\u7F6E\u4FE1\u606F
|
||||||
|
# \u4F01\u4E1Acorpid
|
||||||
|
# corpid
|
||||||
|
wx.corpid=wwe5f751c365f187e7
|
||||||
|
# \u901A\u8BAF\u5F55\u7EF4\u62A4\u63A5\u53E3\u51ED\u8BC1
|
||||||
|
# wx corpsecret
|
||||||
|
wx.corpsecret=L_3ml7weLt9qnonRAPsHN8qw2fG0xJQxsUfWSKv0tsA
|
||||||
|
# \u83B7\u53D6access_token\u5730\u5740
|
||||||
|
wx.baseHost=https://qyapi.weixin.qq.com
|
||||||
|
# ============================= #
|
||||||
|
# EM7 corpid
|
||||||
|
# corpid
|
||||||
|
em.corpid=em049e8906ac5811e9833ffa163ed86778
|
||||||
|
# \u901A\u8BAF\u5F55\u7EF4\u62A4\u63A5\u53E3\u51ED\u8BC1
|
||||||
|
# wx corpsecret
|
||||||
|
em.corpsecret=8e5f4d98-8dd0-4657-9025-fb8ace22494b
|
||||||
|
# \u83B7\u53D6access_token\u5730\u5740
|
||||||
|
em.baseHost=http://121.36.197.152:8999
|
|
@ -6,7 +6,6 @@ import org.junit.Test;
|
||||||
import youhong.ai.mymapper.command.entity.SqlDefinition;
|
import youhong.ai.mymapper.command.entity.SqlDefinition;
|
||||||
import youhong.ai.mymapper.util.ParseSqlUtil;
|
import youhong.ai.mymapper.util.ParseSqlUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -52,6 +51,65 @@ public class ParseSqlTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadClass() {
|
public void testLoadClass() {
|
||||||
System.out.println(Arrays.asList("1", "2", "3", "4"));
|
String sql = "{\n" +
|
||||||
|
"\t\t@my-when:test=\"\"{\n" +
|
||||||
|
"\t\t\tid = #{id}\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t\t@my-when:test=\"\"{\n" +
|
||||||
|
"\t\t\tid = #{id}\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t\t@my-when:test=\"\"{\n" +
|
||||||
|
"\t\t\tid = #{id}\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t\t@my-when:test=\"\"{\n" +
|
||||||
|
"\t\t\tid = #{id}\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t\t@my-otherwise{\n" +
|
||||||
|
"\t\t\tid = #{id}\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"}";
|
||||||
|
ParseSqlUtil parseSqlUtil = new ParseSqlUtil();
|
||||||
|
System.out.println(JSON.toJSONString(parseSqlUtil.getCommandList(sql)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSqlChoose() {
|
||||||
|
String sql = "@my-bind:name='likeName':value=''%' + name + '%''{}\n" +
|
||||||
|
"select * from table @my-where{\n" +
|
||||||
|
"\t@my-for:collection='list':separator='and'{\n" +
|
||||||
|
"\t\t${index} = #{item}\t\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"} or @my-choose{\n" +
|
||||||
|
"\t@my-when:test='selectValue == 1'{\n" +
|
||||||
|
"\t\tselect_name = #{selectName1}\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"\t@my-when:test='selectValue == 2'{\n" +
|
||||||
|
"\t\tselect_name = #{selectName2}\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"\t@my-when:test='selectValue == 3'{\n" +
|
||||||
|
"\t\tselect_name = #{selectName3}\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"\t@my-otherwise{\n" +
|
||||||
|
"\t\tselect_name like #{likeName}\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
Map<String, Object> param = new HashMap<>();
|
||||||
|
param.put("list", new HashMap<String, String>() {{
|
||||||
|
put("field1", "1");
|
||||||
|
put("field2", "2");
|
||||||
|
put("field3", "3");
|
||||||
|
}});
|
||||||
|
|
||||||
|
param.put("selectValue", 4);
|
||||||
|
param.put("selectName1", "name1");
|
||||||
|
param.put("selectName2", "name2");
|
||||||
|
param.put("selectName3", "name3");
|
||||||
|
param.put("selectNameDefault", "default");
|
||||||
|
param.put("name", "zhang");
|
||||||
|
ParseSqlUtil parseSqlUtil = new ParseSqlUtil();
|
||||||
|
SqlDefinition parse = parseSqlUtil.parse(sql, param);
|
||||||
|
System.out.println(JSON.toJSONString(parse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package youhong.ai.mymapper.command.commandImpl;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import youhong.ai.mymapper.command.ISqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.annotation.SqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
|
import youhong.ai.mymapper.command.entity.SqlCommandDefinition;
|
||||||
|
import youhong.ai.mymapper.command.properties.MyBindProperties;
|
||||||
|
import youhong.ai.mymapper.util.ParseSqlUtil;
|
||||||
|
import youhong.ai.mymapper.util.ScriptUtil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>bind指令</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 11:58</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlCommand(CommandConsTant.BIND)
|
||||||
|
public class MyBindCommand implements ISqlCommand {
|
||||||
|
@Override
|
||||||
|
public String execute(SqlCommandDefinition sqlCommandDefinition) {
|
||||||
|
MyBindProperties properties = (MyBindProperties) sqlCommandDefinition.getProperties();
|
||||||
|
String name = properties.getName();
|
||||||
|
if (StrUtil.isBlank(name)) {
|
||||||
|
throw new CustomerException("bind command attribute of name can not be null");
|
||||||
|
}
|
||||||
|
Map<String, Object> tempMap = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get();
|
||||||
|
if (CollectionUtil.isEmpty(tempMap)) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.set(map);
|
||||||
|
tempMap = map;
|
||||||
|
}
|
||||||
|
name = name.trim();
|
||||||
|
if (tempMap.containsKey(name)) {
|
||||||
|
throw new CustomerException(Util.logStr("can not bind variable [{}], [{}] has been declared!",
|
||||||
|
name, name));
|
||||||
|
}
|
||||||
|
Map<String, Object> param = ParseSqlUtil.PARSE_PARAM_LOCALE.get();
|
||||||
|
if (Objects.isNull(param)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
param.putAll(tempMap);
|
||||||
|
String valueStr = properties.getValue();
|
||||||
|
Object value = null;
|
||||||
|
if (!StrUtil.isBlank(valueStr)) {
|
||||||
|
value = ScriptUtil.invokeScript(valueStr.trim(), param);
|
||||||
|
}
|
||||||
|
param.put(name, value);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
package youhong.ai.mymapper.command.commandImpl;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import youhong.ai.mymapper.command.CommandExecutor;
|
||||||
|
import youhong.ai.mymapper.command.ISqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.annotation.SqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyWhenProperties;
|
||||||
|
import youhong.ai.mymapper.command.entity.SqlCommandDefinition;
|
||||||
|
import youhong.ai.mymapper.util.ParseSqlUtil;
|
||||||
|
import youhong.ai.mymapper.util.ScriptUtil;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>choose 指令</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 09:24</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlCommand(CommandConsTant.CHOOSE)
|
||||||
|
public class MyChooseCommand implements ISqlCommand {
|
||||||
|
|
||||||
|
private final List<String> CHILDREN_LIST = Arrays.asList(CommandConsTant.WHEN, CommandConsTant.OTHERWISE);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(SqlCommandDefinition sqlCommandDefinition) {
|
||||||
|
ParseSqlUtil parseSqlUtil = new ParseSqlUtil();
|
||||||
|
String commandContent = sqlCommandDefinition.getCommandContent();
|
||||||
|
List<SqlCommandDefinition> commandList = parseSqlUtil.getCommandList(commandContent);
|
||||||
|
if (CollectionUtil.isEmpty(commandList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int otherwiseNum = 0;
|
||||||
|
SqlCommandDefinition otherWiseDefinition = null;
|
||||||
|
List<SqlCommandDefinition> commandListSort = new ArrayList<>();
|
||||||
|
for (SqlCommandDefinition commandDefinition : commandList) {
|
||||||
|
if (!CHILDREN_LIST.contains(commandDefinition.getCommandType())) {
|
||||||
|
throw new CustomerException(Util.logStr("The command node of choose can only include {}, not {}", CHILDREN_LIST.toString(), commandDefinition.getCommandType()));
|
||||||
|
}
|
||||||
|
if (CommandConsTant.OTHERWISE.equals(commandDefinition.getCommandType())) {
|
||||||
|
otherwiseNum++;
|
||||||
|
otherWiseDefinition = commandDefinition;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
commandListSort.add(commandDefinition);
|
||||||
|
}
|
||||||
|
if (otherwiseNum > 1) {
|
||||||
|
throw new CustomerException(CommandConsTant.OTHERWISE + " command has and can only have one!");
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(otherWiseDefinition)) {
|
||||||
|
commandListSort.add(otherWiseDefinition);
|
||||||
|
}
|
||||||
|
return extracted(commandListSort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>选择执行命令</h2>
|
||||||
|
*
|
||||||
|
* @param commandList 命令列表
|
||||||
|
* @return 执行结果
|
||||||
|
*/
|
||||||
|
private String extracted(List<SqlCommandDefinition> commandList) {
|
||||||
|
SqlCommandDefinition commandDefinition = null;
|
||||||
|
for (int i = 0; i < commandList.size(); i++) {
|
||||||
|
SqlCommandDefinition item = commandList.get(i);
|
||||||
|
String commandType = item.getCommandType();
|
||||||
|
if (CommandConsTant.WHEN.equals(commandType)) {
|
||||||
|
MyWhenProperties properties = (MyWhenProperties) item.getProperties();
|
||||||
|
String test = properties.getTest();
|
||||||
|
if (StrUtil.isBlank(test)) {
|
||||||
|
throw new CustomerException("when command attribute of test can not blank!");
|
||||||
|
}
|
||||||
|
Map<String, Object> tempMap = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get();
|
||||||
|
Map<String, Object> param = ParseSqlUtil.PARSE_PARAM_LOCALE.get();
|
||||||
|
if (Objects.isNull(param)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(tempMap)) {
|
||||||
|
param.putAll(tempMap);
|
||||||
|
}
|
||||||
|
boolean flag = (boolean) ScriptUtil.invokeScript(test, param);
|
||||||
|
if (flag) {
|
||||||
|
commandDefinition = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commandDefinition = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Objects.isNull(commandDefinition)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CommandExecutor commandExecutor = new CommandExecutor();
|
||||||
|
return commandExecutor.executor(commandDefinition);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package youhong.ai.mymapper.command.commandImpl;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import weaver.common.util.string.StringUtil;
|
import weaver.common.util.string.StringUtil;
|
||||||
import youhong.ai.mymapper.command.ISqlCommand;
|
import youhong.ai.mymapper.command.ISqlCommand;
|
||||||
|
@ -186,22 +187,40 @@ public class MyForCommand implements ISqlCommand {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuilder sqlBuilder = new StringBuilder();
|
StringBuilder sqlBuilder = new StringBuilder();
|
||||||
String open = properties.getOpen();
|
String open = properties.getOpen() == null ? "" : properties.getOpen();
|
||||||
String close = properties.getClose();
|
String close = properties.getClose() == null ? "" : properties.getClose();
|
||||||
String separator = properties.getSeparator();
|
String separator = properties.getSeparator() == null ? "" : properties.getSeparator();
|
||||||
sqlBuilder.append(open);
|
sqlBuilder.append(open);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
boolean hasTemp = false;
|
||||||
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
||||||
Map<String, Object> tempParam = new HashMap<>();
|
Map<String, Object> tempParam = new HashMap<>();
|
||||||
tempParam.put(itemName, entry.getValue());
|
tempParam.put(itemName, entry.getValue());
|
||||||
tempParam.put(indexName, entry.getKey());
|
tempParam.put(indexName, entry.getKey());
|
||||||
ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.set(tempParam);
|
Map<String, Object> tempParamLocale = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get();
|
||||||
|
if (CollectionUtil.isEmpty(tempParamLocale)) {
|
||||||
|
ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.set(tempParam);
|
||||||
|
} else {
|
||||||
|
hasTemp = true;
|
||||||
|
for (Map.Entry<String, Object> tempEntry : tempParamLocale.entrySet()) {
|
||||||
|
if (tempParam.containsKey(tempEntry.getKey())) {
|
||||||
|
throw new CustomerException(Util.logStr("The variable of {} has been declared and cannot be declared again", tempEntry.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempParamLocale.putAll(tempParam);
|
||||||
|
}
|
||||||
String parse = parseSqlUtil.parse(properties.getCommandContent());
|
String parse = parseSqlUtil.parse(properties.getCommandContent());
|
||||||
sqlBuilder.append(" ").append(parse);
|
sqlBuilder.append(" ").append(parse).append(" ");
|
||||||
if (i < map.size() - 1) {
|
if (i < map.size() - 1) {
|
||||||
sqlBuilder.append(separator);
|
sqlBuilder.append(separator);
|
||||||
}
|
}
|
||||||
ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.remove();
|
if (!hasTemp) {
|
||||||
|
ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.remove();
|
||||||
|
} else {
|
||||||
|
for (Map.Entry<String, Object> tempEntry : tempParam.entrySet()) {
|
||||||
|
tempParamLocale.remove(tempEntry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlBuilder.append(close);
|
sqlBuilder.append(close);
|
||||||
return sqlBuilder.toString();
|
return sqlBuilder.toString();
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package youhong.ai.mymapper.command.commandImpl;
|
||||||
|
|
||||||
|
import youhong.ai.mymapper.command.ISqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.annotation.SqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyOtherwiseProperties;
|
||||||
|
import youhong.ai.mymapper.command.entity.SqlCommandDefinition;
|
||||||
|
import youhong.ai.mymapper.util.ParseSqlUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>otherwise 指令</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 09:24</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SqlCommand(CommandConsTant.OTHERWISE)
|
||||||
|
public class MyOtherwiseCommand implements ISqlCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(SqlCommandDefinition sqlCommandDefinition) {
|
||||||
|
MyOtherwiseProperties properties = (MyOtherwiseProperties) sqlCommandDefinition.getProperties();
|
||||||
|
ParseSqlUtil parseSqlUtil = new ParseSqlUtil();
|
||||||
|
return parseSqlUtil.parse(properties.getCommandContent());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package youhong.ai.mymapper.command.commandImpl;
|
||||||
|
|
||||||
|
import youhong.ai.mymapper.command.ISqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.annotation.SqlCommand;
|
||||||
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyWhenProperties;
|
||||||
|
import youhong.ai.mymapper.command.entity.SqlCommandDefinition;
|
||||||
|
import youhong.ai.mymapper.util.ParseSqlUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>when 指令</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 09:24</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlCommand(CommandConsTant.WHEN)
|
||||||
|
public class MyWhenCommand implements ISqlCommand {
|
||||||
|
@Override
|
||||||
|
public String execute(SqlCommandDefinition sqlCommandDefinition) {
|
||||||
|
MyWhenProperties properties = (MyWhenProperties) sqlCommandDefinition.getProperties();
|
||||||
|
ParseSqlUtil parseSqlUtil = new ParseSqlUtil();
|
||||||
|
return parseSqlUtil.parse(properties.getCommandContent());
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,5 +42,8 @@ public class CommandConsTant {
|
||||||
public static final String IF = "if";
|
public static final String IF = "if";
|
||||||
|
|
||||||
public static final String TRIM = "trim";
|
public static final String TRIM = "trim";
|
||||||
public static final String TEST = "@{";
|
public static final String CHOOSE = "choose";
|
||||||
|
public static final String WHEN = "when";
|
||||||
|
public static final String OTHERWISE = "otherwise";
|
||||||
|
public static final String BIND = "bind";
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package youhong.ai.mymapper.command.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import youhong.ai.mymapper.command.properties.AbstractCommandProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 10:10</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class MyChooseProperties extends AbstractCommandProperties {
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package youhong.ai.mymapper.command.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import youhong.ai.mymapper.command.properties.AbstractCommandProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 10:12</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class MyOtherwiseProperties extends AbstractCommandProperties {
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package youhong.ai.mymapper.command.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import youhong.ai.mymapper.command.properties.AbstractCommandProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 10:11</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class MyWhenProperties extends AbstractCommandProperties {
|
||||||
|
/** 表达式 */
|
||||||
|
private String test;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package youhong.ai.mymapper.command.properties;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>bind指令参数</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/15 12:10</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class MyBindProperties extends AbstractCommandProperties {
|
||||||
|
|
||||||
|
/** 名字 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 绑定vale */
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,9 @@ package youhong.ai.mymapper.util;
|
||||||
|
|
||||||
import aiyh.utils.annotation.MethodRuleNo;
|
import aiyh.utils.annotation.MethodRuleNo;
|
||||||
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyChooseProperties;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyOtherwiseProperties;
|
||||||
|
import youhong.ai.mymapper.command.entity.MyWhenProperties;
|
||||||
import youhong.ai.mymapper.command.properties.*;
|
import youhong.ai.mymapper.command.properties.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,9 +18,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class AbstractCommandPropertiesFactory {
|
public class AbstractCommandPropertiesFactory {
|
||||||
|
|
||||||
@MethodRuleNo(name = CommandConsTant.WHERE, desc = "where 指令参数解析")
|
private AbstractCommandProperties setValue(List<String> commandItemList, AbstractCommandProperties commandProperties) {
|
||||||
private AbstractCommandProperties getWhereProperties(List<String> commandItemList) {
|
|
||||||
AbstractCommandProperties commandProperties = new MyWhereProperties();
|
|
||||||
for (int i = 1; i < commandItemList.size(); i++) {
|
for (int i = 1; i < commandItemList.size(); i++) {
|
||||||
String item = commandItemList.get(i);
|
String item = commandItemList.get(i);
|
||||||
CommandPropUtil.setValueString(commandProperties, item);
|
CommandPropUtil.setValueString(commandProperties, item);
|
||||||
|
@ -25,35 +26,44 @@ public class AbstractCommandPropertiesFactory {
|
||||||
return commandProperties;
|
return commandProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MethodRuleNo(name = CommandConsTant.WHERE, desc = "where 指令参数解析")
|
||||||
|
private AbstractCommandProperties getWhereProperties(List<String> commandItemList) {
|
||||||
|
return this.setValue(commandItemList, new MyWhereProperties());
|
||||||
|
}
|
||||||
|
|
||||||
@MethodRuleNo(name = CommandConsTant.FOR, desc = "for 指令参数解析")
|
@MethodRuleNo(name = CommandConsTant.FOR, desc = "for 指令参数解析")
|
||||||
private AbstractCommandProperties getForProperties(List<String> commandItemList) {
|
private AbstractCommandProperties getForProperties(List<String> commandItemList) {
|
||||||
AbstractCommandProperties commandProperties = new MyForProperties();
|
return this.setValue(commandItemList, new MyForProperties());
|
||||||
for (int i = 1; i < commandItemList.size(); i++) {
|
|
||||||
String item = commandItemList.get(i);
|
|
||||||
CommandPropUtil.setValueString(commandProperties, item);
|
|
||||||
}
|
|
||||||
return commandProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@MethodRuleNo(name = CommandConsTant.IF, desc = "if 指令参数解析")
|
@MethodRuleNo(name = CommandConsTant.IF, desc = "if 指令参数解析")
|
||||||
private AbstractCommandProperties getIfProperties(List<String> commandItemList) {
|
private AbstractCommandProperties getIfProperties(List<String> commandItemList) {
|
||||||
AbstractCommandProperties commandProperties = new MyIfProperties();
|
return this.setValue(commandItemList, new MyIfProperties());
|
||||||
for (int i = 1; i < commandItemList.size(); i++) {
|
|
||||||
String item = commandItemList.get(i);
|
|
||||||
CommandPropUtil.setValueString(commandProperties, item);
|
|
||||||
}
|
|
||||||
return commandProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@MethodRuleNo(name = CommandConsTant.TRIM, desc = "tirm 指令参数解析")
|
@MethodRuleNo(name = CommandConsTant.TRIM, desc = "tirm 指令参数解析")
|
||||||
private AbstractCommandProperties getTrimProperties(List<String> commandItemList) {
|
private AbstractCommandProperties getTrimProperties(List<String> commandItemList) {
|
||||||
AbstractCommandProperties commandProperties = new MyTrimProperties();
|
return this.setValue(commandItemList, new MyTrimProperties());
|
||||||
for (int i = 1; i < commandItemList.size(); i++) {
|
|
||||||
String item = commandItemList.get(i);
|
|
||||||
CommandPropUtil.setValueString(commandProperties, item);
|
|
||||||
}
|
|
||||||
return commandProperties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MethodRuleNo(name = CommandConsTant.CHOOSE, desc = "choose 指令参数解析")
|
||||||
|
private AbstractCommandProperties getChooseProperties(List<String> commandItemList) {
|
||||||
|
return this.setValue(commandItemList, new MyChooseProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
@MethodRuleNo(name = CommandConsTant.WHEN, desc = "when 指令参数解析")
|
||||||
|
private AbstractCommandProperties getWhenProperties(List<String> commandItemList) {
|
||||||
|
return this.setValue(commandItemList, new MyWhenProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
@MethodRuleNo(name = CommandConsTant.OTHERWISE, desc = "otherwise 指令参数解析")
|
||||||
|
private AbstractCommandProperties getOtherwiseProperties(List<String> commandItemList) {
|
||||||
|
return this.setValue(commandItemList, new MyOtherwiseProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@MethodRuleNo(name = CommandConsTant.BIND, desc = "bind 指令参数解析")
|
||||||
|
private AbstractCommandProperties getBindProperties(List<String> commandItemList) {
|
||||||
|
return this.setValue(commandItemList, new MyBindProperties());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package youhong.ai.mymapper.util;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
import youhong.ai.mymapper.command.CommandExecutor;
|
import youhong.ai.mymapper.command.CommandExecutor;
|
||||||
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
import youhong.ai.mymapper.command.constant.CommandConsTant;
|
||||||
import youhong.ai.mymapper.command.entity.CommandContentDefinition;
|
import youhong.ai.mymapper.command.entity.CommandContentDefinition;
|
||||||
|
@ -29,6 +30,13 @@ public class ParseSqlUtil {
|
||||||
|
|
||||||
private final CommandExecutor commandExecutor = new CommandExecutor();
|
private final CommandExecutor commandExecutor = new CommandExecutor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>解析sql</h2>
|
||||||
|
*
|
||||||
|
* @param sql 需要解析的sql字符串
|
||||||
|
* @param params sql所需要的参数
|
||||||
|
* @return 解析后的sql数据
|
||||||
|
*/
|
||||||
public SqlDefinition parse(String sql, Map<String, Object> params) {
|
public SqlDefinition parse(String sql, Map<String, Object> params) {
|
||||||
if (!Objects.isNull(params)) {
|
if (!Objects.isNull(params)) {
|
||||||
PARSE_PARAM_LOCALE.set(params);
|
PARSE_PARAM_LOCALE.set(params);
|
||||||
|
@ -46,11 +54,19 @@ public class ParseSqlUtil {
|
||||||
sqlDefinition.setArgs(sqlParams);
|
sqlDefinition.setArgs(sqlParams);
|
||||||
SQL_PARAM_LOCALE.remove();
|
SQL_PARAM_LOCALE.remove();
|
||||||
}
|
}
|
||||||
|
if (!Objects.isNull(PARSE_TEMP_PARAM_LOCALE.get())) {
|
||||||
|
PARSE_TEMP_PARAM_LOCALE.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sqlDefinition;
|
return sqlDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>解析sql或sql片段</h2>
|
||||||
|
*
|
||||||
|
* @param sql sql
|
||||||
|
* @return 解析后sql
|
||||||
|
*/
|
||||||
public String parse(String sql) {
|
public String parse(String sql) {
|
||||||
if (Objects.isNull(sql) || sql.isEmpty()) {
|
if (Objects.isNull(sql) || sql.isEmpty()) {
|
||||||
throw new CustomerException("can not parse sql, sql is empty!");
|
throw new CustomerException("can not parse sql, sql is empty!");
|
||||||
|
@ -64,6 +80,7 @@ public class ParseSqlUtil {
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (int i = 0; i < chars.length; i++) {
|
||||||
char c = chars[i];
|
char c = chars[i];
|
||||||
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
||||||
|
sqlBuilder.append(" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CommandConsTant.COMMAND_PRE_FIX_MARK == c) {
|
if (CommandConsTant.COMMAND_PRE_FIX_MARK == c) {
|
||||||
|
@ -74,7 +91,9 @@ public class ParseSqlUtil {
|
||||||
sqlBuilder.delete(0, sqlBuilder.length());
|
sqlBuilder.delete(0, sqlBuilder.length());
|
||||||
sqlBuilder.append(tempSql);
|
sqlBuilder.append(tempSql);
|
||||||
i += CommandConsTant.COMMAND_PRE_FIX.length + 1;
|
i += CommandConsTant.COMMAND_PRE_FIX.length + 1;
|
||||||
|
// 获取sql指令定义信息
|
||||||
SqlCommandDefinition commandDefinition = parseCommand(chars, i);
|
SqlCommandDefinition commandDefinition = parseCommand(chars, i);
|
||||||
|
// 获取解析后的sql
|
||||||
String commandContent = commandDefinition.getCommandContent();
|
String commandContent = commandDefinition.getCommandContent();
|
||||||
sqlBuilder.append(Objects.isNull(commandContent) ? "" : commandContent);
|
sqlBuilder.append(Objects.isNull(commandContent) ? "" : commandContent);
|
||||||
i += commandDefinition.getCommandLength();
|
i += commandDefinition.getCommandLength();
|
||||||
|
@ -92,6 +111,12 @@ public class ParseSqlUtil {
|
||||||
return simpleSql(sqlStr);
|
return simpleSql(sqlStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>简化sql,去除回车table键等字符</h2>
|
||||||
|
*
|
||||||
|
* @param sql 需要简化的sql
|
||||||
|
* @return 简化后的sql
|
||||||
|
*/
|
||||||
public String simpleSql(String sql) {
|
public String simpleSql(String sql) {
|
||||||
char[] chars = sql.toCharArray();
|
char[] chars = sql.toCharArray();
|
||||||
StringBuilder sqlBuilder = new StringBuilder();
|
StringBuilder sqlBuilder = new StringBuilder();
|
||||||
|
@ -99,6 +124,7 @@ public class ParseSqlUtil {
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (int i = 0; i < chars.length; i++) {
|
||||||
char c = chars[i];
|
char c = chars[i];
|
||||||
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
||||||
|
sqlBuilder.append(" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
|
@ -128,6 +154,12 @@ public class ParseSqlUtil {
|
||||||
return sqlBuilder.toString().trim();
|
return sqlBuilder.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>判断是否含有指令</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @return 是否含有指令
|
||||||
|
*/
|
||||||
private boolean hasCommand(char[] chars) {
|
private boolean hasCommand(char[] chars) {
|
||||||
for (int i = 0; i < chars.length; i++) {
|
for (int i = 0; i < chars.length; i++) {
|
||||||
char c = chars[i];
|
char c = chars[i];
|
||||||
|
@ -138,6 +170,13 @@ public class ParseSqlUtil {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>检查是否存属于指令</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @param index 开始下标
|
||||||
|
* @return 是否属于指令
|
||||||
|
*/
|
||||||
private boolean checkCommand(char[] chars, int index) {
|
private boolean checkCommand(char[] chars, int index) {
|
||||||
if (index + CommandConsTant.COMMAND_PRE_FIX.length + 1 >= chars.length) {
|
if (index + CommandConsTant.COMMAND_PRE_FIX.length + 1 >= chars.length) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,13 +189,29 @@ public class ParseSqlUtil {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>解析sql指令</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @param index 指令开始下标
|
||||||
|
* @return sql指令定义信息
|
||||||
|
*/
|
||||||
private SqlCommandDefinition parseCommand(char[] chars, int index) {
|
private SqlCommandDefinition parseCommand(char[] chars, int index) {
|
||||||
SqlCommandDefinition commandDefinition = getCommandDefinition(chars, index);
|
SqlCommandDefinition commandDefinition = getCommandDefinition(chars, index);
|
||||||
|
// 值执行器执行解析操作
|
||||||
String executor = commandExecutor.executor(commandDefinition);
|
String executor = commandExecutor.executor(commandDefinition);
|
||||||
|
// 解析后的sql设置为指令内容
|
||||||
commandDefinition.setCommandContent(executor);
|
commandDefinition.setCommandContent(executor);
|
||||||
return commandDefinition;
|
return commandDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取指令定义信息</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @param index 指令开始下标
|
||||||
|
* @return 指令定义信息
|
||||||
|
*/
|
||||||
private SqlCommandDefinition getCommandDefinition(char[] chars, int index) {
|
private SqlCommandDefinition getCommandDefinition(char[] chars, int index) {
|
||||||
StringBuilder commandSb = new StringBuilder();
|
StringBuilder commandSb = new StringBuilder();
|
||||||
boolean isCommand = false;
|
boolean isCommand = false;
|
||||||
|
@ -164,6 +219,7 @@ public class ParseSqlUtil {
|
||||||
for (int i = index; i < chars.length; i++) {
|
for (int i = index; i < chars.length; i++) {
|
||||||
char c = chars[i];
|
char c = chars[i];
|
||||||
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
||||||
|
commandSb.append(" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
|
@ -190,6 +246,13 @@ public class ParseSqlUtil {
|
||||||
return CommandUtil.createCommandProperties(command, commandContent);
|
return CommandUtil.createCommandProperties(command, commandContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取指令内容</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @param index 指令内容开始下标
|
||||||
|
* @return 指令内容信息定义
|
||||||
|
*/
|
||||||
private CommandContentDefinition getCommandContent(char[] chars, int index) {
|
private CommandContentDefinition getCommandContent(char[] chars, int index) {
|
||||||
int commandSyntaxCount = 0;
|
int commandSyntaxCount = 0;
|
||||||
StringBuilder commandContent = new StringBuilder();
|
StringBuilder commandContent = new StringBuilder();
|
||||||
|
@ -198,6 +261,7 @@ public class ParseSqlUtil {
|
||||||
char c = chars[i];
|
char c = chars[i];
|
||||||
account++;
|
account++;
|
||||||
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
||||||
|
commandContent.append(" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
|
@ -238,6 +302,12 @@ public class ParseSqlUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>解析sql占位符,绑定值</h2>
|
||||||
|
*
|
||||||
|
* @param sql sql字符串
|
||||||
|
* @return 解析后sql字符串
|
||||||
|
*/
|
||||||
public String parseStatement(String sql) {
|
public String parseStatement(String sql) {
|
||||||
char[] chars = sql.toCharArray();
|
char[] chars = sql.toCharArray();
|
||||||
StringBuilder sqlBuilder = new StringBuilder();
|
StringBuilder sqlBuilder = new StringBuilder();
|
||||||
|
@ -287,6 +357,12 @@ public class ParseSqlUtil {
|
||||||
return sqlBuilder.toString();
|
return sqlBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取变量的值,通过变量名</h2>
|
||||||
|
*
|
||||||
|
* @param variable 变量名
|
||||||
|
* @return 变量值
|
||||||
|
*/
|
||||||
private Object getVariableValue(String variable) {
|
private Object getVariableValue(String variable) {
|
||||||
variable = variable.trim();
|
variable = variable.trim();
|
||||||
Map<String, Object> tempMap = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get();
|
Map<String, Object> tempMap = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get();
|
||||||
|
@ -298,6 +374,14 @@ public class ParseSqlUtil {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>判断是否属于变量占位符</h2>
|
||||||
|
*
|
||||||
|
* @param chars sql字符串char数组
|
||||||
|
* @param startIndex 开始下标
|
||||||
|
* @param variablePrefix 变量前缀
|
||||||
|
* @return 变量名称
|
||||||
|
*/
|
||||||
private String isVariable(char[] chars, int startIndex, String variablePrefix) {
|
private String isVariable(char[] chars, int startIndex, String variablePrefix) {
|
||||||
char[] prefix = variablePrefix.toCharArray();
|
char[] prefix = variablePrefix.toCharArray();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -326,4 +410,36 @@ public class ParseSqlUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取所有指令</h2>
|
||||||
|
*
|
||||||
|
* @param sql
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<SqlCommandDefinition> getCommandList(String sql) {
|
||||||
|
if (StrUtil.isBlank(sql)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<SqlCommandDefinition> result = new ArrayList<>();
|
||||||
|
char[] chars = sql.toCharArray();
|
||||||
|
for (int i = 0; i < chars.length; i++) {
|
||||||
|
char c = chars[i];
|
||||||
|
if (CommandConsTant.Skip_CHAR.contains(c)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (CommandConsTant.COMMAND_PRE_FIX_MARK == c) {
|
||||||
|
boolean isCommand = checkCommand(chars, i);
|
||||||
|
if (isCommand) {
|
||||||
|
i += CommandConsTant.COMMAND_PRE_FIX.length + 1;
|
||||||
|
// 获取sql指令定义信息
|
||||||
|
SqlCommandDefinition commandDefinition = getCommandDefinition(chars, i);
|
||||||
|
result.add(commandDefinition);
|
||||||
|
i += commandDefinition.getCommandLength();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package youhong.ai.yihong;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.mapper.ModeExpandSaveActionMapper;
|
||||||
|
import weaver.youhong.ai.yihong.formmode.stagediagram.pojo.StageUpdateFieldConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>屹宏测试</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/3/14 18:31</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class YiHongTest extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSelectMapper() {
|
||||||
|
ModeExpandSaveActionMapper mapper = Util.getMapper(ModeExpandSaveActionMapper.class);
|
||||||
|
StageUpdateFieldConfig testWrite = mapper.selectConfigUpdate("test_write");
|
||||||
|
System.out.println(JSON.toJSONString(testWrite));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue