feat: 网元模块

This commit is contained in:
TsMask
2023-10-26 18:25:24 +08:00
parent acd44da5e0
commit 79f30f2fc5
7 changed files with 192 additions and 0 deletions

View 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))
}