package budget import ( "zhiyuan/pkg/db" "github.com/gin-gonic/gin" ) type Handle struct { ID int64 `json:"id" prop:"add:false"` QuoteId int64 `json:"quoteId" type:"int" prop:"add" search:"="` TableId int64 `json:"tableId" type:"int" prop:"add" search:"="` ModuleId int64 `json:"moduleId" type:"int" prop:"add" search:"="` RowId int64 `json:"rowId" type:"int" prop:"add" search:"="` Name string `json:"name" label:"名称" type:"string" prop:"add edit" search:"like"` Value string `json:"value" label:"属性值" type:"string" prop:"edit"` OrderAt int64 `json:"order_at" prop:"add:false select:false"` DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"` CreatedAt int64 `json:"created_at" prop:"add:false select:false"` UpdatedAt int64 `json:"updated_at" prop:"add:false select:false"` db.BaseModel } func (Handle) TableName() string { return "zy_budget_handle" } func (Handle) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (Handle) OnePrivilege(c *gin.Context, id int64) bool { return true } func (Handle) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error { return nil } func (Handle) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error { return nil } func (Handle) DelPrivilege(c *gin.Context, id int64) error { return nil } func (Handle) OrderField() string { return "order_at" } func (Handle) Page() bool { return false } func (Handle) Count() bool { return false } func findModuleHandles(tableId int64, list []Handle) map[int64][]Handle { handles := make(map[int64][]Handle, 0) for _, v := range list { if v.TableId == tableId && v.RowId == 0 { if _, ok := handles[v.ModuleId]; !ok { handles[v.ModuleId] = make([]Handle, 0) } handles[v.ModuleId] = append(handles[v.ModuleId], v) } } return handles } func findHandles(tableId int64, rowId int64, list []Handle) []Handle { handles := make([]Handle, 0) for _, v := range list { if v.TableId == tableId && v.RowId == rowId { handles = append(handles, v) } } return handles }