final_site_state_record.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package final
  2. import (
  3. "fmt"
  4. "zhiyuan/pkg/db"
  5. "github.com/gin-gonic/gin"
  6. )
  7. type FinalSiteStateRecord struct {
  8. ID int64 `json:"id" prop:"add:false"`
  9. SiteId int64 `json:"site_id" label:"套餐" type:"int" prop:"add edit" search:"="`
  10. State int64 `json:"state" label:"状态" type:"int" prop:"add:false edit" default:"2"`
  11. CreatedId int64 `json:"created_id" label:"创建人员" type:"int" prop:"add:false" search:"="`
  12. DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"`
  13. CreatedAt int64 `json:"created_at" prop:"add:false"`
  14. UpdatedAt int64 `json:"updated_at" prop:"add:false"`
  15. db.BaseModel
  16. }
  17. func (FinalSiteStateRecord) TableName() string {
  18. return "zy_final_site_state_record"
  19. }
  20. func (model FinalSiteStateRecord) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  21. return true
  22. }
  23. func (FinalSiteStateRecord) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
  24. data["created_id"] = c.GetInt("adminID")
  25. return nil
  26. }
  27. type FinalSiteStateRecordMobile struct {
  28. CreatedName string `json:"created_name" type:"string" prop:"select:created.username"`
  29. CreatedPhone string `json:"created_phone" type:"string" prop:"select:created.phone"`
  30. FinalSiteStateRecord
  31. }
  32. func (model FinalSiteStateRecordMobile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  33. return true
  34. }
  35. func (model FinalSiteStateRecordMobile) GroupBy() string {
  36. return fmt.Sprintf("`%s`.`id`", model.TableName())
  37. }
  38. func (model FinalSiteStateRecordMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel {
  39. return append(model.FinalSiteStateRecord.LeftJoin(data, s),
  40. db.JoinModel{
  41. Model: JoinAdmin{},
  42. As: "created",
  43. On: []string{"`created`.`id` = " + model.TableName() + ".`created_id`"},
  44. })
  45. }
  46. func (FinalSiteStateRecordMobile) Page() bool {
  47. return false
  48. }
  49. func (FinalSiteStateRecordMobile) Count() bool {
  50. return true
  51. }