feat:优化项目信息

This commit is contained in:
henry
2022-03-05 15:33:22 +08:00
16 changed files with 115 additions and 58 deletions

View File

@ -17,9 +17,11 @@ type (
model.Model
Name string `json:"name"`
Industry string `json:"industry"`
Research string `json:"research"`
ResearchName string `json:"research_name"`
model.Image
model.Area
model.Examine
CreatedAt time.Time `json:"created_at"`
TenantProvince string `json:"-"`
TenantCity string `json:"-"`
@ -27,7 +29,6 @@ type (
// ManageLaboratoryDetail 实验室详细信息
ManageLaboratoryDetail struct {
*model.ManageLaboratory
model.Area
}
)
@ -48,12 +49,12 @@ func (m *ManageLaboratory) Laboratory(id uint64) (*ManageLaboratoryDetail, error
// Laboratorys 实验室信息
func (m *ManageLaboratory) Laboratorys(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageLaboratoryInfo, error) {
db := orm.GetDB().Table(m.TableName()+" AS l").
Select("l.id", "l.name", "l.industry", "l.name AS research_name", "l.image",
Select("l.id", "l.name", "l.industry", "l.research", "r.name AS research_name", "l.image", "l.examine_status",
"l.province", "l.city", "l.created_at",
"t.province AS tenant_province", "t.city AS tenant_city").
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON l.research_id = r.id", model.NewManageResearch().TableName())).
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON l.tenant_id = t.id", model.NewSysTenant().TableName())).
Where("e.is_deleted = ?", model.DeleteStatusForNot)
Where("l.is_deleted = ?", model.DeleteStatusForNot)
if len(where) > 0 {
for _, v := range where {