提交 38a2e62b 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 eb7c7a36
......@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="MsgBodyResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`CONTENT`, t1.`ERRORINFO`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TEMPLPARAMS`, t1.`TOUSERS`, t1.`USERDATA`, t1.`USERDATA2` FROM `IBZMSGBODY` t1 ) t1 where msgid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`CONTENT`, t1.`ERRORINFO`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TEMPLPARAMS`, t1.`TOUSERS`, t1.`USERDATA` FROM `IBZMSGBODY` t1 ) t1 where msgid=#{id}]]>
</select>
<select id="selectById" resultMap="MsgBodyResultMap" databaseId="oracle">
<![CDATA[select t1.* from (SELECT t1.CONTENT, t1.ERRORINFO, t1.ISERROR, t1.ISSEND, t1.MSGID, t1.MSGLINK, t1.MSGNAME, t1.MSGTYPE, t1.SUBJECT, t1.TEMPLATEID, t1.TEMPLPARAMS, t1.TOUSERS, t1.USERDATA FROM IBZMSGBODY t1 ) t1 where msgid=#{id}]]>
......@@ -31,7 +31,7 @@
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`CONTENT`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TOUSERS`, t1.`USERDATA`, t1.`USERDATA2` FROM `IBZMSGBODY` t1
<![CDATA[ SELECT t1.`CONTENT`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TOUSERS`, t1.`USERDATA` FROM `IBZMSGBODY` t1
]]>
</sql>
<!--数据查询[Default]-->
......@@ -41,7 +41,7 @@
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`CONTENT`, t1.`ERRORINFO`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TEMPLPARAMS`, t1.`TOUSERS`, t1.`USERDATA`, t1.`USERDATA2` FROM `IBZMSGBODY` t1
<![CDATA[ SELECT t1.`CONTENT`, t1.`ERRORINFO`, t1.`ISERROR`, t1.`ISSEND`, t1.`MSGID`, t1.`MSGLINK`, t1.`MSGNAME`, t1.`MSGTYPE`, t1.`SUBJECT`, t1.`TEMPLATEID`, t1.`TEMPLPARAMS`, t1.`TOUSERS`, t1.`USERDATA` FROM `IBZMSGBODY` t1
]]>
</sql>
<!--数据查询[View]-->
......
......@@ -18,6 +18,9 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
......@@ -109,7 +112,8 @@ public class VersionCheckAspect
*/
@SneakyThrows
private Object getDBVersion(VersionCheck versionCheck,Object service,Object id){
Object dbVersion=null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp dbVersion=null;
String versionField=versionCheck.versionfield();
if(!ObjectUtils.isEmpty(service)){
EvaluationContext oldContext = new StandardEvaluationContext();
......@@ -117,7 +121,12 @@ public class VersionCheckAspect
oldContext.setVariable("id",id);
Expression oldExp = parser.parseExpression("#service.get(#id)");
EntityBase oldEntity =oldExp.getValue(oldContext, EntityBase.class);
return oldEntity.get(versionField);
Object oldDate=oldEntity.get(versionField);
if(oldDate!=null && oldDate instanceof Timestamp){
Timestamp db_time= (Timestamp) oldDate;
Date db_date = sdf.parse(sdf.format(db_time));
dbVersion=new Timestamp(db_date.getTime());
}
}
return dbVersion;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册