cooperation_contract_relevant.go 3.4 KB
package domain

import "time"

// CooperationContractRelevant 共创合约相关人
type CooperationContractRelevant struct {
	// 共创合约相关人id
	CooperationContractRelevantId int64 `json:"cooperationContractRelevantId,string"`
	// 共创合约编号
	CooperationContractNumber string `json:"cooperationContractNumber"`
	// 相关人
	Relevant *Relevant `json:"relevant"`
	// 更新时间
	UpdatedAt time.Time `json:"updatedAt"`
	// 删除时间
	DeletedAt time.Time `json:"deletedAt"`
	// 创建时间
	CreatedAt time.Time `json:"createdAt"`
}

type CooperationContractRelevantRepository interface {
	Save(cooperationContractRelevant *CooperationContractRelevant) (*CooperationContractRelevant, error)
	Remove(cooperationContractRelevant *CooperationContractRelevant) (*CooperationContractRelevant, error)
	FindOne(queryOptions map[string]interface{}) (*CooperationContractRelevant, error)
	Find(queryOptions map[string]interface{}) (int64, []*CooperationContractRelevant, error)
}

func (cooperationContractRelevant *CooperationContractRelevant) Identify() interface{} {
	if cooperationContractRelevant.CooperationContractRelevantId == 0 {
		return nil
	}
	return cooperationContractRelevant.CooperationContractRelevantId
}

func (cooperationContractRelevant *CooperationContractRelevant) Update(data map[string]interface{}) error {
	if cooperationContractRelevantId, ok := data["cooperationContractRelevantId"]; ok {
		cooperationContractRelevant.CooperationContractRelevantId = cooperationContractRelevantId.(int64)
	}
	if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
		cooperationContractRelevant.CooperationContractNumber = cooperationContractNumber.(string)
	}
	if userId, ok := data["userId"]; ok {
		cooperationContractRelevant.Relevant.UserId = userId.(int64)
	}
	if userBaseId, ok := data["userBaseId"]; ok {
		cooperationContractRelevant.Relevant.UserBaseId = userBaseId.(int64)
	}
	if orgId, ok := data["orgId"]; ok {
		cooperationContractRelevant.Relevant.Org.OrgId = orgId.(int64)
	}
	if orgName, ok := data["orgName"]; ok {
		cooperationContractRelevant.Relevant.Org.OrgName = orgName.(string)
	}
	if companyId, ok := data["companyId"]; ok {
		cooperationContractRelevant.Relevant.Org.Company.CompanyId = companyId.(int64)
	}
	if companyLogo, ok := data["companyLogo"]; ok {
		cooperationContractRelevant.Relevant.Org.Company.CompanyLogo = companyLogo.(string)
	}
	if companyName, ok := data["companyName"]; ok {
		cooperationContractRelevant.Relevant.Org.Company.CompanyName = companyName.(string)
	}
	if userAvatar, ok := data["userAvatar"]; ok {
		cooperationContractRelevant.Relevant.UserInfo.UserAvatar = userAvatar.(string)
	}
	if userEmail, ok := data["userEmail"]; ok {
		cooperationContractRelevant.Relevant.UserInfo.UserEmail = userEmail.(string)
	}
	if userName, ok := data["userName"]; ok {
		cooperationContractRelevant.Relevant.UserInfo.UserName = userName.(string)
	}
	if userPhone, ok := data["userPhone"]; ok {
		cooperationContractRelevant.Relevant.UserInfo.UserPhone = userPhone.(string)
	}
	if userAccount, ok := data["userAccount"]; ok {
		cooperationContractRelevant.Relevant.UserInfo.UserAccount = userAccount.(string)
	}
	if userType, ok := data["userType"]; ok {
		cooperationContractRelevant.Relevant.UserType = userType.(int32)
	}
	if status, ok := data["status"]; ok {
		cooperationContractRelevant.Relevant.Status = status.(int32)
	}
	cooperationContractRelevant.UpdatedAt = time.Now()
	return nil
}