优化代码
This commit is contained in:
parent
36a52d5235
commit
84b62b68d5
@ -5,11 +5,11 @@ import ${import};
|
|||||||
#end
|
#end
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.core.domain.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
import com.ruoyi.common.core.core.domain.TreeEntity;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,49 +19,49 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
|||||||
* ${datetime}
|
* ${datetime}
|
||||||
*/
|
*/
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
#set($Entity="BaseEntity")
|
#set($Entity="BaseEntity")
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#set($Entity="TreeEntity")
|
#set($Entity="TreeEntity")
|
||||||
#end
|
#end
|
||||||
public class ${ClassName} extends ${Entity}
|
public class ${ClassName} extends ${Entity}
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
/** $column.columnComment */
|
/** $column.columnComment */
|
||||||
#if($column.list)
|
#if($column.list)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
#if($parentheseIndex != -1)
|
#if($parentheseIndex != -1)
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
#else
|
#else
|
||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
#if($parentheseIndex != -1)
|
#if($parentheseIndex != -1)
|
||||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
#elseif($column.javaType == 'Date')
|
#elseif($column.javaType == 'Date')
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
#else
|
#else
|
||||||
@Excel(name = "${comment}")
|
@Excel(name = "${comment}")
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
private $column.javaType $column.javaField;
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
/** $table.subTable.functionName信息 */
|
/** $table.subTable.functionName信息 */
|
||||||
private List<${subClassName}> ${subclassName}List;
|
private List<${subClassName}> ${subclassName}List;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
#set($AttrName=$column.javaField)
|
#set($AttrName=$column.javaField)
|
||||||
#else
|
#else
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
#end
|
||||||
public void set${AttrName}($column.javaType $column.javaField)
|
public void set${AttrName}($column.javaType $column.javaField)
|
||||||
{
|
{
|
||||||
this.$column.javaField = $column.javaField;
|
this.$column.javaField = $column.javaField;
|
||||||
@ -71,35 +71,35 @@ public class ${ClassName} extends ${Entity}
|
|||||||
{
|
{
|
||||||
return $column.javaField;
|
return $column.javaField;
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
public List<${subClassName}> get${subClassName}List()
|
public List<${subClassName}> get${subClassName}List()
|
||||||
{
|
{
|
||||||
return ${subclassName}List;
|
return ${subclassName}List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
||||||
{
|
{
|
||||||
this.${subclassName}List = ${subclassName}List;
|
this.${subclassName}List = ${subclassName}List;
|
||||||
}
|
}
|
||||||
|
|
||||||
#end
|
#end
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
#set($AttrName=$column.javaField)
|
#set($AttrName=$column.javaField)
|
||||||
#else
|
#else
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
#end
|
||||||
.append("${column.javaField}", get${AttrName}())
|
.append("${column.javaField}", get${AttrName}())
|
||||||
#end
|
#end
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
.append("${subclassName}List", get${subClassName}List())
|
.append("${subclassName}List", get${subClassName}List())
|
||||||
#end
|
#end
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user