Commit 18a2664d by s_guodong

时间格式转换

parent 9cddcd4b
......@@ -15,6 +15,7 @@ import com.brilliance.mda.support.mybatis.dync.mapper.DbExecuteMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jdk.nashorn.internal.ir.annotations.Ignore;
import oracle.sql.TIMESTAMP;
import org.apache.commons.beanutils.MethodUtils;
import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
......@@ -309,27 +310,29 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
method.invoke(module, ((BigDecimal) fieldVal).intValue());
} else {
//如果是CLOB类型的数据,将数据转换为String
if(fieldVal instanceof oracle.sql.CLOB){
try(Reader rsReader = ((oracle.sql.CLOB)fieldVal).getCharacterStream()){
char [] chs = new char[2048];
if (fieldVal instanceof oracle.sql.CLOB) {
try (Reader rsReader = ((oracle.sql.CLOB) fieldVal).getCharacterStream()) {
char[] chs = new char[2048];
StringBuffer sb = new StringBuffer();
int i =0;
while((i=rsReader.read(chs))!=-1) {
sb.append(chs,0,i);
int i = 0;
while ((i = rsReader.read(chs)) != -1) {
sb.append(chs, 0, i);
}
System.out.println("clob to string >>"+sb.toString());
System.out.println("clob to string >>" + sb.toString());
method.invoke(module, sb.toString());
}catch (Exception e) {
log.error("执行方法{}时CLOB类型数据转String异常",methodName);
} catch (Exception e) {
log.error("执行方法{}时CLOB类型数据转String异常", methodName);
}
}else {
} else if (fieldVal instanceof TIMESTAMP) {
TIMESTAMP a = (TIMESTAMP) fieldVal;
fieldVal = a.dateValue();
method.invoke(module, fieldVal);
} else {
method.invoke(module, fieldVal);
}
}
}
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
log.info("类{}中,根据方法名{},入参类型{}未找到方法", iModule.getDataClass().getName(), methodName, field.getType());
throw new RuleExecuteException("执行方法出错", e);
......@@ -340,6 +343,8 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
log.error("类{}执行方法{},需要入参类型{},实际传入参数类型{}", iModule.getDataClass().getName(), methodName,
field.getType(), fieldVal.getClass().getName());
throw new RuleExecuteException("执行方法出错", e);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment