feat: 网元模块
This commit is contained in:
39
src/modules/net_element/controller/ne_info.go
Normal file
39
src/modules/net_element/controller/ne_info.go
Normal file
@@ -0,0 +1,39 @@
|
||||
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, "参数错误"))
|
||||
return
|
||||
}
|
||||
|
||||
data := s.NeInfoService.SelectNeInfoByNeTypeAndNeID(neType, neId)
|
||||
if data.NeType == neType {
|
||||
c.JSON(200, result.OkData(data))
|
||||
return
|
||||
}
|
||||
c.JSON(200, result.Err(nil))
|
||||
}
|
||||
Reference in New Issue
Block a user