package final import ( "fmt" "zhiyuan/pkg/db" "github.com/gin-gonic/gin" ) type FinalSiteStateRecord struct { ID int64 `json:"id" prop:"add:false"` SiteId int64 `json:"site_id" label:"套餐" type:"int" prop:"add edit" search:"="` State int64 `json:"state" label:"状态" type:"int" prop:"add:false edit" default:"2"` 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 (FinalSiteStateRecord) TableName() string { return "zy_final_site_state_record" } func (model FinalSiteStateRecord) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (FinalSiteStateRecord) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error { data["created_id"] = c.GetInt("adminID") return nil } type FinalSiteStateRecordMobile struct { CreatedName string `json:"created_name" type:"string" prop:"select:created.username"` CreatedPhone string `json:"created_phone" type:"string" prop:"select:created.phone"` FinalSiteStateRecord } func (model FinalSiteStateRecordMobile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (model FinalSiteStateRecordMobile) GroupBy() string { return fmt.Sprintf("`%s`.`id`", model.TableName()) } func (model FinalSiteStateRecordMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel { return append(model.FinalSiteStateRecord.LeftJoin(data, s), db.JoinModel{ Model: JoinAdmin{}, As: "created", On: []string{"`created`.`id` = " + model.TableName() + ".`created_id`"}, }) } func (FinalSiteStateRecordMobile) Page() bool { return false } func (FinalSiteStateRecordMobile) Count() bool { return true }