Skip to content

Commit

Permalink
Merge pull request #257 from i-Things/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
godLei6 authored Sep 4, 2023
2 parents 12691f0 + 188bdef commit bef2d2f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 82 deletions.
44 changes: 14 additions & 30 deletions src/apisvr/http/system/menu.api
Original file line number Diff line number Diff line change
Expand Up @@ -29,49 +29,33 @@ service api {
}
type (
MenuCreateReq struct {
Name string `json:"name"` // 菜单名称
ParentID int64 `json:"parentID,optional"` // 父菜单ID,一级菜单为1
Type int64 `json:"type,optional"` // 类型 1:目录 2:菜单 3:按钮
Path string `json:"path,optional"` // 系统的path
Component string `json:"component,optional"` // 页面
Icon string `json:"icon,optional"` // 菜单图标
Redirect string `json:"redirect,optional"` // 路由重定向
Order int64 `json:"order,optional"` // 左侧table排序序号
HideInMenu int64 `json:"hideInMenu,optional"` // 菜单是否隐藏 1:是 2:否
MenuData
}

MenuIndexReq struct {
Name string `json:"name,optional"` // 按菜单名称筛选
Path string `json:"path,optional"` // 按菜单路径筛选
}
MenuData struct {
ID int64 `json:"id"` // 编号
Name string `json:"name"` // 菜单名称
ParentID int64 `json:"parentID"` // 父菜单ID,一级菜单为1
Type int64 `json:"type"` // 类型 1:目录 2:菜单 3:按钮
Path string `json:"path"` // 系统的path
Component string `json:"component"` // 页面
Icon string `json:"icon"` // 菜单图标
Redirect string `json:"redirect"` // 路由重定向
CreateTime int64 `json:"createTime"` // 创建时间
Order int64 `json:"order"` // 左侧table排序序号
HideInMenu int64 `json:"hideInMenu,optional"` // 菜单是否隐藏 1:是 2:否
ID int64 `json:"id,optional"` // 编号
Name string `json:"name,optional"` // 菜单名称
ParentID int64 `json:"parentID,optional"` // 父菜单ID,一级菜单为1
Type int64 `json:"type,optional"` // 类型 1. 内部页面 2,iframe内嵌 3,外部链接跳转 4,微前端
Path string `json:"path,optional"` // 系统的path
Component string `json:"component,optional"` // 页面
Icon string `json:"icon,optional"` // 菜单图标
Redirect string `json:"redirect,optional"` // 路由重定向
Order int64 `json:"order,optional"` // 左侧table排序序号
HideInMenu int64 `json:"hideInMenu,optional"` // 菜单是否隐藏 1:是 2:否
CreateTime int64 `json:"createTime,optional"` // 创建时间
}
MenuIndexResp struct {
List []*MenuData `json:"list"` //菜单列表

}
MenuUpdateReq struct {
ID int64 `json:"id"` // 编号
Name string `json:"name"` // 菜单名称
ParentID int64 `json:"parentID"` // 父菜单ID,一级菜单为1
Type int64 `json:"type,optional"` // 类型 1:目录 2:菜单 3:按钮
Path string `json:"path,optional"` // 系统的path
Component string `json:"component,optional"` // 页面
Icon string `json:"icon,optional"` // 菜单图标
Redirect string `json:"redirect,optional"` // 路由重定向
Order int64 `json:"order"` // 左侧table排序序号
HideInMenu int64 `json:"hideInMenu,optional"` // 菜单是否隐藏 1:是 2:否
MenuData

}

MenuDeleteReq struct {
Expand Down
41 changes: 12 additions & 29 deletions src/apisvr/internal/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/dmsvr/internal/repo/relationDB/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (m *DmDeviceInfo) TableName() string {

// 设备分组信息表
type DmGroupInfo struct {
GroupID int64 `gorm:"column:group_id;primary_key;type:bigint"` // 分组ID
GroupID int64 `gorm:"column:group_id;primary_key;AUTO_INCREMENT;type:bigint"` // 分组ID
ParentID int64 `gorm:"column:parent_id;type:bigint;default:0;NOT NULL"` // 父组ID 0-根组
ProjectID int64 `gorm:"column:project_id;index;type:bigint;default:0;NOT NULL"` // 项目ID(雪花ID)
ProductID string `gorm:"column:product_id;type:char(11);NOT NULL"` // 产品id,为空则不限定分组内的产品类型
Expand Down
42 changes: 21 additions & 21 deletions src/syssvr/internal/logic/menu/menuUpdateLogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,33 @@ func (l *MenuUpdateLogic) MenuUpdate(in *sys.MenuUpdateReq) (*sys.Response, erro
l.Logger.Error("UserInfoModel.FindOne err , sql:%s", l.svcCtx)
return nil, err
}
if in.Type != 1 && in.Type != 2 && in.Type != 3 {
in.Type = mi.Type
if in.Type != 0 {
mi.Type = in.Type
}
if in.Order == 0 {
in.Order = mi.Order
if in.Order != 0 {
mi.Order = in.Order
}
if in.HideInMenu == 0 {
in.HideInMenu = mi.HideInMenu
if in.HideInMenu != 0 {
mi.HideInMenu = in.HideInMenu
}

if in.ParentID == 0 {
in.ParentID = mi.ParentID
if in.ParentID != 0 {
mi.ParentID = in.ParentID
}
if in.Component != "" {
mi.Component = in.Component
}
if in.Name != "" {
mi.Name = in.Name
}
if in.Icon != "" {
mi.Icon = in.Icon
}
if in.Path != "" {
mi.Path = in.Path
}

err = l.MiDB.Update(l.ctx, &relationDB.SysMenuInfo{
ID: in.Id,
ParentID: in.ParentID,
Type: in.Type,
Order: in.Order,
Name: in.Name,
Path: in.Path,
Component: in.Component,
Icon: in.Icon,
Redirect: in.Redirect,
BackgroundUrl: "",
HideInMenu: in.HideInMenu,
})
err = l.MiDB.Update(l.ctx, mi)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion src/syssvr/internal/repo/relationDB/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type SysExample struct {

// 用户登录信息表
type SysUserInfo struct {
UserID int64 `gorm:"column:user_id;primary_key;type:BIGINT;NOT NULL"` // 用户id
UserID int64 `gorm:"column:user_id;primary_key;AUTO_INCREMENT;type:BIGINT;NOT NULL"` // 用户id
UserName sql.NullString `gorm:"column:user_name;uniqueIndex;type:VARCHAR(20)"` // 登录用户名
Password string `gorm:"column:password;type:CHAR(32);NOT NULL"` // 登录密码
Email sql.NullString `gorm:"column:email;uniqueIndex;type:VARCHAR(255)"` // 邮箱
Expand Down

0 comments on commit bef2d2f

Please sign in to comment.