提交 68c7a768 编写于 作者: hebao@lab.ibiz5.com's avatar hebao@lab.ibiz5.com

Merge remote-tracking branch 'origin/master'

......@@ -539,7 +539,7 @@ public class ModelObj extends DataObj<String,Object> {
private Object execFunc(String exp)
{
exp=exp.replace("%", "").trim();
if(exp.startsWith("DAY("))
if(exp.toUpperCase().startsWith("DAY("))
{
Calendar calendar = Calendar.getInstance();
String quStr=exp.substring(exp.indexOf("(")+1,exp.indexOf(")"));
......@@ -552,6 +552,32 @@ public class ModelObj extends DataObj<String,Object> {
calendar.add(Calendar.DATE, day);
return new Timestamp(calendar.getTime().getTime());
}
else if(exp.toUpperCase().startsWith("MONTH("))
{
Calendar calendar = Calendar.getInstance();
String quStr=exp.substring(exp.indexOf("(")+1,exp.indexOf(")"));
quStr=quStr.replace("+","").trim();
int month=0;
if(!StringUtils.isEmpty(quStr)){
month= Integer.parseInt(quStr);
}
calendar.add(Calendar.MONTH, month);
return new Timestamp(calendar.getTime().getTime());
}
else if(exp.toUpperCase().startsWith("YEAR("))
{
Calendar calendar = Calendar.getInstance();
String quStr=exp.substring(exp.indexOf("(")+1,exp.indexOf(")"));
quStr=quStr.replace("+","").trim();
int year=0;
if(!StringUtils.isEmpty(quStr)){
year= Integer.parseInt(quStr);
}
calendar.add(Calendar.MONTH, year);
return new Timestamp(calendar.getTime().getTime());
}
else if(exp.endsWith(")"))
{
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册