增加系统管理代码框架
This commit is contained in:
56
src/main/java/com/rj/entity/sys/Menu.java
Normal file
56
src/main/java/com/rj/entity/sys/Menu.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表
|
||||
* </p>
|
||||
*
|
||||
* @author 系统生成
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("menu")
|
||||
@Schema(description="菜单表")
|
||||
public class Menu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "菜单编号")
|
||||
@TableId("menu_id")
|
||||
private Integer menuId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "重定向路径")
|
||||
@TableField("redirect")
|
||||
private String redirect;
|
||||
|
||||
@Schema(description = "路由路径")
|
||||
@TableField("path")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "组件路径")
|
||||
@TableField("component")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "父菜单ID")
|
||||
@TableField("parent_id")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "元数据信息(JSON格式)")
|
||||
@TableField("meta")
|
||||
private String meta;
|
||||
|
||||
}
|
||||
56
src/main/java/com/rj/entity/sys/Meta.java
Normal file
56
src/main/java/com/rj/entity/sys/Meta.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Meta {
|
||||
|
||||
private String title;
|
||||
private String icon;
|
||||
private List<String> roles;
|
||||
private Boolean affix;
|
||||
|
||||
public Meta() {
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public Boolean getAffix() {
|
||||
return affix;
|
||||
}
|
||||
|
||||
public void setAffix(Boolean affix) {
|
||||
this.affix = affix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Meta{" +
|
||||
"title='" + title + '\'' +
|
||||
", icon='" + icon + '\'' +
|
||||
", roles=" + roles +
|
||||
", affix=" + affix +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
36
src/main/java/com/rj/entity/sys/Role.java
Normal file
36
src/main/java/com/rj/entity/sys/Role.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表
|
||||
* </p>
|
||||
*
|
||||
* @author 系统生成
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("role")
|
||||
@Schema(description="角色表")
|
||||
public class Role implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "角色编号")
|
||||
@TableId("role_id")
|
||||
private Integer roleId;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
@TableField("role_name")
|
||||
private String roleName;
|
||||
|
||||
}
|
||||
52
src/main/java/com/rj/entity/sys/User.java
Normal file
52
src/main/java/com/rj/entity/sys/User.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表
|
||||
* </p>
|
||||
*
|
||||
* @author 系统生成
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("user")
|
||||
@Schema(description="用户表")
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
@TableId("user_id")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
@TableField("email")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "密码")
|
||||
@TableField("password")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "token令牌")
|
||||
@TableField("token")
|
||||
private String token;
|
||||
|
||||
@Schema(description = "头像")
|
||||
@TableField("avatar")
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
36
src/main/java/com/rj/entity/sys/UserRole.java
Normal file
36
src/main/java/com/rj/entity/sys/UserRole.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.rj.entity.sys;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户角色关联表
|
||||
* </p>
|
||||
*
|
||||
* @author 系统生成
|
||||
* @since 2025-08-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("user_role")
|
||||
@Schema(description="用户角色关联表")
|
||||
public class UserRole implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "用户编号")
|
||||
@TableId("user_id")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "角色编号")
|
||||
@TableId("role_id")
|
||||
private Integer roleId;
|
||||
|
||||
}
|
||||
45
src/main/java/com/rj/entity/sys/sysmysql.sql
Normal file
45
src/main/java/com/rj/entity/sys/sysmysql.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
-- 数据库表结构创建语句
|
||||
-- 根据实体类 Menu.java, Role.java, User.java, UserRole.java 生成
|
||||
|
||||
-- 1. 用户表 (user)
|
||||
CREATE TABLE `user` (
|
||||
`user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
|
||||
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
|
||||
`password` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
`token` varchar(255) DEFAULT NULL COMMENT 'token令牌',
|
||||
`avatar` varchar(255) DEFAULT NULL COMMENT '头像',
|
||||
PRIMARY KEY (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
|
||||
|
||||
-- 2. 角色表 (role)
|
||||
CREATE TABLE `role` (
|
||||
`role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色编号',
|
||||
`role_name` varchar(255) DEFAULT NULL COMMENT '角色名称',
|
||||
PRIMARY KEY (`role_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';
|
||||
|
||||
-- 3. 用户角色关联表 (user_role)
|
||||
CREATE TABLE `user_role` (
|
||||
`user_id` int(11) NOT NULL COMMENT '用户编号',
|
||||
`role_id` int(11) NOT NULL COMMENT '角色编号',
|
||||
PRIMARY KEY (`user_id`, `role_id`),
|
||||
KEY `fk_user_role_user_id` (`user_id`),
|
||||
KEY `fk_user_role_role_id` (`role_id`),
|
||||
CONSTRAINT `fk_user_role_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_user_role_role_id` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色关联表';
|
||||
|
||||
-- 4. 菜单表 (menu)
|
||||
CREATE TABLE `menu` (
|
||||
`menu_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单编号',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '菜单名称',
|
||||
`redirect` varchar(255) DEFAULT NULL COMMENT '重定向路径',
|
||||
`path` varchar(255) DEFAULT NULL COMMENT '路由路径',
|
||||
`component` varchar(255) DEFAULT NULL COMMENT '组件路径',
|
||||
`parent_id` int(11) DEFAULT NULL COMMENT '父菜单ID',
|
||||
`meta` json DEFAULT NULL COMMENT '元数据信息(JSON格式)',
|
||||
PRIMARY KEY (`menu_id`),
|
||||
KEY `idx_menu_parent_id` (`parent_id`),
|
||||
CONSTRAINT `fk_menu_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `menu` (`menu_id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单表';
|
||||
Reference in New Issue
Block a user