interface.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package backend
  2. import (
  3. "context"
  4. "kpt-tmr-group/config"
  5. "kpt-tmr-group/pkg/di"
  6. operationPb "kpt-tmr-group/proto/go/backend/operation"
  7. "kpt-tmr-group/service/excel"
  8. "kpt-tmr-group/store/kptstore"
  9. "github.com/gin-gonic/gin"
  10. "go.uber.org/dig"
  11. )
  12. var Module = di.Options(di.Provide(NewStore))
  13. type Hub struct {
  14. dig.In
  15. OpsService KptService
  16. }
  17. type StoreEntry struct {
  18. dig.In
  19. Cfg *config.AppConfig
  20. DB *kptstore.DB
  21. //SSO *sso.Cache
  22. // AsynqClient asynqsvc.Client
  23. // Cache *redis.Client
  24. ExcelClient *excel.ExcelServer
  25. }
  26. func NewStore(store StoreEntry) KptService {
  27. return &store
  28. }
  29. type KptService interface {
  30. Operation
  31. SystemOperation
  32. }
  33. type Operation interface {
  34. // CreateGroupPasture 牧场管理相关
  35. CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  36. EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  37. SearchGroupPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*operationPb.SearchPastureResponse, error)
  38. DeleteGroupPasture(ctx context.Context, pastureId int64) error
  39. ResetPasswordGroupPasture(ctx context.Context, req *operationPb.RestPasswordGroupPasture) error
  40. IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error
  41. // ParentCattleCategoryList 牧畜类别
  42. ParentCattleCategoryList(ctx context.Context) map[operationPb.CattleCategoryParent_Kind]string
  43. AddCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  44. EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  45. IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error
  46. DeleteCattleCategory(ctx context.Context, cattleCategoryId int64) error
  47. SearchCattleCategoryList(ctx context.Context, req *operationPb.SearchCattleCategoryRequest) (*operationPb.SearchCattleCategoryResponse, error)
  48. // ParentForageCategoryList 饲料类别相关
  49. ParentForageCategoryList(ctx context.Context) map[operationPb.ForageCategoryParent_Kind]string
  50. AddForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  51. EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  52. IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error
  53. DeleteForageCategory(ctx context.Context, cattleCategoryId int64) error
  54. SearchForageCategoryList(ctx context.Context, req *operationPb.SearchForageCategoryRequest) (*operationPb.SearchForageCategoryResponse, error)
  55. // CreateForage 饲料相关
  56. CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error
  57. EditForage(ctx context.Context, req *operationPb.AddForageRequest) error
  58. SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error)
  59. ForageEnumList(ctx context.Context) *ForageEnumList
  60. DeleteForageList(ctx context.Context, ids []int64) error
  61. IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error
  62. ImportForage(ctx context.Context) error
  63. ExportForage(ctx *gin.Context, req *operationPb.SearchForageListRequest) error
  64. }
  65. type SystemOperation interface {
  66. // Auth 系统用户相关
  67. Auth(ctx context.Context, auth *operationPb.UserAuthData) (*operationPb.SystemToken, error)
  68. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  69. CreateSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  70. SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*operationPb.SearchUserResponse, error)
  71. EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  72. DeleteSystemUser(ctx context.Context, userId int64) error
  73. IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error
  74. GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error)
  75. // CreateSystemRole 系统角色相关
  76. CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  77. EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  78. DeleteSystemRole(ctx context.Context, roleId int64) error
  79. GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error)
  80. SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*operationPb.SearchRoleResponse, error)
  81. // CreateSystemMenu 系统菜单权限
  82. CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  83. EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  84. IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error
  85. SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*operationPb.SearchMenuResponse, error)
  86. DeleteSystemMenu(ctx context.Context, menuId int64) error
  87. // SearchMobileList 移动端
  88. SearchMobileList(ctx context.Context, req *operationPb.SearchMobileRequest) (*operationPb.SearchMobileResponse, error)
  89. }