代码生成

This commit is contained in:
PandaGoAdmin
2022-01-03 19:03:39 +08:00
parent 1a1f137725
commit b6a8fe5e1b
53 changed files with 2467 additions and 459 deletions

View File

@@ -8,7 +8,7 @@ type SysConfig struct {
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"`
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"`
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:是否系统内置01"`
IsFrontend int `json:"isFrontend" gorm:"type:varchar(64);comment:是否前台"`
IsFrontend string `json:"isFrontend" gorm:"type:varchar(1);comment:是否前台"`
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"`
model.BaseModel
}

View File

@@ -4,10 +4,10 @@ import "pandax/base/model"
type SysDept struct {
DeptId int64 `json:"deptId" gorm:"primary_key;AUTO_INCREMENT"` //部门编码
ParentId int64 `json:"parentId" gorm:"type:int(11);comment:上级部门"`
ParentId int64 `json:"parentId" gorm:"type:int;comment:上级部门"`
DeptPath string `json:"deptPath" gorm:"type:varchar(255);comment:部门路径"`
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"`
Sort int64 `json:"sort" gorm:"type:int(4);comment:排序"`
Sort int64 `json:"sort" gorm:"type:int;comment:排序"`
Leader string `json:"leader" gorm:"type:varchar(64);comment:负责人"` // userId
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机"`
Email string `json:"email" gorm:"type:varchar(64);comment:邮箱"`

View File

@@ -4,7 +4,7 @@ import "pandax/base/model"
type SysDictData struct {
DictCode int64 `json:"dictCode" gorm:"primary_key;AUTO_INCREMENT"`
DictSort int `json:"dictSort" gorm:"type:int(11);comment:排序"`
DictSort int `json:"dictSort" gorm:"type:int;comment:排序"`
DictLabel string `json:"dictLabel" gorm:"type:varchar(64);comment:标签"`
DictValue string `json:"dictValue" gorm:"type:varchar(64);comment:值"`
DictType string `json:"dictType" gorm:"type:varchar(64);comment:字典类型"`

View File

@@ -6,13 +6,13 @@ type SysMenu struct {
MenuId int64 `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"`
MenuName string `json:"menuName" gorm:"type:varchar(128);"`
Title string `json:"title" gorm:"type:varchar(64);"`
ParentId int64 `json:"parentId" gorm:"type:int(11);"`
Sort int64 `json:"sort" gorm:"type:int(4);"`
ParentId int64 `json:"parentId" gorm:"type:int;"`
Sort int64 `json:"sort" gorm:"type:int;"`
Icon string `json:"icon" gorm:"type:varchar(128);"`
Path string `json:"path" gorm:"type:varchar(128);"`
Component string `json:"component" gorm:"type:varchar(255);"` // 组件路径
IsIframe string `json:"isIframe" gorm:"type:varchar(1);"` //是否为内嵌
IsLink string `json:"isLink" gorm:"type:varchar(11);"` //是否超链接菜单
IsLink string `json:"isLink" gorm:"type:varchar(255);"` //是否超链接菜单
MenuType string `json:"menuType" gorm:"type:varchar(1);"` //菜单类型M目录 C菜单 F按钮
IsHide string `json:"isHide" gorm:"type:varchar(1);"` //显示状态0显示 1隐藏
IsKeepAlive string `json:"isKeepAlive" gorm:"type:varchar(1);"` //是否缓存组件状态0是 1否

View File

@@ -7,7 +7,7 @@ type SysNotice struct {
Title string `json:"title" gorm:"type:varchar(128);comment:标题"`
Content string `json:"content" gorm:"type:text;comment:标题"`
NoticeType string `json:"noticeType" gorm:"type:varchar(1);comment:通知类型"`
DeptId int64 `json:"deptId" gorm:"type:int(11);comment:部门Id,部门及子部门"`
DeptId int64 `json:"deptId" gorm:"type:int;comment:部门Id,部门及子部门"`
UserName string `json:"userName" gorm:"type:varchar(64);comment:发布人"`
DeptIds []int64 `json:"deptIds" gorm:"-"`

View File

@@ -6,7 +6,7 @@ type SysPost struct {
PostId int64 `gorm:"primary_key;AUTO_INCREMENT" json:"postId"`
PostName string `gorm:"type:varchar(128);comment:岗位名称" json:"postName"`
PostCode string `gorm:"type:varchar(128);comment:岗位代码" json:"postCode"`
Sort int64 `gorm:"type:int(4);comment:岗位排序" json:"sort"`
Sort int64 `gorm:"type:int;comment:岗位排序" json:"sort"`
Status string `gorm:"type:varchar(1);comment:状态" json:"status"`
Remark string `gorm:"type:varchar(255);comment:描述" json:"remark"`
CreateBy string `gorm:"type:varchar(128);" json:"createBy"`

View File

@@ -10,7 +10,7 @@ type SysRole struct {
RoleName string `json:"roleName" gorm:"type:varchar(128);comment:角色名称"`
Status string `json:"status" gorm:"type:varchar(1);comment:状态"`
RoleKey string `json:"roleKey" gorm:"type:varchar(128);comment:角色代码"`
RoleSort int64 `json:"roleSort" gorm:"type:int(4);comment:角色排序"`
RoleSort int64 `json:"roleSort" gorm:"type:int;comment:角色排序"`
DataScope string `json:"dataScope" gorm:"type:varchar(1);comment:数据范围1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限"`
Flag string `json:"flag" gorm:"type:varchar(128);comment:删除标识"`
CreateBy string `json:"createBy" gorm:"type:varchar(128);"`

View File

@@ -1,7 +1,7 @@
package entity
type SysRoleDept struct {
RoleId int64 `gorm:"type:int(11)"`
DeptId int64 `gorm:"type:int(11)"`
RoleId int64 `gorm:"type:int"`
DeptId int64 `gorm:"type:int"`
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
}

View File

@@ -1,8 +1,8 @@
package entity
type SysRoleMenu struct {
RoleId int64 `gorm:"type:int(11)"`
MenuId int64 `gorm:"type:int(11)"`
RoleId int64 `gorm:"type:int"`
MenuId int64 `gorm:"type:int"`
RoleName string `gorm:"type:varchar(128)"`
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
}

View File

@@ -23,13 +23,13 @@ type SysUserId struct {
type SysUserB struct {
NickName string `gorm:"type:varchar(128)" json:"nickName"` // 昵称
Phone string `gorm:"type:varchar(11)" json:"phone"` // 手机号
RoleId int64 `gorm:"type:int(11)" json:"roleId"` // 角色编码
RoleId int64 `gorm:"type:int" json:"roleId"` // 角色编码
Salt string `gorm:"type:varchar(255)" json:"salt"` //盐
Avatar string `gorm:"type:varchar(255)" json:"avatar"` //头像
Sex string `gorm:"type:varchar(255)" json:"sex"` //性别
Email string `gorm:"type:varchar(128)" json:"email"` //邮箱
DeptId int64 `gorm:"type:int(11)" json:"deptId"` //部门编码
PostId int64 `gorm:"type:int(11)" json:"postId"` //职位编码
DeptId int64 `gorm:"type:int" json:"deptId"` //部门编码
PostId int64 `gorm:"type:int" json:"postId"` //职位编码
RoleIds string `gorm:"type:varchar(255)" json:"roleIds"` //多角色
PostIds string `gorm:"type:varchar(255)" json:"postIds"` // 多岗位
CreateBy string `gorm:"type:varchar(128)" json:"createBy"` //

View File

@@ -114,6 +114,6 @@ func (m *sysSysApiModelImpl) Update(api entity.SysApi) *entity.SysApi {
}
func (m *sysSysApiModelImpl) Delete(ids []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysApi{}, "`id` in (?)", ids).Error
err := global.Db.Table(m.table).Delete(&entity.SysApi{}, "id in (?)", ids).Error
biz.ErrIsNil(err, "删除配置信息失败")
}

View File

@@ -33,7 +33,7 @@ func (m *sysSysConfigModelImpl) Insert(data entity.SysConfig) *entity.SysConfig
func (m *sysSysConfigModelImpl) FindOne(configId int64) *entity.SysConfig {
resData := new(entity.SysConfig)
err := global.Db.Table(m.table).Where("`config_id` = ?", configId).First(resData).Error
err := global.Db.Table(m.table).Where("config_id = ?", configId).First(resData).Error
biz.ErrIsNil(err, "查询配置信息失败")
return resData
}
@@ -88,7 +88,7 @@ func (m *sysSysConfigModelImpl) Update(data entity.SysConfig) *entity.SysConfig
}
func (m *sysSysConfigModelImpl) Delete(configIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysConfig{}, "`config_id` in (?)", configIds).Error
err := global.Db.Table(m.table).Delete(&entity.SysConfig{}, "config_id in (?)", configIds).Error
biz.ErrIsNil(err, "删除配置信息失败")
return
}

View File

@@ -45,7 +45,7 @@ func (m *sysDeptModelImpl) Insert(data entity.SysDept) *entity.SysDept {
func (m *sysDeptModelImpl) FindOne(deptId int64) *entity.SysDept {
resData := new(entity.SysDept)
err := global.Db.Table(m.table).Where("`dept_id` = ?", deptId).First(resData).Error
err := global.Db.Table(m.table).Where("dept_id = ?", deptId).First(resData).Error
biz.ErrIsNil(err, "查询部门信息失败")
return resData
}
@@ -116,7 +116,7 @@ func (m *sysDeptModelImpl) Update(data entity.SysDept) *entity.SysDept {
}
func (m *sysDeptModelImpl) Delete(deptIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysDept{}, "`dept_id` in (?)", deptIds).Error
err := global.Db.Table(m.table).Delete(&entity.SysDept{}, "dept_id in (?)", deptIds).Error
biz.ErrIsNil(err, "删除部门信息失败")
return
}

View File

@@ -33,7 +33,7 @@ func (m *sysDictDataModelImpl) Insert(data entity.SysDictData) *entity.SysDictDa
func (m *sysDictDataModelImpl) FindOne(codeId int64) *entity.SysDictData {
resData := new(entity.SysDictData)
err := global.Db.Table(m.table).Where("`dict_code` = ?", codeId).First(resData).Error
err := global.Db.Table(m.table).Where("dict_code = ?", codeId).First(resData).Error
biz.ErrIsNil(err, "查询字典数据信息失败")
return resData
}
@@ -88,7 +88,7 @@ func (m *sysDictDataModelImpl) Update(data entity.SysDictData) *entity.SysDictDa
}
func (m *sysDictDataModelImpl) Delete(codeIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysDept{}, "`dict_code` in (?)", codeIds).Error
err := global.Db.Table(m.table).Delete(&entity.SysDept{}, "dict_code in (?)", codeIds).Error
biz.ErrIsNil(err, "删除字典数据信息失败")
return
}

View File

@@ -33,7 +33,7 @@ func (m *sysDictTypeModelImpl) Insert(data entity.SysDictType) *entity.SysDictTy
func (m *sysDictTypeModelImpl) FindOne(dictId int64) *entity.SysDictType {
resData := new(entity.SysDictType)
err := global.Db.Table(m.table).Where("`dict_id` = ?", dictId).First(resData).Error
err := global.Db.Table(m.table).Where("dict_id = ?", dictId).First(resData).Error
biz.ErrIsNil(err, "查询字典类型信息失败")
return resData
}
@@ -88,7 +88,7 @@ func (m *sysDictTypeModelImpl) Update(data entity.SysDictType) *entity.SysDictTy
}
func (m *sysDictTypeModelImpl) Delete(dictIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysDictType{}, "`dict_id` in (?)", dictIds).Error
err := global.Db.Table(m.table).Delete(&entity.SysDictType{}, "dict_id in (?)", dictIds).Error
biz.ErrIsNil(err, "删除字典类型信息失败")
return
}

View File

@@ -38,7 +38,7 @@ func (m *sysMenuModelImpl) Insert(data entity.SysMenu) *entity.SysMenu {
func (m *sysMenuModelImpl) FindOne(menuId int64) *entity.SysMenu {
resData := new(entity.SysMenu)
err := global.Db.Table(m.table).Where("`menu_id` = ?", menuId).First(resData).Error
err := global.Db.Table(m.table).Where("menu_id = ?", menuId).First(resData).Error
biz.ErrIsNil(err, "查询菜单失败")
return resData
}
@@ -91,7 +91,7 @@ func (m *sysMenuModelImpl) Update(data entity.SysMenu) *entity.SysMenu {
}
func (m *sysMenuModelImpl) Delete(menuIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysMenu{}, "`menu_id` in (?)", menuIds).Error
err := global.Db.Table(m.table).Delete(&entity.SysMenu{}, "menu_id in (?)", menuIds).Error
biz.ErrIsNil(err, "修改菜单失败")
return
}

View File

@@ -32,7 +32,7 @@ func (m *sysNoticeModelImpl) Insert(data entity.SysNotice) *entity.SysNotice {
func (m *sysNoticeModelImpl) FindOne(postId int64) *entity.SysNotice {
resData := new(entity.SysNotice)
err := global.Db.Table(m.table).Where("`post_id` = ?", postId).First(resData).Error
err := global.Db.Table(m.table).Where("post_id = ?", postId).First(resData).Error
biz.ErrIsNil(err, "查询通知失败")
return resData
}

View File

@@ -33,7 +33,7 @@ func (m *sysPostModelImpl) Insert(data entity.SysPost) *entity.SysPost {
func (m *sysPostModelImpl) FindOne(postId int64) *entity.SysPost {
resData := new(entity.SysPost)
err := global.Db.Table(m.table).Where("`post_id` = ?", postId).First(resData).Error
err := global.Db.Table(m.table).Where("post_id = ?", postId).First(resData).Error
biz.ErrIsNil(err, "查询岗位失败")
return resData
}
@@ -90,5 +90,5 @@ func (m *sysPostModelImpl) Update(data entity.SysPost) *entity.SysPost {
}
func (m *sysPostModelImpl) Delete(postIds []int64) {
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysPost{}, "`post_id` in (?)", postIds).Error, "删除岗位失败")
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysPost{}, "post_id in (?)", postIds).Error, "删除岗位失败")
}

View File

@@ -30,7 +30,7 @@ var SysRoleModelDao SysRoleModel = &sysRoleModel{
func (m *sysRoleModel) Insert(data entity.SysRole) *entity.SysRole {
var i int64 = 0
global.Db.Table(m.table).Where("(role_name = ? or role_key = ?) and `delete_time` IS NULL", data.RoleName, data.RoleKey).Count(&i)
global.Db.Table(m.table).Where("(role_name = ? or role_key = ?) and delete_time IS NULL", data.RoleName, data.RoleKey).Count(&i)
biz.IsTrue(i == 0, "角色名称或者角色标识已经存在!")
data.UpdateBy = ""
@@ -42,7 +42,7 @@ func (m *sysRoleModel) Insert(data entity.SysRole) *entity.SysRole {
func (m *sysRoleModel) FindOne(roleId int64) *entity.SysRole {
resData := new(entity.SysRole)
biz.ErrIsNil(global.Db.Table(m.table).Where("`role_id` = ?", roleId).First(resData).Error, "查询角色失败")
biz.ErrIsNil(global.Db.Table(m.table).Where("role_id = ?", roleId).First(resData).Error, "查询角色失败")
return resData
}
@@ -102,7 +102,7 @@ func (m *sysRoleModel) Update(data entity.SysRole) *entity.SysRole {
}
func (m *sysRoleModel) Delete(roleIds []int64) {
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysRole{}, "`role_id` in (?)", roleIds).Error, "删除角色失败")
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysRole{}, "role_id in (?)", roleIds).Error, "删除角色失败")
return
}

View File

@@ -23,7 +23,7 @@ var SysRoleDeptModelDao SysRoleDeptModel = &sysRoleDeptImpl{
}
func (m *sysRoleDeptImpl) Insert(roleId int64, deptIds []int64) bool {
sql := "INSERT INTO `sys_role_depts` (`role_id`,`dept_id`) VALUES "
sql := "INSERT INTO sys_role_depts (role_id, dept_id) VALUES "
for i := 0; i < len(deptIds); i++ {
if len(deptIds)-1 == i {

View File

@@ -37,7 +37,7 @@ func (m *sysRoleMenuImpl) Insert(roleId int64, menuId []int64) bool {
biz.ErrIsNil(global.Db.Table("sys_menus").Where("menu_id in (?)", menuId).Find(&menu).Error, "查询菜单失败")
//拼接 sql 串
sql := "INSERT INTO `sys_role_menus` (`role_id`,`menu_id`,`role_name`) VALUES "
sql := "INSERT INTO sys_role_menus (role_id,menu_id,role_name) VALUES "
for i := 0; i < len(menu); i++ {
if len(menu)-1 == i {

View File

@@ -46,7 +46,7 @@ func (m *sysUserModelImpl) Insert(data entity.SysUser) *entity.SysUser {
// check 用户名
var count int64
global.Db.Table(m.table).Where("username = ? and `delete_time` IS NULL", data.Username).Count(&count)
global.Db.Table(m.table).Where("username = ? and delete_time IS NULL", data.Username).Count(&count)
biz.IsTrue(count == 0, "账户已存在!")
biz.ErrIsNil(global.Db.Table(m.table).Create(&data).Error, "添加用户失败")
@@ -172,7 +172,7 @@ func (m *sysUserModelImpl) Update(data entity.SysUser) *entity.SysUser {
}
func (m *sysUserModelImpl) Delete(userIds []int64) {
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysUser{}, "`user_id` in (?)", userIds).Error, "删除用户失败")
biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.SysUser{}, "user_id in (?)", userIds).Error, "删除用户失败")
}
func (m *sysUserModelImpl) SetPwd(data entity.SysUser, pwd entity.SysUserPwd) bool {