作者 tangxvhui

更新

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