审查视图

pkg/domain/partner_info.go 2.2 KB
tangxvhui authored
1 2
package domain
唐旭辉 authored
3 4 5
import (
	"time"
)
tangxvhui authored
6
7 8 9 10 11 12
// 状态(1:启用或者0:禁用)
const (
	PARTNER_STATUS_NO  int = 0
	PARTNER_STATUS_YES int = 1
)
13
//合伙类别 (1.事业合伙人 2.业务合伙人  3.研发合伙人)
唐旭辉 authored
14 15 16 17 18 19
// const (
// 	PARTNER_CATEGORY_1 int = 1
// 	PARTNER_CATEGORY_2 int = 2
// 	PARTNER_CATEGORY_3 int = 3
// 	PARTNER_CATEGORY_4 int = 4
// )
20
唐旭辉 authored
21 22 23 24 25 26 27
// //partnerCategoryMap 合伙类别键值对 (只读,请勿在运行时修改)
// var partnerCategoryMap = map[int]string{
// 	PARTNER_CATEGORY_1: "事业合伙人",
// 	PARTNER_CATEGORY_2: "业务合伙人",
// 	PARTNER_CATEGORY_3: "研发合伙人",
// 	PARTNER_CATEGORY_4: "业务-产品应用合伙人",
// }
唐旭辉 authored
28
tangxvhui authored
29
type PartnerInfo struct {
tangxvhui authored
30
	Partner Partner `json:"partner"`
tangxvhui authored
31 32 33 34 35 36 37 38
	// 登录密码
	Password string `json:"password"`
	// 状态(1:启用或者0:禁用)
	Status int `json:"status"`
	//创建时间
	CreateAt time.Time `json:"createAt"`
	//更新时间
	UpdateAt time.Time `json:"updateAt"`
.  
tangxvhui authored
39 40
	//合作时间
	CooperateTime time.Time `json:"cooperateTime"`
唐旭辉 authored
41
	//所属区域信息
唐旭辉 authored
42
	RegionInfo RegionInfo `json:"regionInfo"`
唐旭辉 authored
43
	//关联业务员
44
	Salesman []Salesman `json:"salesman"`
唐旭辉 authored
45
	//合伙人分类
唐旭辉 authored
46
	PartnerCategoryInfos []PartnerCategory `json:"partnerCategoryInfos"`
唐旭辉 authored
47 48
	//合伙类别
	PartnerCategory int `json:"partnerCategory"`
唐旭辉 authored
49 50
	//公司id
	CompanyId int64 `json:"companyId"`
51 52
	//备注
	Remark string `json:"remark"`
tangxvhui authored
53 54
}
唐旭辉 authored
55 56
func (p *PartnerInfo) IsUsable() bool {
	return p.Status == PARTNER_STATUS_YES
唐旭辉 authored
57 58
}
唐旭辉 authored
59 60 61 62
func (p *PartnerInfo) IsCompany(companyId int64) bool {
	return p.CompanyId == companyId
}
.  
tangxvhui authored
63 64 65
type PartnerFindOneQuery struct {
	UserId       int64
	AccountEqual string
唐旭辉 authored
66
	CompanyId    int64
.  
tangxvhui authored
67
}
tangxvhui authored
68
.  
tangxvhui authored
69 70 71 72 73 74
type PartnerFindQuery struct {
	Offset          int
	Limit           int
	PartnerCategory []int       //合伙人类型
	RegionInfo      *RegionInfo //区域
	PartnerName     string      //合伙人姓名
唐旭辉 authored
75 76
	CompanyId       int64
	Ids             []int64
77
	PartnerType     []*PartnerCategory
tangxvhui authored
78 79
}
.  
tangxvhui authored
80
type PartnerInfoRepository interface {
唐旭辉 authored
81
	Save(dm *PartnerInfo) error
.  
tangxvhui authored
82 83
	FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error)
	Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error)
84
	Remove(Id int64) error
.  
tangxvhui authored
85
	CountAll(queryOptions PartnerFindQuery) (int, error)
tangxvhui authored
86
}