From 2ea391e8144ce7b7ccccb4c367c302590f79d4a1 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Mon, 20 Mar 2023 14:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BC=A0=E9=80=92=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../youhong.ai/pcn/workflow_code_block.js | 30 +++---- .../annotation/recordset/BatchSqlArgs.java | 3 +- .../java/aiyh/utils/recordset/SqlHandler.java | 4 +- .../ai/mymapper/proxy/MapperProxyExecute.java | 25 ++++-- .../ai/mymapper/proxy/MyMapperProxy.java | 13 +-- .../proxy/entity/SqlAndExecuteType.java | 6 ++ .../ai/mymapper/{ => test}/ParseSqlTest.java | 17 +++- .../ai/mymapper/test/TestMayMapper.java | 20 +++++ .../youhong/ai/mymapper/util/CommandUtil.java | 2 +- .../ai/mymapper/util/ParseSqlUtil.java | 18 ++-- .../ai/mymapper/util/ResultMapperUtil.java | 89 ++++++++++++++----- 11 files changed, 169 insertions(+), 58 deletions(-) rename src/test/java/youhong/ai/mymapper/{ => test}/ParseSqlTest.java (87%) create mode 100644 src/test/java/youhong/ai/mymapper/test/TestMayMapper.java diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js index 9212a06..ac558a7 100644 --- a/javascript/youhong.ai/pcn/workflow_code_block.js +++ b/javascript/youhong.ai/pcn/workflow_code_block.js @@ -586,25 +586,25 @@ $(() => { } } - let date = new Date() - let month = date.getMonth() + 1 + let date = new Date(); + let month = date.getMonth() + 1; let year = date.getFullYear(); - let n = window.prompt("请输入日期:", date.getDate().toString()) - let workDate = year + "-" + fillNum(month) + "-" + fillNum(n) - n = fillNum(n) - WfForm.changeFieldValue("field607", {value: workDate}) + let n = window.prompt("请输入日期:", date.getDate().toString()); + let workDate = year + "-" + fillNum(month) + "-" + fillNum(n); + n = fillNum(n); + WfForm.changeFieldValue("field607", {value: workDate}); let workflowTitle = WfForm.getFieldValue("field-1"); - WfForm.changeFieldValue("field-1", {value: workflowTitle.substring(0, workflowTitle.length - 2) + n}) - WfForm.changeFieldValue("field609", {value: workDate}) - WfForm.changeFieldValue("field608", {value: "00:00"}) - WfForm.changeFieldValue("field610", {value: "23:59"}) - WfForm.changeFieldValue("field30038", {value: 0}) - WfForm.changeFieldValue("field611", {value: "出差"}) - WfForm.changeFieldValue("field8715", {value: "2"}) - $("button[ecid='_Route@vmt0lk_Comp@upn4fo_FormContent@g9f33k_MainLayout@kdmfyn_LayoutTr@ds2cqb@main_0_CellType@27chqt@main_17_10_FieldContent@r045n3_BrowserElement@2mq6lm_WeaBrowser@j1zg9h_WrappedComponent@i9q2c5_Component@iiw91q_Associative@zt8qgk_Button@ztqsd2_button@xq1ea3']").trigger("click") + WfForm.changeFieldValue("field-1", {value: workflowTitle.substring(0, workflowTitle.length - 2) + n}); + WfForm.changeFieldValue("field609", {value: workDate}); + WfForm.changeFieldValue("field608", {value: "00:00"}); + WfForm.changeFieldValue("field610", {value: "23:59"}); + WfForm.changeFieldValue("field30038", {value: 0}); + WfForm.changeFieldValue("field611", {value: "出差"}); + WfForm.changeFieldValue("field8715", {value: "2"}); + $("button[ecid='_Route@vmt0lk_Comp@upn4fo_FormContent@g9f33k_MainLayout@kdmfyn_LayoutTr@ds2cqb@main_0_CellType@27chqt@main_17_10_FieldContent@r045n3_BrowserElement@2mq6lm_WeaBrowser@j1zg9h_WrappedComponent@i9q2c5_Component@iiw91q_Associative@zt8qgk_Button@ztqsd2_button@xq1ea3']").trigger("click"); WfForm.registerCheckEvent(WfForm.OPER_CLOSE, function (callback) { setTimeout(() => { - window.location.href = "/spa/workflow/static4form/index.html#/main/workflow/req?iscreate=1&workflowid=746" + window.location.href = "/spa/workflow/static4form/index.html#/main/workflow/req?iscreate=1&workflowid=746"; }, 500) }); })() diff --git a/src/main/java/aiyh/utils/annotation/recordset/BatchSqlArgs.java b/src/main/java/aiyh/utils/annotation/recordset/BatchSqlArgs.java index 41e7d00..ded5323 100644 --- a/src/main/java/aiyh/utils/annotation/recordset/BatchSqlArgs.java +++ b/src/main/java/aiyh/utils/annotation/recordset/BatchSqlArgs.java @@ -14,5 +14,6 @@ import java.lang.annotation.*; @Target(ElementType.PARAMETER) @Documented public @interface BatchSqlArgs { - + + String value() default ""; } diff --git a/src/main/java/aiyh/utils/recordset/SqlHandler.java b/src/main/java/aiyh/utils/recordset/SqlHandler.java index 61c146b..7049cbf 100644 --- a/src/main/java/aiyh/utils/recordset/SqlHandler.java +++ b/src/main/java/aiyh/utils/recordset/SqlHandler.java @@ -32,6 +32,7 @@ public class SqlHandler { List batchSqlArgsList = new ArrayList(); + String batchSqlName = "item"; private final Object batchObj = null; @@ -58,7 +59,7 @@ public class SqlHandler { if (!batchSqlArgsList.isEmpty()) { for (Object o1 : batchSqlArgsList) { Map map = new HashMap<>(8); - map.put("item", o1); + map.put(batchSqlName, o1); map.putAll((Map) o); parse = parse(findSql, map); List tempArgs = new ArrayList<>(); @@ -142,6 +143,7 @@ public class SqlHandler { if (batchSqlArgs != null) { try { this.batchSqlArgsList = (List) arg; + batchSqlName = batchSqlArgs.value(); } catch (Exception e) { throw new BindingException("can not parse batchSqlArgs for " + parameter.getName() + ", param index is " + i); } diff --git a/src/test/java/youhong/ai/mymapper/proxy/MapperProxyExecute.java b/src/test/java/youhong/ai/mymapper/proxy/MapperProxyExecute.java index d86ae84..7103ab0 100644 --- a/src/test/java/youhong/ai/mymapper/proxy/MapperProxyExecute.java +++ b/src/test/java/youhong/ai/mymapper/proxy/MapperProxyExecute.java @@ -12,6 +12,7 @@ import youhong.ai.mymapper.command.constant.CommandConsTant; import youhong.ai.mymapper.command.entity.SqlDefinition; import youhong.ai.mymapper.proxy.entity.SqlAndExecuteType; import youhong.ai.mymapper.proxy.entity.SqlDbTypeMapping; +import youhong.ai.mymapper.util.FormatSqlUtil; import youhong.ai.mymapper.util.ParseSqlUtil; import java.lang.annotation.Annotation; @@ -33,10 +34,10 @@ import java.util.function.Function; public class MapperProxyExecute { private final Logger logger = Util.getLogger(); - private final List> SELECT_LIST = Arrays.asList(Select.class, SelectOracle.class); - private final List> UPDATE_LIST = Arrays.asList(Update.class, UpdateOracle.class); - private final List> DELETE_LIST = Arrays.asList(Delete.class, DeleteOracle.class); - private final List> INSERT_LIST = Arrays.asList(Insert.class, InsertOracle.class); + private final List> SELECT_LIST = Arrays.asList(Select.class, SelectOracle.class); + private final List> UPDATE_LIST = Arrays.asList(Update.class, UpdateOracle.class); + private final List> DELETE_LIST = Arrays.asList(Delete.class, DeleteOracle.class); + private final List> INSERT_LIST = Arrays.asList(Insert.class, InsertOracle.class); private static final Map INSERT_MAP = new HashMap<>(); private static final Map SELECT_MAP = new HashMap<>(); @@ -86,6 +87,9 @@ public class MapperProxyExecute { sqlAndExecuteType.setArgs(parse.getArgs()); sqlAndExecuteType.setSql(parse.getSql()); sqlAndExecuteType.setRecordSet(rs); + logger.info(Util.logStr("{}.{} execute sql : \n{}\nargs:{}", + method.getDeclaringClass(), method.getName(), + FormatSqlUtil.formatSql(sqlAndExecuteType.getSql()), sqlAndExecuteType.getArgs())); return SqlExecutor.execute(sqlAndExecuteType); } @@ -97,19 +101,20 @@ public class MapperProxyExecute { private SqlAndExecuteType getSqlStr(String dbType, Method method, Object[] args) { Annotation[] annotations = method.getAnnotations(); for (Annotation annotation : annotations) { - if (SELECT_LIST.contains(annotation.getClass())) { + Class annotationClass = annotation.annotationType(); + if (SELECT_LIST.contains(annotationClass)) { // select 处理 return selectSql(dbType, method, args); } - if (UPDATE_LIST.contains(annotation.getClass())) { + if (UPDATE_LIST.contains(annotationClass)) { // update 处理 return updateSql(dbType, method, args); } - if (DELETE_LIST.contains(annotation.getClass())) { + if (DELETE_LIST.contains(annotationClass)) { // delete 处理 return deleteSql(dbType, method, args); } - if (INSERT_LIST.contains(annotation.getClass())) { + if (INSERT_LIST.contains(annotationClass)) { // insert 处理 return insertSql(dbType, method, args); } @@ -127,6 +132,7 @@ public class MapperProxyExecute { SqlAndExecuteType sqlAndExecuteType = new SqlAndExecuteType(); sqlAndExecuteType.setSql(sql); sqlAndExecuteType.setType(CommandConsTant.INSERT_SQL); + sqlAndExecuteType.setExecuteType(CommandConsTant.SELECT_SQL); return sqlAndExecuteType; } @@ -139,6 +145,7 @@ public class MapperProxyExecute { SqlAndExecuteType sqlAndExecuteType = new SqlAndExecuteType(); sqlAndExecuteType.setSql(sql); sqlAndExecuteType.setType(CommandConsTant.DELETE_SQL); + sqlAndExecuteType.setExecuteType(CommandConsTant.SELECT_SQL); return sqlAndExecuteType; } @@ -151,6 +158,7 @@ public class MapperProxyExecute { SqlAndExecuteType sqlAndExecuteType = new SqlAndExecuteType(); sqlAndExecuteType.setSql(sql); sqlAndExecuteType.setType(CommandConsTant.UPDATE_SQL); + sqlAndExecuteType.setExecuteType(CommandConsTant.SELECT_SQL); return sqlAndExecuteType; } @@ -163,6 +171,7 @@ public class MapperProxyExecute { SqlAndExecuteType sqlAndExecuteType = new SqlAndExecuteType(); sqlAndExecuteType.setSql(sql); sqlAndExecuteType.setType(CommandConsTant.SELECT_SQL); + sqlAndExecuteType.setExecuteType(CommandConsTant.SELECT_SQL); return sqlAndExecuteType; } diff --git a/src/test/java/youhong/ai/mymapper/proxy/MyMapperProxy.java b/src/test/java/youhong/ai/mymapper/proxy/MyMapperProxy.java index f576d57..2526484 100644 --- a/src/test/java/youhong/ai/mymapper/proxy/MyMapperProxy.java +++ b/src/test/java/youhong/ai/mymapper/proxy/MyMapperProxy.java @@ -55,12 +55,13 @@ public class MyMapperProxy implements InvocationHandler { if (!"".equals(name) && null != name) { mapperKey += "." + name; } - RecordSet rs = rsManager.getRs(mapperKey); + RecordSetTrans rs = rsManager.getTrans(mapperKey); if (rs == null) { - rsManager.setRecordSet(mapperKey); - rs = rsManager.getRs(mapperKey); + rsManager.setRecordSetTrans(mapperKey); + rs = rsManager.getTrans(mapperKey); } return mapperProxyExecute.execute(rs, method, args); + } /** @@ -76,10 +77,10 @@ public class MyMapperProxy implements InvocationHandler { if (!"".equals(name) && null != name) { mapperKey += "." + name; } - RecordSetTrans rs = rsManager.getTrans(mapperKey); + RecordSet rs = rsManager.getRs(mapperKey); if (rs == null) { - rsManager.setRecordSetTrans(mapperKey); - rs = rsManager.getTrans(mapperKey); + rsManager.setRecordSet(mapperKey); + rs = rsManager.getRs(mapperKey); } return mapperProxyExecute.execute(rs, method, args); } diff --git a/src/test/java/youhong/ai/mymapper/proxy/entity/SqlAndExecuteType.java b/src/test/java/youhong/ai/mymapper/proxy/entity/SqlAndExecuteType.java index f5d2c3e..df8f134 100644 --- a/src/test/java/youhong/ai/mymapper/proxy/entity/SqlAndExecuteType.java +++ b/src/test/java/youhong/ai/mymapper/proxy/entity/SqlAndExecuteType.java @@ -21,20 +21,26 @@ import java.util.List; @ToString public class SqlAndExecuteType { + /** slq */ private String sql; + /** sql类型 */ private String type; private List args; + /** 执行类型 */ private String executeType; + /** 方法 */ private Method method; + /** rs */ private RecordSet recordSet; private RecordSetTrans recordSetTrans; + /** 是否是事务 */ private boolean trans; } diff --git a/src/test/java/youhong/ai/mymapper/ParseSqlTest.java b/src/test/java/youhong/ai/mymapper/test/ParseSqlTest.java similarity index 87% rename from src/test/java/youhong/ai/mymapper/ParseSqlTest.java rename to src/test/java/youhong/ai/mymapper/test/ParseSqlTest.java index 56f99a2..7a26300 100644 --- a/src/test/java/youhong/ai/mymapper/ParseSqlTest.java +++ b/src/test/java/youhong/ai/mymapper/test/ParseSqlTest.java @@ -1,12 +1,16 @@ -package youhong.ai.mymapper; +package youhong.ai.mymapper.test; import basetest.BaseTest; import com.alibaba.fastjson.JSON; +import com.api.youhong.ai.taibao.fcuntionlist.mapper.FunctionListMapper; +import com.api.youhong.ai.taibao.fcuntionlist.pojo.FunctionListConfigItem; import org.junit.Test; +import youhong.ai.mymapper.MyMapper; import youhong.ai.mymapper.command.entity.SqlDefinition; import youhong.ai.mymapper.util.ParseSqlUtil; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -119,4 +123,15 @@ public class ParseSqlTest extends BaseTest { String[] strs = new String[0]; System.out.println(strs.getClass().getComponentType()); } + + + @Test + public void testMyMapper() { + // TestMayMapper mapper = MyMapper.getMapper(TestMayMapper.class); + // System.out.println(mapper.selectTest()); + + FunctionListMapper mapper = MyMapper.getMapper(FunctionListMapper.class); + List functionListConfigItems = mapper.selectFunctionListAll(); + System.out.println(JSON.toJSONString(functionListConfigItems)); + } } diff --git a/src/test/java/youhong/ai/mymapper/test/TestMayMapper.java b/src/test/java/youhong/ai/mymapper/test/TestMayMapper.java new file mode 100644 index 0000000..7aca040 --- /dev/null +++ b/src/test/java/youhong/ai/mymapper/test/TestMayMapper.java @@ -0,0 +1,20 @@ +package youhong.ai.mymapper.test; + +import aiyh.utils.annotation.recordset.Select; +import aiyh.utils.annotation.recordset.SqlMapper; + +import java.util.Map; + +/** + *

测试

+ * + *

create: 2023/3/18 19:11

+ * + * @author youHong.ai + */ +@SqlMapper +public interface TestMayMapper { + + @Select("select COMPANYNAME,LICENSE,EXPIREDATE,CVERSION from license") + Map selectTest(); +} diff --git a/src/test/java/youhong/ai/mymapper/util/CommandUtil.java b/src/test/java/youhong/ai/mymapper/util/CommandUtil.java index 4adb78a..6cc0d6c 100644 --- a/src/test/java/youhong/ai/mymapper/util/CommandUtil.java +++ b/src/test/java/youhong/ai/mymapper/util/CommandUtil.java @@ -1,12 +1,12 @@ package youhong.ai.mymapper.util; import aiyh.utils.excention.CustomerException; -import youhong.ai.mymapper.ParseSqlTest; 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.CommandContentDefinition; import youhong.ai.mymapper.command.entity.SqlCommandDefinition; +import youhong.ai.mymapper.test.ParseSqlTest; import java.io.File; import java.util.*; diff --git a/src/test/java/youhong/ai/mymapper/util/ParseSqlUtil.java b/src/test/java/youhong/ai/mymapper/util/ParseSqlUtil.java index 8fbd58b..ac00230 100644 --- a/src/test/java/youhong/ai/mymapper/util/ParseSqlUtil.java +++ b/src/test/java/youhong/ai/mymapper/util/ParseSqlUtil.java @@ -2,6 +2,7 @@ package youhong.ai.mymapper.util; 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.constant.CommandConsTant; @@ -9,10 +10,7 @@ import youhong.ai.mymapper.command.entity.CommandContentDefinition; import youhong.ai.mymapper.command.entity.SqlCommandDefinition; import youhong.ai.mymapper.command.entity.SqlDefinition; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; /** *

解析sql工具

@@ -25,9 +23,11 @@ public class ParseSqlUtil { public final static ThreadLocal> PARSE_PARAM_LOCALE = new ThreadLocal<>(); - public final static ThreadLocal> PARSE_TEMP_PARAM_LOCALE = new ThreadLocal<>(); + public final static ThreadLocal> PARSE_TEMP_PARAM_LOCALE = ThreadLocal.withInitial(HashMap::new); public final static ThreadLocal> SQL_PARAM_LOCALE = new ThreadLocal<>(); + public final static ThreadLocal> PARAMS_ASS_LOCALE = ThreadLocal.withInitial(HashMap::new); + private final CommandExecutor commandExecutor = new CommandExecutor(); /** @@ -347,6 +347,7 @@ public class ParseSqlUtil { if (!Objects.isNull(variable)) { i += CommandConsTant.VARIABLE_PREPARED_STATEMENT.length() + variable.length(); Object value = getVariableValue(variable); + sqlBuilder.append("?"); ParseSqlUtil.SQL_PARAM_LOCALE.get().add(ParamValueUtil.getPreparedParam(value)); } @@ -367,10 +368,17 @@ public class ParseSqlUtil { variable = variable.trim(); Map tempMap = ParseSqlUtil.PARSE_TEMP_PARAM_LOCALE.get(); Map paramMap = ParseSqlUtil.PARSE_PARAM_LOCALE.get(); + Map assParam = ParseSqlUtil.PARAMS_ASS_LOCALE.get(); + Object value = ParamValueUtil.getValueByKeyStr(variable, tempMap); if (Objects.isNull(value)) { value = ParamValueUtil.getValueByKeyStr(variable, paramMap); } + if (Objects.isNull(value)) { + if (!CollectionUtil.isEmpty(assParam) && assParam.size() == 2) { + value = assParam.entrySet().stream().findFirst().get().getValue(); + } + } return value; } diff --git a/src/test/java/youhong/ai/mymapper/util/ResultMapperUtil.java b/src/test/java/youhong/ai/mymapper/util/ResultMapperUtil.java index 6f27b03..5942865 100644 --- a/src/test/java/youhong/ai/mymapper/util/ResultMapperUtil.java +++ b/src/test/java/youhong/ai/mymapper/util/ResultMapperUtil.java @@ -40,13 +40,16 @@ public class ResultMapperUtil { return null; } if (Map.class.isAssignableFrom(returnType)) { - return getMap(recordSet, method, method.getGenericReturnType()); + if (recordSet.next()) { + return getMap(recordSet, method, method.getGenericReturnType()); + } + return null; } if (List.class.isAssignableFrom(returnType)) { return getList(recordSet, method); } if (recordSet.next()) { - return getBean(recordSet, method); + return getBean(recordSet, method, method.getReturnType()); } return null; } @@ -92,7 +95,7 @@ public class ResultMapperUtil { } } else { while (recordSet.next()) { - result.add(getBean(recordSet, method)); + result.add(getBean(recordSet, method, componentType)); } } if (result.size() > 0) { @@ -115,7 +118,7 @@ public class ResultMapperUtil { if (i == 0) { keyClass = (Class) types[i]; } - if (i == 2) { + if (i == 1) { valueClass = (Class) types[i]; } } @@ -249,13 +252,15 @@ public class ResultMapperUtil { } return result; } - // java bean 类型 - while (recordSet.next()) { - Object bean = getBean(recordSet, method); - result.add(bean); - } - return result; + } + // java bean 类型 + while (recordSet.next()) { + Object bean = getBean(recordSet, method, (Class) actualTypeArgument); + result.add(bean); + } + return result; + } else { throw new CustomerException("can not get generic type!"); } @@ -263,8 +268,7 @@ public class ResultMapperUtil { throw new CustomerException("Return value of position type, unable to obtain method return generic type."); } - private Object getBean(RecordSet recordSet, Method method) { - Class returnType = method.getReturnType(); + private Object getBean(RecordSet recordSet, Method method, Class returnType) { BeanInfo beanInfo = null; try { beanInfo = Introspector.getBeanInfo(returnType, Object.class); @@ -478,10 +482,29 @@ public class ResultMapperUtil { throw new CustomerException("can not set result, CollectionMappings annotation only support result of list! Do you want to use @Associations!"); } } - Object o = myMapperProxy.invokeRs(null, innerMethod, new Object[]{parseValue}, method.getName()); - result.setParse(true); - result.setValue(o); - result.setProperty(property); + Map assParam = ParseSqlUtil.PARAMS_ASS_LOCALE.get(); + if (Objects.isNull(assParam)) { + Map value = new HashMap<>(); + value.put("var0", parseValue); + value.put("param0", parseValue); + ParseSqlUtil.PARAMS_ASS_LOCALE.set(value); + } else { + assParam.put("var0", parseValue); + assParam.put("param0", parseValue); + } + try { + Object o = myMapperProxy.invokeRs(null, innerMethod, new Object[]{parseValue}, method.getName()); + result.setParse(true); + result.setValue(o); + result.setProperty(property); + } catch (Exception e) { + throw new CustomerException(e); + } finally { + if (Objects.nonNull(ParseSqlUtil.PARAMS_ASS_LOCALE.get())) { + ParseSqlUtil.PARAMS_ASS_LOCALE.remove(); + } + } + } } } @@ -517,14 +540,37 @@ public class ResultMapperUtil { throw new CustomerException("can not set result, CollectionMappings annotation only support result of list! Do you want to use @Associations!"); } } - Object o = myMapperProxy.invokeRs(null, associationMethod, new Object[]{parseValue}, method.getName()); - result.setParse(true); - result.setValue(o); - result.setProperty(property); + Map assParam = ParseSqlUtil.PARAMS_ASS_LOCALE.get(); + if (Objects.isNull(assParam)) { + Map value = new HashMap<>(); + value.put("var0", parseValue); + value.put("param0", parseValue); + ParseSqlUtil.PARAMS_ASS_LOCALE.set(value); + } else { + assParam.put("var0", parseValue); + assParam.put("param0", parseValue); + } + try { + Object o = myMapperProxy.invokeRs(null, associationMethod, new Object[]{parseValue}, method.getName()); + result.setParse(true); + result.setValue(o); + result.setProperty(property); + } catch (Exception e) { + throw new CustomerException(e); + } finally { + if (Objects.nonNull(ParseSqlUtil.PARAMS_ASS_LOCALE.get())) { + ParseSqlUtil.PARAMS_ASS_LOCALE.remove(); + } + } } private Object primitiveParseValue(Class aclass, Object obj) { + + if (Objects.isNull(aclass)) { + throw new CustomerException("target class type is not be null"); + } + if (Number.class.isAssignableFrom(aclass)) { return parseNumber(aclass, obj); } @@ -534,6 +580,9 @@ public class ResultMapperUtil { if (Character.class.isAssignableFrom(aclass) || char.class.isAssignableFrom(aclass)) { return obj == null ? null : String.valueOf(obj).charAt(0); } + if (Object.class.isAssignableFrom(aclass)) { + return obj; + } throw new CustomerException("can not definition conversion rule of " + aclass); }