Ver código fonte

点位详情增加问题列表

zk 2 anos atrás
pai
commit
3bf32d9081

+ 2 - 0
server/api/v1/autocode/place.go

@@ -112,6 +112,8 @@ func (placeApi *PlaceApi) FindPlace(c *gin.Context) {
 		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
 		response.FailWithMessage("查询失败", c)
 	} else {
+		_, list := placeProService.GetPlaceProByIds(replace.ID)
+		replace.ProList = list
 		response.OkWithData(gin.H{"replace": replace}, c)
 	}
 }

+ 6 - 5
server/model/autocode/place.go

@@ -9,11 +9,12 @@ import (
 // 如果含有time.Time 请自行import time包
 type Place struct {
 	global.GVA_MODEL
-	Name      string `json:"name" form:"name" gorm:"column:name;comment:点位名称;type:varchar(255);"`
-	Position  string `json:"position" form:"position" gorm:"column:position;comment:点位定位;type:varchar(255);"`
-	Type      *int   `json:"type" form:"type" gorm:"column:type;comment:点位类型;type:int;"`
-	Region    string `json:"region" form:"region" gorm:"column:region;comment:区域;type:varchar(255);"`
-	OrganCode string `json:"organCode" form:"organCode" gorm:"column:organ_code;comment:区域归属;type:varchar(255);"`
+	Name      string     `json:"name" form:"name" gorm:"column:name;comment:点位名称;type:varchar(255);"`
+	Position  string     `json:"position" form:"position" gorm:"column:position;comment:点位定位;type:varchar(255);"`
+	Type      *int       `json:"type" form:"type" gorm:"column:type;comment:点位类型;type:int;"`
+	Region    string     `json:"region" form:"region" gorm:"column:region;comment:区域;type:varchar(255);"`
+	OrganCode string     `json:"organCode" form:"organCode" gorm:"column:organ_code;comment:区域归属;type:varchar(255);"`
+	ProList   []PlacePro `json:"proList" gorm:"-"`
 }
 
 // TableName Place 表名

+ 9 - 0
server/service/autocode/place_pro.go

@@ -58,3 +58,12 @@ func (placeProService *PlaceProService) GetPlaceProInfoList(info autoCodeReq.Pla
 	err = db.Limit(limit).Offset(offset).Find(&placePros).Error
 	return err, placePros, total
 }
+
+func (placeProService *PlaceProService) GetPlaceProByIds(id uint) (err error, list []autocode.PlacePro) {
+	// 创建db
+	db := global.GVA_DB.Model(&autocode.PlacePro{})
+	var placePros []autocode.PlacePro
+	// 如果有条件搜索 下方会自动创建搜索语句
+	err = db.Where("place_id = ?", id).Find(&placePros).Error
+	return err, placePros
+}