主实体.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package ${package}.${moduleName}.entity;
  2. import com.baomidou.mybatisplus.annotation.*;
  3. import com.baomidou.mybatisplus.extension.activerecord.Model;
  4. import io.swagger.v3.oas.annotations.media.Schema;
  5. import lombok.Data;
  6. import lombok.EqualsAndHashCode;
  7. #if($isTenant)
  8. import ${package}.common.core.util.TenantTable;
  9. #end
  10. #foreach($import in $importList)
  11. import $import;
  12. #end
  13. import com.alibaba.excel.annotation.ExcelIgnore;
  14. import com.github.yulichang.annotation.EntityMapping;
  15. import java.util.List;
  16. /**
  17. * ${tableComment}
  18. *
  19. * @author ${author}
  20. * @date ${datetime}
  21. */
  22. @Data
  23. #if($isTenant)
  24. @TenantTable
  25. #end
  26. @TableName("${tableName}")
  27. @EqualsAndHashCode(callSuper = true)
  28. @Schema(description = "${tableComment}")
  29. public class ${ClassName}Entity extends Model<${ClassName}Entity> {
  30. #foreach ($field in $fieldList)
  31. #if(${field.fieldComment})#set($comment=${field.fieldComment})#else #set($comment=${field.attrName})#end
  32. /**
  33. * $comment
  34. */
  35. #if($field.primaryPk == '1')
  36. @TableId(type = IdType.ASSIGN_ID)
  37. #end
  38. #if($field.autoFill == 'INSERT')
  39. @TableField(fill = FieldFill.INSERT)
  40. #elseif($field.autoFill == 'INSERT_UPDATE')
  41. @TableField(fill = FieldFill.INSERT_UPDATE)
  42. #elseif($field.autoFill == 'UPDATE')
  43. @TableField(fill = FieldFill.UPDATE)
  44. #end
  45. #if($field.fieldName == 'del_flag')
  46. @TableLogic
  47. @TableField(fill = FieldFill.INSERT)
  48. #end
  49. @Schema(description="$comment"#if($field.hidden),hidden=$field.hidden#end)
  50. #if($field.formType == 'checkbox')
  51. private ${field.attrType}[] $field.attrName;
  52. #else
  53. private $field.attrType $field.attrName;
  54. #end
  55. #end
  56. @ExcelIgnore
  57. @TableField(exist = false)
  58. @EntityMapping(thisField = "$mainField", joinField = "$childField")
  59. private List<${ChildClassName}Entity> ${childClassName}List;
  60. }