feat: 初次启动

This commit is contained in:
Blizzard
2026-04-27 21:23:13 +08:00
parent e515f6a287
commit bb8ad4d515
148 changed files with 8602 additions and 5678 deletions
@@ -1,13 +1,11 @@
// Code scaffolded by goctl. Safe to edit.
package menu
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"sundynix-micro-go/app/system/api/internal/svc"
"sundynix-micro-go/app/system/api/internal/types"
sysModel "sundynix-micro-go/app/system/model"
"sundynix-micro-go/app/system/rpc/system"
)
type UpdateMenuLogic struct {
@@ -21,41 +19,10 @@ func NewUpdateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update
}
func (l *UpdateMenuLogic) UpdateMenu(req *types.MenuUpdateReq) error {
updates := map[string]interface{}{}
if req.ParentId != "" {
updates["parent_id"] = req.ParentId
}
if req.Name != "" {
updates["name"] = req.Name
}
if req.Title != "" {
updates["title"] = req.Title
}
if req.Code != "" {
updates["code"] = req.Code
}
if req.Path != "" {
updates["path"] = req.Path
}
if req.Permission != "" {
updates["permission"] = req.Permission
}
if req.Locale != "" {
updates["locale"] = req.Locale
}
if req.Icon != "" {
updates["icon"] = req.Icon
}
if req.Sort > 0 {
updates["sort"] = req.Sort
}
if req.Category > 0 {
updates["category"] = req.Category
}
if len(updates) > 0 {
if err := l.svcCtx.DB.Model(&sysModel.SundynixMenu{}).Where("id = ?", req.Id).Updates(updates).Error; err != nil {
return fmt.Errorf("更新菜单失败")
}
}
return nil
_, err := l.svcCtx.SystemRpc.UpdateMenu(l.ctx, &system.MenuUpdateReq{
Id: req.Id, ParentId: req.ParentId, Category: int32(req.Category), Name: req.Name, Title: req.Title,
Code: req.Code, Path: req.Path, Permission: req.Permission, Locale: req.Locale,
Icon: req.Icon, Sort: int32(req.Sort),
})
return err
}