优化结构

This commit is contained in:
Yvan
2026-08-22 12:13:16 +08:00
parent d987244d0e
commit b27a66e9d3
200 changed files with 1794 additions and 1715 deletions
+4 -5
View File
@@ -3,16 +3,15 @@ package system
import (
"context"
"errors"
"kra/internal/biz/system"
"time"
"kra/internal/biz"
"gorm.io/gorm"
)
type permissionRepo struct{ data Provider }
func NewPermissionRepo(data Provider) biz.PermissionRepo { return &permissionRepo{data: data} }
func NewPermissionRepo(data Provider) system.PermissionRepo { return &permissionRepo{data: data} }
type menuButtonPO struct {
ID uint `gorm:"primaryKey"`
@@ -34,12 +33,12 @@ type authorityButtonPO struct {
func (authorityButtonPO) TableName() string { return "sys_authority_btns" }
func (r *permissionRepo) Buttons(ctx context.Context, menuID uint) ([]*biz.MenuButton, error) {
func (r *permissionRepo) Buttons(ctx context.Context, menuID uint) ([]*system.MenuButton, error) {
var pos []menuButtonPO
if err := r.data.DB().WithContext(ctx).Where("sys_base_menu_id = ?", menuID).Find(&pos).Error; err != nil {
return nil, err
}
out := make([]*biz.MenuButton, 0, len(pos))
out := make([]*system.MenuButton, 0, len(pos))
for _, po := range pos {
out = append(out, menuButtonFromPO(po))
}