final_site_change_file.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package final
  2. import (
  3. "fmt"
  4. "zhiyuan/pkg/db"
  5. "github.com/gin-gonic/gin"
  6. )
  7. type FinalSiteChangeFile struct {
  8. ID int64 `json:"id" prop:"add:false"`
  9. SiteId int64 `json:"site_id" label:"套餐" type:"int" prop:"add edit" search:"="`
  10. Files string `json:"files" label:"文件上传" type:"string" prop:"edit"`
  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 (FinalSiteChangeFile) TableName() string {
  18. return "zy_final_site_change_file"
  19. }
  20. func (model FinalSiteChangeFile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  21. return true
  22. }
  23. func (FinalSiteChangeFile) 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. func (FinalSiteChangeFile) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
  28. return nil
  29. }
  30. func (FinalSiteChangeFile) DelPrivilege(c *gin.Context, id int64) error {
  31. return nil
  32. }
  33. func (FinalSiteChangeFile) Page() bool {
  34. return false
  35. }
  36. func (FinalSiteChangeFile) Count() bool {
  37. return true
  38. }
  39. type FinalSiteChangeFileMobile struct {
  40. CreatedName string `json:"created_name" type:"string" prop:"select:created.username"`
  41. CreatedPhone string `json:"created_phone" type:"string" prop:"select:created.phone"`
  42. FinalSiteChangeFile
  43. }
  44. func (model FinalSiteChangeFileMobile) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  45. return true
  46. }
  47. func (model FinalSiteChangeFileMobile) GroupBy() string {
  48. return fmt.Sprintf("`%s`.`id`", model.TableName())
  49. }
  50. func (model FinalSiteChangeFileMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel {
  51. return append(model.FinalSiteChangeFile.LeftJoin(data, s),
  52. db.JoinModel{
  53. Model: JoinAdmin{},
  54. As: "created",
  55. On: []string{"`created`.`id` = " + model.TableName() + ".`created_id`"},
  56. })
  57. }
  58. func (FinalSiteChangeFileMobile) Page() bool {
  59. return false
  60. }
  61. func (FinalSiteChangeFileMobile) Count() bool {
  62. return true
  63. }