| | |
| | | package com.ruoyi.generator.domain; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.*; |
| | | import lombok.experimental.Accessors; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.apache.ibatis.type.JdbcType; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * 代码生成业务字段表 gen_table_column |
| | | * |
| | | * @author ruoyi |
| | | * @author Lion Li |
| | | */ |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @TableName("gen_table_column") |
| | | public class GenTableColumn implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | public class GenTableColumn extends BaseEntity { |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableId(value = "column_id", type = IdType.AUTO) |
| | | @TableId(value = "column_id") |
| | | private Long columnId; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 列描述 |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String columnComment; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 是否主键(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isPk; |
| | | |
| | | /** |
| | | * 是否自增(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isIncrement; |
| | | |
| | | /** |
| | | * 是否必填(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isRequired; |
| | | |
| | | /** |
| | | * 是否为插入字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isInsert; |
| | | |
| | | /** |
| | | * 是否编辑字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isEdit; |
| | | |
| | | /** |
| | | * 是否列表字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isList; |
| | | |
| | | /** |
| | | * 是否查询字段(1是) |
| | | */ |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED, jdbcType = JdbcType.VARCHAR) |
| | | private String isQuery; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * 创建者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新者 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 请求参数 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Map<String, Object> params = new HashMap<>(); |
| | | |
| | | public String getCapJavaField() { |
| | | return StringUtils.uncapitalize(javaField); |
| | | return StringUtils.capitalize(javaField); |
| | | } |
| | | |
| | | public boolean isPk() { |
| | |
| | | |
| | | public static boolean isSuperColumn(String javaField) { |
| | | return StringUtils.equalsAnyIgnoreCase(javaField, |
| | | // BaseEntity |
| | | "createBy", "createTime", "updateBy", "updateTime", "remark", |
| | | // TreeEntity |
| | | "parentName", "parentId", "orderNum", "ancestors"); |
| | | // BaseEntity |
| | | "createBy", "createTime", "updateBy", "updateTime", |
| | | // TreeEntity |
| | | "parentName", "parentId"); |
| | | } |
| | | |
| | | public boolean isUsableColumn() { |