contract_undertaker_feedback.go 6.0 KB
package domain

import "time"

// 承接人反馈信息
type ContractUndertakerFeedback struct {
	// 合约承接方反馈记录ID
	FeedbackId int64 `json:"feedbackId,string"`
	// 合约承接方反馈内容附件
	FeedbackAttachment []*Attachment `json:"feedbackAttachment"`
	// 合约承接方反馈内容
	FeedbackContent string `json:"feedbackContent"`
	// 共创合约编号
	CooperationContractNumber string `json:"cooperationContractNumber"`
	// 共创合约承接人
	ContractUndertaker *User `json:"contractUndertaker"`
	// 共创模式
	CooperationMode *CooperationMode `json:"cooperationMode"`
	// 数据所属组织机构
	Org *Org `json:"org"`
	// 公司
	Company *Company `json:"company"`
	// 更新时间
	UpdatedAt time.Time `json:"updatedAt"`
	// 删除时间
	DeletedAt time.Time `json:"deletedAt"`
	// 反馈创建时间,同时也作为反馈时间
	CreatedAt time.Time `json:"createdAt"`
}

type ContractUndertakerFeedbackRepository interface {
	Save(contractUndertakerFeedback *ContractUndertakerFeedback) (*ContractUndertakerFeedback, error)
	Remove(contractUndertakerFeedback *ContractUndertakerFeedback) (*ContractUndertakerFeedback, error)
	FindOne(queryOptions map[string]interface{}) (*ContractUndertakerFeedback, error)
	Find(queryOptions map[string]interface{}) (int64, []*ContractUndertakerFeedback, error)
}

func (contractUndertakerFeedback *ContractUndertakerFeedback) Identify() interface{} {
	if contractUndertakerFeedback.FeedbackId == 0 {
		return nil
	}
	return contractUndertakerFeedback.FeedbackId
}

func (contractUndertakerFeedback *ContractUndertakerFeedback) Update(data map[string]interface{}) error {
	if feedbackAttachment, ok := data["feedbackAttachment"]; ok {
		contractUndertakerFeedback.FeedbackAttachment = feedbackAttachment.([]*Attachment)
	}
	if feedbackContent, ok := data["feedbackContent"]; ok {
		contractUndertakerFeedback.FeedbackContent = feedbackContent.(string)
	}
	if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
		contractUndertakerFeedback.CooperationContractNumber = cooperationContractNumber.(string)
	}
	if userId, ok := data["userId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserId = userId.(int64)
	}
	if userBaseId, ok := data["userBaseId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserBaseId = userBaseId.(int64)
	}
	if orgId, ok := data["orgId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Org.OrgId = orgId.(int64)
	}
	if orgName, ok := data["orgName"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Org.OrgName = orgName.(string)
	}
	if companyId, ok := data["companyId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Org.Company.CompanyId = companyId.(int64)
	}
	if companyLogo, ok := data["companyLogo"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Org.Company.CompanyLogo = companyLogo.(string)
	}
	if companyName, ok := data["companyName"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Org.Company.CompanyName = companyName.(string)
	}
	if orgs, ok := data["orgs"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Orgs = orgs.([]*Org)
	}
	if departmentId, ok := data["departmentId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Department.DepartmentId = departmentId.(int64)
	}
	if departmentName, ok := data["departmentName"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Department.DepartmentName = departmentName.(string)
	}
	if departmentNumber, ok := data["departmentNumber"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Department.DepartmentNumber = departmentNumber.(string)
	}
	if isOrganization, ok := data["isOrganization"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Department.IsOrganization = isOrganization.(bool)
	}
	if roleId, ok := data["roleId"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Role.RoleId = roleId.(int64)
	}
	if roleName, ok := data["roleName"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Role.RoleName = roleName.(string)
	}
	if userAvatar, ok := data["userAvatar"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserInfo.UserAvatar = userAvatar.(string)
	}
	if userEmail, ok := data["userEmail"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserInfo.UserEmail = userEmail.(string)
	}
	if userName, ok := data["userName"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserInfo.UserName = userName.(string)
	}
	if userPhone, ok := data["userPhone"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserInfo.UserPhone = userPhone.(string)
	}
	if userAccount, ok := data["userAccount"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserInfo.UserAccount = userAccount.(string)
	}
	if userType, ok := data["userType"]; ok {
		contractUndertakerFeedback.ContractUndertaker.UserType = userType.(int32)
	}
	if status, ok := data["status"]; ok {
		contractUndertakerFeedback.ContractUndertaker.Status = status.(int32)
	}
	if cooperationModeId, ok := data["cooperationModeId"]; ok {
		contractUndertakerFeedback.CooperationMode.CooperationModeId = cooperationModeId.(int64)
	}
	if cooperationModeNumber, ok := data["cooperationModeNumber"]; ok {
		contractUndertakerFeedback.CooperationMode.CooperationModeNumber = cooperationModeNumber.(string)
	}
	if cooperationModeName, ok := data["cooperationModeName"]; ok {
		contractUndertakerFeedback.CooperationMode.CooperationModeName = cooperationModeName.(string)
	}
	if status, ok := data["status"]; ok {
		contractUndertakerFeedback.CooperationMode.Status = status.(int32)
	}
	if remarks, ok := data["remarks"]; ok {
		contractUndertakerFeedback.CooperationMode.Remarks = remarks.(string)
	}
	if operateTime, ok := data["operateTime"]; ok {
		contractUndertakerFeedback.CooperationMode.OperateTime = operateTime.(time.Time)
	}
	if updatedAt, ok := data["updatedAt"]; ok {
		contractUndertakerFeedback.CooperationMode.UpdatedAt = updatedAt.(time.Time)
	}
	if deletedAt, ok := data["deletedAt"]; ok {
		contractUndertakerFeedback.CooperationMode.DeletedAt = deletedAt.(time.Time)
	}
	if createdAt, ok := data["createdAt"]; ok {
		contractUndertakerFeedback.CooperationMode.CreatedAt = createdAt.(time.Time)
	}
	return nil
}