fix deal whti maping bug rs 大小写
parent
bbcd42e79f
commit
7e6fa007e0
|
@ -13,5 +13,8 @@ import java.lang.annotation.*;
|
|||
@Target(ElementType.METHOD)
|
||||
@Documented
|
||||
public @interface AssociationMethod {
|
||||
|
||||
int value();
|
||||
|
||||
String desc() default "";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.customization.youhong.taibao.trisubreq.impl;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
|
||||
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
|
||||
|
@ -12,6 +13,7 @@ import org.apache.log4j.Logger;
|
|||
import weaver.workflow.request.DiffWfTriggerSetting;
|
||||
import weaver.workflow.request.SameWfTriggerSetting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -58,10 +60,27 @@ public class TriSubRequestAfterInterceptImpl extends AbstractServiceProxy implem
|
|||
value -> value
|
||||
));
|
||||
|
||||
List<Map<String, Object>> requestDataList = new ArrayList<>();
|
||||
for (SubRequestEntity subRequestEntity : subRequestEntities) {
|
||||
// 查询流程对应的配置信息
|
||||
String workflowId = subRequestEntity.getWorkflowId();
|
||||
SubRequestToDataConfig subRequestToDataConfig = collect.get(workflowId);
|
||||
Map<String, Object> requestData = getRequestData(subRequestEntity);
|
||||
requestDataList.add(requestData);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(requestDataList)) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> mainRequestData = mapper.selectRequestBase(Util.null2String(i));
|
||||
|
||||
}
|
||||
|
||||
private Map<String, Object> getRequestData(SubRequestEntity subRequestEntity) {
|
||||
String tableName = subRequestEntity.getWorkflowTable();
|
||||
Map<String, Object> requestData = mapper.selectWorkflowData(tableName, subRequestEntity.getRequestId());
|
||||
Map<String, Object> requestBaseData = mapper.selectRequestBase(subRequestEntity.getRequestId());
|
||||
if (CollectionUtil.isEmpty(requestBaseData)) {
|
||||
throw new CustomerException("查询流程基本信息失败!");
|
||||
}
|
||||
requestBaseData.putAll(requestData);
|
||||
return requestBaseData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataCo
|
|||
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataMapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1>sql查询</h1>
|
||||
|
@ -25,8 +26,26 @@ public interface TriSubRequestAfterMapper {
|
|||
*/
|
||||
@Select("select requestid request_id,workflowid workflow_id from " +
|
||||
"workflow_requestbase where mainrequestid = #{mainRequestId}")
|
||||
@Associations({
|
||||
@Association(
|
||||
property = "workflowTable",
|
||||
column = "workflowid",
|
||||
id = @Id(value = String.class, methodId = 2)
|
||||
)
|
||||
})
|
||||
List<SubRequestEntity> selectSubRequestByMainRequest(@ParamMapper("mainRequestId") Integer mainRequestId);
|
||||
|
||||
/**
|
||||
* <h2>查询流程表名</h2>
|
||||
*
|
||||
* @param billId 流程表id
|
||||
* @return 流程表
|
||||
*/
|
||||
@Select("select tablename workflow_table from workflow_base wb\n" +
|
||||
"inner join workflow_table_view wv on wv.id = wb.id\n" +
|
||||
"where wb.id = #{billId}")
|
||||
@AssociationMethod(value = 2, desc = "查询流程对应的表表名")
|
||||
String selectWorkflowTable(@ParamMapper("billId") String billId);
|
||||
|
||||
/**
|
||||
* <h2>查询配置表信息</h2>
|
||||
|
@ -76,4 +95,22 @@ public interface TriSubRequestAfterMapper {
|
|||
})
|
||||
List<SubRequestToDataMapping> selectConfigDt(String mainId);
|
||||
|
||||
/**
|
||||
* <h2>查询流程数据</h2>
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @param requestId 请求id
|
||||
* @return 流程数据
|
||||
*/
|
||||
@Select("select $t{tableName} where requestid = #{requestId}")
|
||||
Map<String, Object> selectWorkflowData(@ParamMapper("tableName") String tableName, @ParamMapper("requestId") String requestId);
|
||||
|
||||
/**
|
||||
* <h2>查询流程信息</h2>
|
||||
*
|
||||
* @param requestId 流程id
|
||||
* @return 流程信息
|
||||
*/
|
||||
@Select("select * from workflow_requestbase where requestid = #{requestId}")
|
||||
Map<String, Object> selectRequestBase(@ParamMapper("requestId") String requestId);
|
||||
}
|
||||
|
|
|
@ -20,4 +20,7 @@ public class SubRequestEntity {
|
|||
private String requestId;
|
||||
@SqlOracleDbFieldAnn("WORKFLOW_ID")
|
||||
private String workflowId;
|
||||
|
||||
@SqlOracleDbFieldAnn("WORKFLOW_TABLE")
|
||||
private String workflowTable;
|
||||
}
|
||||
|
|
|
@ -114,19 +114,23 @@ public class DealWithMapping extends ToolUtil {
|
|||
|| "NUMBER".equalsIgnoreCase(type) || "INTEGER".equalsIgnoreCase(type)
|
||||
|| "TINYINT".equalsIgnoreCase(type) || "SMALLINT".equalsIgnoreCase(type)) {
|
||||
map.put(key, rs.getInt(i) == -1 ? rs.getString(i) : rs.getInt(i));
|
||||
map.put(key.toLowerCase(), rs.getInt(i) == -1 ? rs.getString(i) : rs.getInt(i));
|
||||
continue;
|
||||
}
|
||||
if ("FLOAT".equalsIgnoreCase(type)) {
|
||||
map.put(key, rs.getFloat(i));
|
||||
map.put(key.toLowerCase(), rs.getFloat(i));
|
||||
continue;
|
||||
}
|
||||
if ("DATE".equalsIgnoreCase(type) || "TIMESTAMP".equalsIgnoreCase(type)
|
||||
|| "DATETIME".equalsIgnoreCase(type)) {
|
||||
map.put(key, rs.getString(i));
|
||||
map.put(key.toLowerCase(), rs.getString(i));
|
||||
continue;
|
||||
}
|
||||
if ("DOUBLE".equalsIgnoreCase(type)) {
|
||||
map.put(key, Util.getDoubleValue(rs.getString(i)));
|
||||
map.put(key.toLowerCase(), Util.getDoubleValue(rs.getString(i)));
|
||||
continue;
|
||||
}
|
||||
if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) {
|
||||
|
@ -143,10 +147,12 @@ public class DealWithMapping extends ToolUtil {
|
|||
decimal = new BigDecimal(val);
|
||||
}
|
||||
map.put(key, decimal);
|
||||
map.put(key.toLowerCase(), decimal);
|
||||
// map.put(key, rs.getDouble(i));
|
||||
continue;
|
||||
}
|
||||
map.put(key, rs.getString(i));
|
||||
map.put(key.toLowerCase(), rs.getString(i));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue