domain.java.vm 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package ${packageName}.domain;
  2. #foreach ($import in $importList)
  3. import ${import};
  4. #end
  5. import org.apache.commons.lang3.builder.ToStringBuilder;
  6. import org.apache.commons.lang3.builder.ToStringStyle;
  7. import com.ruoyi.common.annotation.Excel;
  8. #if($table.crud || $table.sub)
  9. import com.ruoyi.common.core.domain.BaseEntity;
  10. #elseif($table.tree)
  11. import com.ruoyi.common.core.domain.TreeEntity;
  12. #end
  13. /**
  14. * ${functionName}对象 ${tableName}
  15. *
  16. * @author ${author}
  17. * @date ${datetime}
  18. */
  19. #if($table.crud || $table.sub)
  20. #set($Entity="BaseEntity")
  21. #elseif($table.tree)
  22. #set($Entity="TreeEntity")
  23. #end
  24. public class ${ClassName} extends ${Entity}
  25. {
  26. private static final long serialVersionUID = 1L;
  27. #foreach ($column in $columns)
  28. #if(!$table.isSuperColumn($column.javaField))
  29. /** $column.columnComment */
  30. #if($column.list)
  31. #set($parentheseIndex=$column.columnComment.indexOf("("))
  32. #if($parentheseIndex != -1)
  33. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  34. #else
  35. #set($comment=$column.columnComment)
  36. #end
  37. #if($parentheseIndex != -1)
  38. @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
  39. #elseif($column.javaType == 'Date')
  40. @JsonFormat(pattern = "yyyy-MM-dd")
  41. @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
  42. #else
  43. @Excel(name = "${comment}")
  44. #end
  45. #end
  46. private $column.javaType $column.javaField;
  47. #end
  48. #end
  49. #if($table.sub)
  50. /** $table.subTable.functionName信息 */
  51. private List<${subClassName}> ${subclassName}List;
  52. #end
  53. #foreach ($column in $columns)
  54. #if(!$table.isSuperColumn($column.javaField))
  55. #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
  56. #set($AttrName=$column.javaField)
  57. #else
  58. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  59. #end
  60. public void set${AttrName}($column.javaType $column.javaField)
  61. {
  62. this.$column.javaField = $column.javaField;
  63. }
  64. public $column.javaType get${AttrName}()
  65. {
  66. return $column.javaField;
  67. }
  68. #end
  69. #end
  70. #if($table.sub)
  71. public List<${subClassName}> get${subClassName}List()
  72. {
  73. return ${subclassName}List;
  74. }
  75. public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
  76. {
  77. this.${subclassName}List = ${subclassName}List;
  78. }
  79. #end
  80. @Override
  81. public String toString() {
  82. return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  83. #foreach ($column in $columns)
  84. #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
  85. #set($AttrName=$column.javaField)
  86. #else
  87. #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  88. #end
  89. .append("${column.javaField}", get${AttrName}())
  90. #end
  91. #if($table.sub)
  92. .append("${subclassName}List", get${subClassName}List())
  93. #end
  94. .toString();
  95. }
  96. }