12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package model
- import (
- operationPb "kpt-tmr-group/proto/go/backend/operation"
- "time"
- )
- type SystemMenu struct {
- Id int64 `json:"id,omitempty"`
- Name string `json:"name,omitempty"`
- MenuType int32 `json:"menu_type,omitempty"`
- GroupType int32 `json:"group_type,omitempty"`
- Title string `json:"title,omitempty"`
- Path string `json:"path,omitempty"`
- IsShow operationPb.IsShow_Kind `json:"is_show,omitempty"`
- IsDelete operationPb.IsShow_Kind `json:"is_delete,omitempty"`
- Component string `json:"component,omitempty"`
- Icon string `json:"icon,omitempty"`
- Sort int32 `json:"sort,omitempty"`
- ParentId int64 `json:"parent_id"`
- Redirect string `json:"redirect,omitempty"`
- CreatedAt int64 `json:"created_at,omitempty"`
- UpdatedAt int64 `json:"updated_at,omitempty"`
- }
- func (s *SystemMenu) TableName() string {
- return "system_menu"
- }
- type SystemMenuSlice []*SystemMenu
- func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
- res := make([]*operationPb.AddMenuRequest, len(s))
- for i, v := range s {
- res[i] = &operationPb.AddMenuRequest{
- Id: v.Id,
- Name: v.Name,
- MenuType: v.MenuType,
- Title: v.Title,
- IsShow: v.IsShow,
- Component: v.Component,
- Icon: v.Icon,
- Sort: v.Sort,
- Redirect: v.Redirect,
- ParentId: v.ParentId,
- CreatedAt: v.CreatedAt,
- CratedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
- }
- }
- return res
- }
- func (s *SystemMenu) ToPb() *operationPb.AddMenuRequest {
- return &operationPb.AddMenuRequest{
- Id: s.Id,
- Name: s.Name,
- MenuType: s.MenuType,
- Title: s.Title,
- Path: s.Path,
- Component: s.Component,
- Icon: s.Icon,
- Sort: s.Sort,
- Redirect: s.Redirect,
- ParentId: s.ParentId,
- IsShow: s.IsShow,
- CreatedAt: s.CreatedAt,
- }
- }
- type SystemMenuResponse struct {
- Page int32 `json:"page"`
- Total int32 `json:"total"`
- List []*operationPb.AddMenuRequest `json:"list"`
- }
- func (s *SystemMenuResponse) ToPB() *operationPb.SearchMenuResponse {
- return &operationPb.SearchMenuResponse{
- Page: s.Page,
- Total: s.Total,
- List: s.List,
- }
- }
|