diff --git a/src/modules/system/entity/sys_dept.go b/src/modules/system/entity/sys_dept.go new file mode 100644 index 0000000..c55d143 --- /dev/null +++ b/src/modules/system/entity/sys_dept.go @@ -0,0 +1,19 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 部门 +type Dept struct { + base.LingYeDO + ParentId uint64 `gorm:"column:parent_id;type:bigint(20);default:0;comment:'父部门ID'"` + DeptName string `gorm:"column:dept_name;type:varchar(255);default:'';comment:'部门名称'"` + OrderNum int `gorm:"column:order_num;type:int(4);default:0;comment:'显示顺序'"` + LeaderId uint64 `gorm:"column:leader;type:varchar(20);comment:'负责人ID'"` + Status string `gorm:"column:status;type:char(1);default:'0';comment:'部门状态(0正常 1停用)'"` +} + +func (Dept) TableName() string { + return "sys_dept" +} diff --git a/src/modules/system/entity/sys_dict_data.go b/src/modules/system/entity/sys_dict_data.go new file mode 100644 index 0000000..6adcc20 --- /dev/null +++ b/src/modules/system/entity/sys_dict_data.go @@ -0,0 +1,21 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 字典数据 +type DictData struct { + base.LingYeDO + DictSort int `gorm:"column:dict_sort;type:int(4);default:0;comment:'字典排序'"` + DictLabel string `gorm:"column:dict_label;type:varchar(255);comment:'字典标签'"` + DictValue string `gorm:"column:dict_value;type:varchar(255);comment:'字典键值'"` + DictType string `gorm:"column:dict_type;type:varchar(255);comment:'字典类型'"` + IsDefault string `gorm:"column:is_default;type:varchar(255);default:'N';comment:'是否默认(Y是 N否)'"` + Status string `gorm:"column:status;type:char(1);default:'0';comment:'状态(0正常 1停用)'"` + Remark string `gorm:"column:remark;type:varchar(255);comment:'字典标签'"` +} + +func (DictData) TableName() string { + return "sys_dict_data" +} diff --git a/src/modules/system/entity/sys_dict_type.go b/src/modules/system/entity/sys_dict_type.go new file mode 100644 index 0000000..e8a8d3f --- /dev/null +++ b/src/modules/system/entity/sys_dict_type.go @@ -0,0 +1,18 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 字典类型 +type DictType struct { + base.LingYeDO + DictName string `gorm:"column:dict_name;type:varchar(255);comment:'字典名称'"` + DictType string `gorm:"column:dict_type;type:varchar(255);unique_index;comment:'字典类型'"` + Status string `gorm:"column:status;type:char(1);default:'0';comment:'状态(0正常 1停用)'"` + Remark string `gorm:"column:remark;comment:'备注'"` +} + +func (DictType) TableName() string { + return "sys_dict_type" +} diff --git a/src/modules/system/entity/sys_job.go b/src/modules/system/entity/sys_job.go new file mode 100644 index 0000000..da7a09e --- /dev/null +++ b/src/modules/system/entity/sys_job.go @@ -0,0 +1,20 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 定时任务 +type Job struct { + base.LingYeDO + JobName string `gorm:"column:job_name;type:varchar(255);not null;comment:'任务名称'"` + InvokeTarget string `gorm:"column:invoke_target;type:varchar(255);not null;comment:'调用目标字符串'"` + CronExpression string `gorm:"column:cron_expression;type:varchar(255);not null;comment:'cron执行表达式'"` + MisfirePolicy string `gorm:"column:misfire_policy;type:varchar(255);not null;default:'3';comment:'计划执行错误策略(1立即执行 2执行一次 3放弃执行)'"` + Concurrent string `gorm:"column:concurrent;type:varchar(255);not null;default:'1';comment:'是否并发执行(0允许 1禁止)'"` + Status string `gorm:"column:status;type:char(1);not null;default:'0';comment:'状态(0正常 1暂停)'"` +} + +func (Job) TableName() string { + return "sys_job" +} diff --git a/src/modules/system/entity/sys_menu.go b/src/modules/system/entity/sys_menu.go new file mode 100644 index 0000000..f83ebba --- /dev/null +++ b/src/modules/system/entity/sys_menu.go @@ -0,0 +1,26 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 菜单权限 +type Menu struct { + base.LingYeDO + MenuName string `gorm:"column:menu_name;type:varchar(255);not null;comment:'菜单名称'"` + ParentId uint64 `gorm:"column:parent_id;type:bigint(20);default:0;comment:'父菜单ID'"` + OrderNum uint64 `gorm:"column:order_num;type:int(4);default:0;comment:'显示顺序'"` + Path string `gorm:"column:path;type:varchar(500);default:'';comment:'路由地址'"` + Component string `gorm:"column:component;type:varchar(255);comment:'组件路径'"` + IsFrame int `gorm:"column:is_frame;type:tinyint(1);default:1;comment:'是否为外链(0是 1否)'"` + IsCache int `gorm:"column:is_cache;type:tinyint(1);default:0;comment:'是否缓存(0缓存 1不缓存)'"` + MenuType string `gorm:"column:menu_type;type:char(1);default:'';comment:'菜单类型(M目录 C菜单 F按钮)'"` + Visible string `gorm:"column:visible;type:char(1);default:'0';comment:'菜单状态(0显示 1隐藏)'"` + Status string `gorm:"column:status;type:char(1);default:'0';comment:'菜单状态(0正常 1停用)'"` + PermissionCode string `gorm:"column:permission_code;type:varchar(100);comment:'权限标识'"` + Icon string `gorm:"column:icon;type:varchar(100);default:'#';comment:'菜单图标'"` +} + +func (Menu) TableName() string { + return "sys_menu" +} diff --git a/src/modules/system/entity/sys_notice.go b/src/modules/system/entity/sys_notice.go new file mode 100644 index 0000000..761e53e --- /dev/null +++ b/src/modules/system/entity/sys_notice.go @@ -0,0 +1,19 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 通知公告 +type Notice struct { + base.LingYeDO + NoticeTitle string `gorm:"column:notice_title;type:varchar(50);not null;comment:'公告标题'"` + NoticeType string `gorm:"column:notice_type;type:char(1);not null;comment:'公告类型(1通知 2公告)'"` + NoticeContent string `gorm:"column:notice_content;type:text(0);not null;comment:'公告内容'"` + Status string `gorm:"column:status;type:char(1);not null;default:'0';comment:'公告状态(0正常 1关闭)'"` + Remark string `gorm:"column:remark"` +} + +func (Notice) TableName() string { + return "sys_notice" +} diff --git a/src/modules/system/entity/sys_operate_log.go b/src/modules/system/entity/sys_operate_log.go new file mode 100644 index 0000000..54be736 --- /dev/null +++ b/src/modules/system/entity/sys_operate_log.go @@ -0,0 +1,26 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 操作日志 +type OperateLog struct { + base.LingYeDO + Title string `gorm:"column:title;type:varchar(255);comment:'模块标题'"` + BusinessType string `gorm:"column:business_type;type:char(1);comment:'业务类型(0其它 1新增 2修改 3删除)'"` + Method string `gorm:"column:method;type:varchar(100);comment:'方法名称'"` + RequestMethod string `gorm:"column:request_method;type:varchar(10);comment:'请求方式'"` + DeptName string `gorm:"column:dept_name;type:varchar(50);comment:'部门名称'"` + OperateUrl string `gorm:"column:operate_url;type:varchar(255);comment:'请求url'"` + OperateIp string `gorm:"column:operate_ip;type:varchar(255);comment:'主机地址'"` + OperateLocation string `gorm:"column:operate_location;type:varchar(255);comment:'操作地点'"` + OperateParam string `gorm:"column:operate_param;type:varchar(255);comment:'请求参数'"` + JsonResult string `gorm:"column:json_result;type:varchar(255);comment:'返回参数'"` + Status string `gorm:"column:status;type:char(1);comment:'操作状态(0正常 1异常)'"` + ErrorMsg string `gorm:"column:error_msg;type:text(0);comment:'错误消息'"` +} + +func (OperateLog) TableName() string { + return "sys_operate_log" +} diff --git a/src/modules/system/entity/sys_position.go b/src/modules/system/entity/sys_position.go new file mode 100644 index 0000000..e007791 --- /dev/null +++ b/src/modules/system/entity/sys_position.go @@ -0,0 +1,19 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 岗位 +type Position struct { + base.LingYeDO + PostCode string `gorm:"column:post_code;type:varchar(255);not null;comment:'岗位编码'"` + PostName string `gorm:"column:post_name;type:varchar(255);not null;comment:'岗位名称'"` + PostSort int `gorm:"column:post_sort;type:int(4);not null;comment:'显示顺序'"` + Status string `gorm:"column:status;type:char(1);not null;comment:'状态(0正常 1停用)'"` + Remark string `gorm:"column:remark;type:varchar(255);comment:'备注'"` +} + +func (Position) TableName() string { + return "sys_position" +} diff --git a/src/modules/system/entity/sys_role.go b/src/modules/system/entity/sys_role.go new file mode 100644 index 0000000..c04f707 --- /dev/null +++ b/src/modules/system/entity/sys_role.go @@ -0,0 +1,19 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 角色 +type Role struct { + base.LingYeDO + RoleName string `gorm:"column:role_name;type:varchar(30);not null;comment:'角色名称'"` + RoleKey string `gorm:"column:role_key;type:varchar(100);not null;comment:'角色权限字符串'"` + RoleSort int `gorm:"column:role_sort;type:int(4);not null;default:0;comment:'显示顺序'"` + DataScope string `gorm:"column:data_scope;type:char(1);not null;default:'1';comment:'数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)'"` + Status string `gorm:"column:status;type:char(1);not null;default:'0';comment:'角色状态(0正常 1停用)'"` +} + +func (Role) TableName() string { + return "sys_role" +} diff --git a/src/modules/system/entity/sys_role_dept.go b/src/modules/system/entity/sys_role_dept.go new file mode 100644 index 0000000..92aa8e6 --- /dev/null +++ b/src/modules/system/entity/sys_role_dept.go @@ -0,0 +1,11 @@ +package entity + +// 角色和部门关联 +type RoleDept struct { + RoleId uint64 `gorm:"column:role_id;type:bigint(20);not null;comment:'角色ID'"` + DeptId uint64 `gorm:"column:dept_id;type:bigint(20);not null;comment:'部门ID'"` +} + +func (RoleDept) TableName() string { + return "sys_role_dept" +} diff --git a/src/modules/system/entity/sys_role_menu.go b/src/modules/system/entity/sys_role_menu.go new file mode 100644 index 0000000..4a5f7e5 --- /dev/null +++ b/src/modules/system/entity/sys_role_menu.go @@ -0,0 +1,11 @@ +package entity + +// 角色和菜单关联 +type RoleMenu struct { + RoleId uint64 `gorm:"column:role_id;type:bigint(20);not null;comment:'角色ID'"` + MenuId uint64 `gorm:"column:menu_id;type:bigint(20);not null;comment:'菜单ID'"` +} + +func (RoleMenu) TableName() string { + return "sys_role_menu" +} diff --git a/src/modules/system/entity/sys_user.go b/src/modules/system/entity/sys_user.go new file mode 100644 index 0000000..d32fc61 --- /dev/null +++ b/src/modules/system/entity/sys_user.go @@ -0,0 +1,25 @@ +package entity + +import ( + "lingye-gin/src/base" +) + +// 用户信息 +type User struct { + base.LingYeDO + UserName string `gorm:"column:user_name;type:varchar(255);index:idx_username;comment:'用户真名'"` + UserCode string `gorm:"column:user_code;type:varchar(255);unique_index;comment:'用户编码'"` + NickName string `gorm:"column:nick_name;type:varchar(255);comment:'用户昵称'"` + Email string `gorm:"column:email;type:varchar(255);unique_index;comment:'邮箱'"` + PhoneNumber string `gorm:"column:phone_number;type:varchar(255);unique_index;comment:'手机号'"` + Sex string `gorm:"column:sex;type:varchar(255);comment:'性别(0男 1女 2未知)'"` + Avatar string `gorm:"column:avatar;type:varchar(255);comment:'头像路径'"` + Password string `gorm:"column:password;type:varchar(255);comment:'加密密码'"` + Status string `gorm:"column:status;type:char(1);default:'0';comment:'帐号状态(0正常 1停用)'"` + Remark string `gorm:"column:remark;type:text(0);comment:'备注'"` +} + +// 设置User的表名为`sys_user` +func (User) TableName() string { + return "sys_user" +} diff --git a/src/modules/system/entity/sys_user_position.go b/src/modules/system/entity/sys_user_position.go new file mode 100644 index 0000000..cb0cf95 --- /dev/null +++ b/src/modules/system/entity/sys_user_position.go @@ -0,0 +1,11 @@ +package entity + +// 用户与岗位关联 +type UserPosition struct { + UserId uint64 `gorm:"column:user_id;type:bigint(20);not null;comment:'用户ID'"` + PositionId uint64 `gorm:"column:post_id;type:bigint(20);not null;comment:'岗位ID'"` +} + +func (UserPosition) TableName() string { + return "sys_user_position" +} diff --git a/src/modules/system/entity/sys_user_role.go b/src/modules/system/entity/sys_user_role.go new file mode 100644 index 0000000..0da5efd --- /dev/null +++ b/src/modules/system/entity/sys_user_role.go @@ -0,0 +1,11 @@ +package entity + +// 用户和角色关联 +type UserRole struct { + UserId uint64 `gorm:"column:user_id;type:bigint(20);not null;comment:'用户ID'"` + RoleId uint64 `gorm:"column:role_id;type:bigint(20);not null;comment:'角色ID'"` +} + +func (UserRole) TableName() string { + return "sys_user_role" +}