File tree 5 files changed +27
-6
lines changed
5 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 30
30
generate bool
31
31
username string
32
32
password string
33
+ domain string
33
34
system bool
34
35
configProvider string
35
36
driver string
@@ -59,6 +60,8 @@ func init() {
59
60
"admin" , "system super administrator login username" )
60
61
StartCmd .PersistentFlags ().StringVarP (& password , "password" , "p" ,
61
62
"123456" , "system super administrator login password" )
63
+ StartCmd .PersistentFlags ().StringVarP (& domain , "domain" , "d" ,
64
+ "localhost:8000" , "system tenant domain" )
62
65
StartCmd .PersistentFlags ().StringVarP (& driver ,
63
66
"gorm-driver" , "r" ,
64
67
"mysql" , "Start server with db driver" )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package system
2
2
3
3
import (
4
4
"runtime"
5
+ "strings"
5
6
"time"
6
7
7
8
adminPKG "github.com/mss-boot-io/mss-boot-admin/pkg"
@@ -13,8 +14,11 @@ import (
13
14
"gorm.io/gorm"
14
15
)
15
16
16
- var Username string
17
- var Password string
17
+ var (
18
+ Username string
19
+ Password string
20
+ Domain string
21
+ )
18
22
19
23
func init () {
20
24
_ , fileName , _ , _ := runtime .Caller (0 )
@@ -171,6 +175,10 @@ oauth2:
171
175
Password : Password ,
172
176
},
173
177
}
178
+ if Domain != "" {
179
+ tenant .Domains [0 ].Name = strings .Split (Domain , ":" )[0 ]
180
+ tenant .Domains [0 ].Domain = Domain
181
+ }
174
182
err = tx .Create (tenant ).Error
175
183
if err != nil {
176
184
return err
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ require (
22
22
github.com/gorilla/websocket v1.5.3
23
23
github.com/grafana/pyroscope-go v1.1.1
24
24
github.com/larksuite/oapi-sdk-go/v3 v3.3.0
25
- github.com/mss-boot-io/mss-boot v0.2.6-0.20240731101419-5f04fdc2ad35
25
+ github.com/mss-boot-io/mss-boot v0.2.6-0.20240806093818-eef02c463244
26
26
github.com/mss-boot-io/redisqueue/v2 v2.0.0-20240222064111-d36e396df7f9
27
27
github.com/nsqio/go-nsq v1.1.0
28
28
github.com/redis/go-redis/v9 v9.6.1
Original file line number Diff line number Diff line change @@ -573,8 +573,8 @@ github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJ
573
573
github.com/montanaflynn/stats v0.7.0 /go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow =
574
574
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE =
575
575
github.com/montanaflynn/stats v0.7.1 /go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow =
576
- github.com/mss-boot-io/mss-boot v0.2.6-0.20240731101419-5f04fdc2ad35 h1:iRvxKLVvcKRTrEz+HojyE5kUfUS1ZLhfYZH3fHEM/H4 =
577
- github.com/mss-boot-io/mss-boot v0.2.6-0.20240731101419-5f04fdc2ad35 /go.mod h1:frC6YvBpVBN/zCc2MNZT9RF+9tynB+ERLNbfQDLSHYg =
576
+ github.com/mss-boot-io/mss-boot v0.2.6-0.20240806093818-eef02c463244 h1:C14jtdPeIqs1Nbaz10Lm27z0STE2vbyeRzKmSR4a2WM =
577
+ github.com/mss-boot-io/mss-boot v0.2.6-0.20240806093818-eef02c463244 /go.mod h1:frC6YvBpVBN/zCc2MNZT9RF+9tynB+ERLNbfQDLSHYg =
578
578
github.com/mss-boot-io/redisqueue/v2 v2.0.0-20240222064111-d36e396df7f9 h1:/YgpHiqgrxz/0+mKoETXu21c6/fyDt7/j9bdD3UkbdU =
579
579
github.com/mss-boot-io/redisqueue/v2 v2.0.0-20240222064111-d36e396df7f9 /go.mod h1:f/sISkwvecPq37zygQzWNj5ntJoP/jcoK0kPIjFTWFI =
580
580
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA =
Original file line number Diff line number Diff line change @@ -70,7 +70,8 @@ type Menu struct {
70
70
// Sort 排序
71
71
Sort int `json:"sort" gorm:"column:sort;comment:排序;size:11;not null;default:0"`
72
72
// Children 子菜单
73
- Children []* Menu `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID" swaggerignore:"true"`
73
+ Children []* Menu `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID" swaggerignore:"true"`
74
+ ParentPath string `json:"parentPath" gorm:"-" swaggerignore:"true"`
74
75
}
75
76
76
77
func (x MenuList ) Len () int { return len (x ) }
@@ -89,6 +90,15 @@ func (e *Menu) BeforeCreate(tx *gorm.DB) error {
89
90
e .Type == pkg .ComponentAccessType {
90
91
e .HideInMenu = true
91
92
}
93
+ if e .ParentPath != "" {
94
+ var parent struct { ID string }
95
+ if tx .Model (& Menu {}).
96
+ Where ("path = ?" , e .ParentPath ).
97
+ Select ("id" ).
98
+ First (& parent ).Error == nil {
99
+ e .ParentID = parent .ID
100
+ }
101
+ }
92
102
return nil
93
103
}
94
104
You can’t perform that action at this time.
0 commit comments