| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | package modelimport (	"strings"	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow")type Disease struct {	Id              int64                 `json:"id"`	PastureId       int64                 `json:"pastureId"`	Name            string                `json:"name"`	Symptoms        string                `json:"symptoms"`	DiseaseType     int32                 `json:"diseaseType"`	DiseaseTypeName string                `json:"diseaseTypeName"`	IsShow          pasturePb.IsShow_Kind `json:"isShow"`	Remarks         string                `json:"remarks"`	OperationId     int64                 `json:"operationId"`	CreatedAt       int64                 `json:"createdAt"`	UpdatedAt       int64                 `json:"updatedAt"`}func (d *Disease) TableName() string {	return "disease"}type DiseaseSlice []*Diseasefunc (d DiseaseSlice) ToPB(user []*SystemUser, diseaseTypeList []*ConfigDiseaseType) []*pasturePb.SearchDiseaseList {	res := make([]*pasturePb.SearchDiseaseList, len(d))	for i, dl := range d {		operationName, diseaseTypeName := "", ""		for _, u := range user {			if u.Id == dl.OperationId {				operationName = u.NickName				break			}		}		for _, dt := range diseaseTypeList {			if dt.Id == int64(dl.DiseaseType) {				diseaseTypeName = dt.Name				break			}		}		res[i] = &pasturePb.SearchDiseaseList{			Id:              int32(dl.Id),			Remarks:         dl.Remarks,			OperationId:     int32(dl.OperationId),			OperationName:   operationName,			Name:            dl.Name,			DiseaseTypeId:   dl.DiseaseType,			DiseaseTypeName: diseaseTypeName,			Symptoms:        strings.Split(dl.Symptoms, "|"),			IsShow:          dl.IsShow,			CreatedAt:       int32(dl.CreatedAt),			UpdatedAt:       int32(dl.UpdatedAt),		}	}	return res}func (d DiseaseSlice) ToPB2() []*pasturePb.ConfigOptionsList {	res := make([]*pasturePb.ConfigOptionsList, len(d))	for i, d := range d {		res[i] = &pasturePb.ConfigOptionsList{			Value:    int32(d.Id),			Label:    d.Name,			Disabled: true,		}	}	return res}
 |