package final import ( "fmt" "zhiyuan/pkg/db" "github.com/gin-gonic/gin" ) type FinalSiteChangeFile struct { ID int64 `json:"id" prop:"add:false"` SiteId int64 `json:"site_id" label:"套餐" type:"int" prop:"add edit" search:"="` Files string `json:"files" label:"文件上传" type:"string" prop:"edit"` CreatedId int64 `json:"created_id" label:"创建人员" type:"int" prop:"add:false" search:"="` DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"` CreatedAt int64 `json:"created_at" prop:"add:false"` UpdatedAt int64 `json:"updated_at" prop:"add:false"` db.BaseModel } func (FinalSiteChangeFile) TableName() string { return "zy_final_site_change_file" } func (model FinalSiteChangeFile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (FinalSiteChangeFile) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error { data["created_id"] = c.GetInt("adminID") return nil } func (FinalSiteChangeFile) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error { return nil } func (FinalSiteChangeFile) DelPrivilege(c *gin.Context, id int64) error { return nil } func (FinalSiteChangeFile) Page() bool { return false } func (FinalSiteChangeFile) Count() bool { return true } type FinalSiteChangeFileMobile struct { CreatedName string `json:"created_name" type:"string" prop:"select:created.username"` CreatedPhone string `json:"created_phone" type:"string" prop:"select:created.phone"` FinalSiteChangeFile } func (model FinalSiteChangeFileMobile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (model FinalSiteChangeFileMobile) GroupBy() string { return fmt.Sprintf("`%s`.`id`", model.TableName()) } func (model FinalSiteChangeFileMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel { return append(model.FinalSiteChangeFile.LeftJoin(data, s), db.JoinModel{ Model: JoinAdmin{}, As: "created", On: []string{"`created`.`id` = " + model.TableName() + ".`created_id`"}, }) } func (FinalSiteChangeFileMobile) Page() bool { return false } func (FinalSiteChangeFileMobile) Count() bool { return true }