Files
be.ems/src/modules/net_element/controller/ne_info.go

40 lines
862 B
Go

package controller
import (
"ems.agt/src/framework/vo/result"
netElementService "ems.agt/src/modules/net_element/service"
"github.com/gin-gonic/gin"
)
// 实例化控制层 NeInfoController 结构体
var NewNeInfo = &NeInfoController{
NeInfoService: netElementService.NewNeInfoImpl,
}
// 网元信息请求
//
// PATH /ne-info
type NeInfoController struct {
// 网元信息服务
NeInfoService netElementService.INeInfo
}
// 网元neType和neID查询
//
// GET /info
func (s *NeInfoController) NeTypeAndID(c *gin.Context) {
neType := c.Query("neType")
neId := c.Query("neId")
if neType == "" || neId == "" {
c.JSON(400, result.CodeMsg(400, "parameter error"))
return
}
data := s.NeInfoService.SelectNeInfoByNeTypeAndNeID(neType, neId)
if data.NeType == neType {
c.JSON(200, result.OkData(data))
return
}
c.JSON(200, result.Err(nil))
}