property.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package budget
  2. import (
  3. "zhiyuan/pkg/db"
  4. "github.com/gin-gonic/gin"
  5. )
  6. type Property struct {
  7. ID int64 `json:"id" prop:"add:false"`
  8. ModeId int64 `json:"modeId" type:"int" prop:"add" search:"="`
  9. ModuleId int64 `json:"moduleId" type:"int" prop:"add" search:"="`
  10. ItemId int64 `json:"itemId" type:"int" prop:"add" search:"="`
  11. QuoteId int64 `json:"quoteId" type:"int" prop:"add" search:"="`
  12. TableId int64 `json:"tableId" type:"int" prop:"add" search:"="`
  13. RowId int64 `json:"rowId" type:"int" prop:"add" search:"="`
  14. Name string `json:"name" label:"属性名称" type:"string" prop:"add edit" search:"like"`
  15. Value string `json:"value" label:"属性值" type:"string" prop:"edit" search:"="`
  16. OrderAt int64 `json:"order_at" prop:"add:false select:false"`
  17. DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"`
  18. CreatedAt int64 `json:"created_at" prop:"add:false select:false"`
  19. UpdatedAt int64 `json:"updated_at" prop:"add:false select:false"`
  20. db.BaseModel
  21. }
  22. func (Property) TableName() string {
  23. return "zy_budget_property"
  24. }
  25. func (Property) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
  26. return true
  27. }
  28. func (Property) OnePrivilege(c *gin.Context, id int64) bool {
  29. return true
  30. }
  31. func (Property) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
  32. return nil
  33. }
  34. func (Property) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
  35. return nil
  36. }
  37. func (Property) DelPrivilege(c *gin.Context, id int64) error {
  38. return nil
  39. }
  40. func (Property) OrderField() string {
  41. return "order_at"
  42. }
  43. func (Property) Page() bool {
  44. return true
  45. }
  46. func (Property) Count() bool {
  47. return true
  48. }
  49. func findProps(modeId int64, moduleId int64, itemId int64, quoteId int64, tableId int64, rowId int64, list []Property) []Property {
  50. props := make([]Property, 0)
  51. for _, v := range list {
  52. if v.ModeId == modeId && v.ModuleId == moduleId && v.ItemId == itemId && v.QuoteId == quoteId && v.TableId == tableId && v.RowId == rowId {
  53. props = append(props, v)
  54. }
  55. }
  56. return props
  57. }