作者 tangxvhui

更新

  1 +package company
  2 +
  3 +type CompanyAction struct {
  4 +}
  5 +
  6 +//从BusinessAdmins 接收消息,变更公司数据
  7 +func (c CompanyAction) BusinessAdminCompany() error {
  8 + return nil
  9 +}
  10 +
  11 +func (c CompanyAction) AddCompany() error {
  12 + return nil
  13 +}
  14 +
  15 +func (c CompanyAction) EditCompany() error {
  16 + return nil
  17 +}
  18 +
  19 +func (c CompanyAction) ChangeAdmin() error {
  20 + return nil
  21 +}
  22 +
  23 +func (c CompanyAction) SetCompanyCharge() error {
  24 + return nil
  25 +}
  1 +package user
  2 +
  3 +type UserService struct{}
  4 +
  5 +func (srv UserService) CreateUser() {}
  6 +
  7 +func (srv UserService) UpdateUser() {}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +type Company struct {
  6 + Id int64 //公司编号
  7 + Logo string //公司logo
  8 + Name string //公司名称
  9 + Status int //公司状态,1正常 2禁用
  10 + UpdateAt time.Time //更新时间
  11 + CreatedAt time.Time //创建时间
  12 +}
  13 +
  14 +type CompanyRepository interface {
  15 + Save(company *Company) (*Company, error)
  16 + Remove(company *Company) (*Company, error)
  17 + FindOne(queryOptions map[string]interface{}) (*Company, error)
  18 + Find(queryOptions map[string]interface{}) (int64, []*Company, error)
  19 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +type Organization struct {
  6 + OrganizationId int64 // 组织id
  7 + CompanyId int64 // 公司编号
  8 + OrganizationLevel int // 组织名称
  9 + OrganizationName string // 组织名称
  10 + OrganizationParentId int64 // 组织父级id
  11 + OrganizationPath []int64 // 组织路径
  12 + ChargeUserIds []int64 // 主管uids
  13 + Path string // 组织路径
  14 + CreateAt time.Time // 创建时间
  15 + UpdateAt time.Time // 更新时间
  16 +}
  1 +package domain
  2 +
  3 +import "time"
  4 +
  5 +type User struct {
  6 + UserId int64 // 用户Id
  7 + UserAccount string // 用户账号
  8 + UserAvatarUrl string // 用户头像URL
  9 + CompanyId int64 // 公司编号
  10 + IsPrincipal bool // 是否公司负责人
  11 + AdminType int // 1普通员工 2 主管理员
  12 + UserName string // 用户姓名
  13 + UserRoleId int64 // 用户角色id
  14 + UserStatus int // 用户状态(1正常 2禁用)
  15 + UpdateAt time.Time // 更新时间
  16 +}
  17 +
  18 +type UserRepository interface {
  19 + Save(user *User) (*User, error)
  20 + Remove(user *User) (*User, error)
  21 + FindOne(queryOptions map[string]interface{}) (*User, error)
  22 + Find(queryOptions map[string]interface{}) (int64, []*User, error)
  23 +}
  1 +package repository
  2 +
  3 +import (
  4 + "errors"
  5 +
  6 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  7 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  8 +)
  9 +
  10 +type CompanyRepository struct {
  11 + transactionContext *pgTransaction.TransactionContext
  12 +}
  13 +
  14 +var _ domain.CompanyRepository = (*CompanyRepository)(nil)
  15 +
  16 +func (repo *CompanyRepository) Save(user *domain.Company) (*domain.Company, error) {
  17 + return user, nil
  18 +}
  19 +
  20 +func (repo *CompanyRepository) Remove(user *domain.Company) (*domain.Company, error) {
  21 + // tx := repository.transactionContext.PgTx
  22 + // userModel := new(models.Company)
  23 + // userModel.UserId = user.Identify().(int64)
  24 + // if _, err := tx.Model(userModel).WherePK().Delete(); err != nil {
  25 + // return user, err
  26 + // }
  27 + return user, errors.New("no support")
  28 +}
  29 +
  30 +func (repo *CompanyRepository) FindOne(queryOptions map[string]interface{}) (*domain.Company, error) {
  31 + return nil, nil
  32 +}
  33 +
  34 +func (repo *CompanyRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.Company, error) {
  35 + return 0, nil, nil
  36 +}
  1 +package repository
  2 +
  3 +import (
  4 + "errors"
  5 +
  6 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  7 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  8 +)
  9 +
  10 +type UserRepository struct {
  11 + transactionContext *pgTransaction.TransactionContext
  12 +}
  13 +
  14 +var _ domain.UserRepository = (*UserRepository)(nil)
  15 +
  16 +func (repo *UserRepository) Save(user *domain.User) (*domain.User, error) {
  17 + return user, nil
  18 +}
  19 +
  20 +func (repo *UserRepository) Remove(user *domain.User) (*domain.User, error) {
  21 + // tx := repository.transactionContext.PgTx
  22 + // userModel := new(models.User)
  23 + // userModel.UserId = user.Identify().(int64)
  24 + // if _, err := tx.Model(userModel).WherePK().Delete(); err != nil {
  25 + // return user, err
  26 + // }
  27 + return user, errors.New("no support")
  28 +}
  29 +
  30 +func (repo *UserRepository) FindOne(queryOptions map[string]interface{}) (*domain.User, error) {
  31 + return nil, nil
  32 +}
  33 +
  34 +func (repo *UserRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.User, error) {
  35 + return 0, nil, nil
  36 +}
@@ -8,7 +8,8 @@ import ( @@ -8,7 +8,8 @@ import (
8 func init() { 8 func init() {
9 h1 := web.NewNamespace("/v1/demo", 9 h1 := web.NewNamespace("/v1/demo",
10 web.NSCtrlGet("/hello", (*controllers.HelloController).Say), 10 web.NSCtrlGet("/hello", (*controllers.HelloController).Say),
11 - web.NSGet("/hello1", controllers.SayHello), 11 + web.NSCtrlGet("/hello2", (*controllers.HelloController).Say),
  12 + // web.NSGet("/hello1", controllers.SayHello),
12 ) 13 )
13 web.AddNamespace(h1) 14 web.AddNamespace(h1)
14 } 15 }