提交 167bcb0c 编写于 作者: Crimson's avatar Crimson

时间/日期格式的数据追加format方法,返回format后的日期String

上级 9b8772a9
......@@ -10,6 +10,7 @@ import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
......@@ -209,6 +210,8 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
<#assign prvateCodeName = srfcaseformat(defield.getCodeName(),'l_u2lC') >
<#assign publicCodeName = prvateCodeName?cap_first >
<#assign jsonfield = defield.getCodeName()?lower_case >
<#assign defieldIsDate=false>
<#assign defieldFormatStr="">
<#if defield.isPhisicalDEField()==true && defield.isKeyDEField()==false && defDataType!='ONE2MANYDATA'>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
<#else >
......@@ -219,6 +222,29 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
this.${prvateCodeName} = ${prvateCodeName} ;
this.modify("${columnname}",${prvateCodeName});
}
<#if defDataType == "DATETIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS">
<#elseif defDataType == "DATE" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td">
<#elseif defDataType == "TIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tH:%1$tM:%1$tS">
</#if>
<#if defieldIsDate && defieldFormatStr != "">
/**
* 格式化日期 [${defield.getLogicName()}]
*/
public String format${publicCodeName}(){
if (this.${prvateCodeName} == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("defieldFormatStr");
return sdf.format(${prvateCodeName});
}
</#if>
</#if>
</#if>
</#list>
......@@ -552,6 +578,8 @@ public class ${item.getCodeName()} extends EntityClient implements Serializable
<#assign prvateCodeName = srfcaseformat(defield.getCodeName(),'l_u2lC') >
<#assign publicCodeName = prvateCodeName?cap_first >
<#assign jsonfield = defield.getCodeName()?lower_case >
<#assign defieldIsDate=false>
<#assign defieldFormatStr="">
<#if defield.isPhisicalDEField()==true && defield.isKeyDEField()==false && defDataType!='ONE2MANYDATA'>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
<#else >
......@@ -562,6 +590,29 @@ public class ${item.getCodeName()} extends EntityClient implements Serializable
this.${prvateCodeName} = ${prvateCodeName} ;
this.modify("${columnname}",${prvateCodeName});
}
<#if defDataType == "DATETIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS">
<#elseif defDataType == "DATE" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td">
<#elseif defDataType == "TIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tH:%1$tM:%1$tS">
</#if>
<#if defieldIsDate && defieldFormatStr != "">
/**
* 格式化日期 [${defield.getLogicName()}]
*/
public String format${publicCodeName}(){
if (this.${prvateCodeName} == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("defieldFormatStr");
return sdf.format(${prvateCodeName});
}
</#if>
</#if>
</#if>
</#list>
......@@ -694,7 +745,42 @@ public class ${item.getCodeName()} extends EntityBase implements Serializable {
</#list>
</#if>
<#list de.getPSDEFields() as defield>
<#assign defDataType = (defield.getDataType())!"">
<#assign columnname = defield.getName()?lower_case>
<#assign prvateCodeName = srfcaseformat(defield.getCodeName(),'l_u2lC') >
<#assign publicCodeName = prvateCodeName?cap_first >
<#assign jsonfield = defield.getCodeName()?lower_case >
<#assign defieldIsDate=false>
<#assign defieldFormatStr="">
<#if defield.isPhisicalDEField()==true && defield.isKeyDEField()==false && defDataType!='ONE2MANYDATA'>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
<#else >
<#if defDataType == "DATETIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS">
<#elseif defDataType == "DATE" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tY-%1$tm-%1$td")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tY-%1$tm-%1$td">
<#elseif defDataType == "TIME" || (defDataType=='PICKUPDATA' && srfdatatype(defield.getStdDataType())== "DATETIME" && defield.getValueFormat()=="%1$tH:%1$tM:%1$tS")>
<#assign defieldIsDate=true>
<#assign defieldFormatStr="%1$tH:%1$tM:%1$tS">
</#if>
<#if defieldIsDate && defieldFormatStr != "">
/**
* 格式化日期 [${defield.getLogicName()}]
*/
public String format${publicCodeName}(){
if (this.${prvateCodeName} == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("defieldFormatStr");
return sdf.format(${prvateCodeName});
}
</#if>
</#if>
</#if>
</#list>
</#if>
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册