代码生成器

MySQL表结构转Java/TypeScript对象

生成配置

输出语言

Java配置

包/路径配置

MySQL表结构输入
单表
多表批量

支持标准MySQL建表语句,可包含注释、索引、主键等

等待生成代码

输入MySQL表结构并点击生成按钮,将在此处显示生成的代码

示例参考

Java实体类示例

package com.example.entity; import lombok.*; import com.baomidou.mybatisplus.annotation.*; import io.swagger.v3.oas.annotations.media.Schema; @Getter @Setter @SuperBuilder @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @TableName(value = "me_article_category") @Schema(description = "文章分类") public class Category extends IDEntity { private static final long serialVersionUID = 1L; @Schema(description = "分类名称") private String name; @Schema(description = "分类图标URL") private String icon; @Schema(description = "短ID") private String shortId; @Schema(description = "排序") private Integer sortId; @Schema(description = "上级分类ID") private Long parentId; @Schema(description = "同组ID") private Long groupId; @Schema(description = "深度") private Integer depth; @Schema(description = "子分类数量") private Integer childCount; @Schema(description = "内容数量") private Integer itemCount; @TableLogic private Boolean deleted; } 点击复制代码

TypeScript接口示例

export interface Category { /** 主键 */ id: string; /** 创建时间 */ createTime: string; /** 更新时间 */ updateTime: string; /** 所属组织ID */ orgId: string; /** 分类名称 */ name: string; /** 分类图标URL */ icon: string; /** 短ID */ shortId: string; /** 排序 */ sortId: number; /** 上级分类ID */ parentId: string; /** 深度 */ depth: number; /** 同组ID */ groupId: string; /** 子分类数量 */ childCount: number; /** 内容数量 */ itemCount: number; /** 是否删除 */ deleted: boolean; } 点击复制代码