cooperation_contract_change_log.go 4.7 KB
package domain

import "time"

// CooperationContractChangeLog 共创合约变更日志
type CooperationContractChangeLog struct {
	// 共创合约变更日志
	CooperationContractChangeLogId int64 `json:"cooperationContractChangeLogId,string"`
	// 激励规则
	IncentivesRule string `json:"incentivesRule"`
	// 激励规则明细
	IncentivesRuleDetail string `json:"incentivesRuleDetail"`
	// 合约变更操作类型,1编辑、2暂停、3恢复
	OperationType int32 `json:"operationType"`
	// 共创合约编号
	CooperationContractNumber string `json:"cooperationContractNumber"`
	// 承接人
	Undertakers string `json:"undertakers"`
	// 公司
	Company *Company `json:"company"`
	// 操作人
	Operator *User `json:"operator"`
	// 更新时间
	UpdatedAt time.Time `json:"updatedAt"`
	// 删除时间
	DeletedAt time.Time `json:"deletedAt"`
	// 创建时间
	CreatedAt time.Time `json:"createdAt"`
}

type CooperationContractChangeLogRepository interface {
	Save(cooperationContractChangeLog *CooperationContractChangeLog) (*CooperationContractChangeLog, error)
	Remove(cooperationContractChangeLog *CooperationContractChangeLog) (*CooperationContractChangeLog, error)
	FindOne(queryOptions map[string]interface{}) (*CooperationContractChangeLog, error)
	Find(queryOptions map[string]interface{}) (int64, []*CooperationContractChangeLog, error)
}

func (cooperationContractChangeLog *CooperationContractChangeLog) Identify() interface{} {
	if cooperationContractChangeLog.CooperationContractChangeLogId == 0 {
		return nil
	}
	return cooperationContractChangeLog.CooperationContractChangeLogId
}

func (cooperationContractChangeLog *CooperationContractChangeLog) Update(data map[string]interface{}) error {
	if incentivesRule, ok := data["incentivesRule"]; ok {
		cooperationContractChangeLog.IncentivesRule = incentivesRule.(string)
	}
	if incentivesRuleDetail, ok := data["incentivesRuleDetail"]; ok {
		cooperationContractChangeLog.IncentivesRuleDetail = incentivesRuleDetail.(string)
	}
	if operationType, ok := data["operationType"]; ok {
		cooperationContractChangeLog.OperationType = operationType.(int32)
	}
	if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
		cooperationContractChangeLog.CooperationContractNumber = cooperationContractNumber.(string)
	}
	if undertakers, ok := data["undertakers"]; ok {
		cooperationContractChangeLog.Undertakers = undertakers.(string)
	}
	if companyId, ok := data["companyId"]; ok {
		cooperationContractChangeLog.Company.CompanyId = companyId.(int64)
	}
	if companyLogo, ok := data["companyLogo"]; ok {
		cooperationContractChangeLog.Company.CompanyLogo = companyLogo.(string)
	}
	if companyName, ok := data["companyName"]; ok {
		cooperationContractChangeLog.Company.CompanyName = companyName.(string)
	}
	if userId, ok := data["userId"]; ok {
		cooperationContractChangeLog.Operator.UserId = userId.(int64)
	}
	if userBaseId, ok := data["userBaseId"]; ok {
		cooperationContractChangeLog.Operator.UserBaseId = userBaseId.(int64)
	}
	if orgId, ok := data["orgId"]; ok {
		cooperationContractChangeLog.Operator.Org.OrgId = orgId.(int64)
	}
	if orgName, ok := data["orgName"]; ok {
		cooperationContractChangeLog.Operator.Org.OrgName = orgName.(string)
	}
	if departmentId, ok := data["departmentId"]; ok {
		cooperationContractChangeLog.Operator.Department.DepartmentId = departmentId.(int64)
	}
	if departmentName, ok := data["departmentName"]; ok {
		cooperationContractChangeLog.Operator.Department.DepartmentName = departmentName.(string)
	}
	if departmentNumber, ok := data["departmentNumber"]; ok {
		cooperationContractChangeLog.Operator.Department.DepartmentNumber = departmentNumber.(string)
	}
	if roleId, ok := data["roleId"]; ok {
		cooperationContractChangeLog.Operator.Role.RoleId = roleId.(int64)
	}
	if roleName, ok := data["roleName"]; ok {
		cooperationContractChangeLog.Operator.Role.RoleName = roleName.(string)
	}
	if userAvatar, ok := data["userAvatar"]; ok {
		cooperationContractChangeLog.Operator.UserInfo.UserAvatar = userAvatar.(string)
	}
	if userEmail, ok := data["userEmail"]; ok {
		cooperationContractChangeLog.Operator.UserInfo.UserEmail = userEmail.(string)
	}
	if userName, ok := data["userName"]; ok {
		cooperationContractChangeLog.Operator.UserInfo.UserName = userName.(string)
	}
	if userPhone, ok := data["userPhone"]; ok {
		cooperationContractChangeLog.Operator.UserInfo.UserPhone = userPhone.(string)
	}
	if userAccount, ok := data["userAccount"]; ok {
		cooperationContractChangeLog.Operator.UserInfo.UserAccount = userAccount.(string)
	}
	if userType, ok := data["userType"]; ok {
		cooperationContractChangeLog.Operator.UserType = userType.(int32)
	}
	if status, ok := data["status"]; ok {
		cooperationContractChangeLog.Operator.Status = status.(int32)
	}
	return nil
}