Kaynağa Gözat

优化端子关联模块

liling 1 yıl önce
ebeveyn
işleme
b7887da44d

+ 101 - 17
service/controllers/busAdminController.go

@@ -11,6 +11,8 @@
 package controllers
 
 import (
+	"encoding/json"
+	"fmt"
 	"scd_check_tools/models/bo"
 	"scd_check_tools/tools"
 	"strconv"
@@ -638,6 +640,7 @@ func (c *BusAdminController) GetFuncFcdaList() {
 		c.ServeJSON()
 		return
 	}
+
 	obj := new(bo.SysCheckModelIedFuncMgr)
 	obj.SetUserInfo(c.GetCurrentUserInfo())
 	lst, err := obj.GetList(modelid, ied_type)
@@ -646,25 +649,22 @@ func (c *BusAdminController) GetFuncFcdaList() {
 		c.ServeJSON()
 		return
 	}
-	fcdaList := []interface{}{}
+	funcids := []string{}
+	for _, row := range lst {
+		funcids = append(funcids, tools.IsEmpty(row["id"]))
+	}
 	fcdaMgr := new(bo.SysCheckModelIedFuncFcdaMgr)
 	fcdaMgr.Model = bo.T_data_model_func_fcda{}
 	fcdaMgr.Model.ModelId = modelid
 	fcdaMgr.Model.Svorgoose = strings.ToUpper(c.GetString("sv_or_goose"))
 	fcdaMgr.Model.Inorout = c.GetString("in_or_out")
-	for _, row := range lst {
-		fcdaMgr.Model.FuncId, _ = strconv.Atoi(tools.IsEmpty(row["id"]))
-		tmpLst, err := fcdaMgr.GetList()
-		if err != nil {
-			c.Data["json"] = c.ResultError(err.Error())
-			c.ServeJSON()
-			return
-		}
-		for _, r := range tmpLst {
-			fcdaList = append(fcdaList, r)
-		}
+	fcdaList, err := fcdaMgr.GetList(funcids)
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
 	}
-	c.Data["json"] = c.ResultOK(fcdaList, 0)
+	c.Data["json"] = c.ResultOK(fcdaList, len(fcdaList))
 	c.ServeJSON()
 }
 
@@ -765,9 +765,9 @@ func (c *BusAdminController) DelAllFuncFcda() {
 		return
 	}
 
-	fcdaMgr := new(bo.SysCheckModelIedFuncFcdaMgr)
+	fcdaMgr := new(bo.SysCheckModelIedFuncMgr)
 	fcdaMgr.SetUserInfo(c.GetCurrentUserInfo())
-	fcdaMgr.Model = bo.T_data_model_func_fcda{}
+	fcdaMgr.Model = bo.T_data_model_func_def{}
 	fcdaMgr.Model.ModelId = modelid
 	err := fcdaMgr.Delete()
 	if err != nil {
@@ -868,8 +868,9 @@ func (c *BusAdminController) GetFuncFcdaRef() {
 //	@Param 	model_id 	formData   int  	true 	"模型ID"
 //	@Param 	from_ied_type 	formData   string  	true 	"输出装置类型"
 //	@Param 	to_ied_type 	formData   string  	true 	"输入装置类型"
-//	@Param 	from_fcda_id 	formData   int  	true 	"输出装置端子ID"
-//	@Param 	to_fcda_ids		formData   string  	true 	"输入装置端子ID列表。多个ID间使用逗号分隔"
+//	@Param 	from_fcda_id 	formData   int  	false 	"输出装置端子ID"
+//	@Param 	to_fcda_ids		formData   string  	false 	"输入装置端子ID"
+//	@Param 	batch_fcda_ids	formData   json-string  true "批量保存端子关系。类型为序列化的二维数组字符串。数组元素为:[[fromfcdaid,tofcdaid],...]"
 //	@Param 	goosesv 		formData   string  	true 	"信号类型。值范围:GOOSE|SV"
 // 	@Success     200    {object} ResultOK 成功
 // 	@Failure 	 500 	{object} ResultError  失败
@@ -911,6 +912,45 @@ func (c *BusAdminController) SaveFuncFcdaRef() {
 		c.ServeJSON()
 		return
 	}
+	batch_fcda_ids := c.GetString("batch_fcda_ids")
+	if batch_fcda_ids != "" {
+		//批量保存
+		fcdalist := [][]int{}
+		err := json.Unmarshal([]byte(batch_fcda_ids), &fcdalist)
+		if err != nil {
+			c.Data["json"] = c.ResultError("无效的批量端子关系数据")
+			c.ServeJSON()
+			return
+		}
+		obj := new(bo.SysCheckModelIedFuncFcdaMgr)
+		for _, item := range fcdalist {
+			fcdainf, err := obj.One(item[0])
+			if err != nil {
+				c.Data["json"] = c.ResultError(fmt.Sprintf("无效的端子ID:%d", item[0]))
+				c.ServeJSON()
+				return
+			}
+			fcdaMgr.Model.FromFuncId = fcdainf.FuncId
+			fcdaMgr.Model.FromFcdaId = item[0]
+			fcdainf, err = obj.One(item[1])
+			if err != nil {
+				c.Data["json"] = c.ResultError(fmt.Sprintf("无效的端子ID:%d", item[1]))
+				c.ServeJSON()
+				return
+			}
+			fcdaMgr.Model.ToFcdaId = item[1]
+			fcdaMgr.Model.ToFuncId = fcdainf.FuncId
+			err = fcdaMgr.Save()
+			if err != nil {
+				c.Data["json"] = c.ResultError(err.Error())
+				c.ServeJSON()
+				return
+			}
+		}
+		c.Data["json"] = c.ResultOK("", 0)
+		c.ServeJSON()
+		return
+	}
 	obj := new(bo.SysCheckModelIedFuncFcdaMgr)
 	fcdainf, er := obj.One(fcdaMgr.Model.FromFcdaId)
 	if er != nil {
@@ -948,3 +988,47 @@ func (c *BusAdminController) SaveFuncFcdaRef() {
 	c.Data["json"] = c.ResultOK("", 0)
 	c.ServeJSON()
 }
+
+// @Summary 删除端子之间的关联关系
+//	@Description  删除端子之间的关联关系
+// 	@Tags         业务管理服务
+// 	@Accept       x-www-form-urlencoded
+// 	@Produce      json
+//	@Param 	model_id 		formData   int  	true 	"模型ID"
+//	@Param 	from_fcda_id 	formData   int  	true 	"输入端子ID"
+//	@Param 	to_fcda_id 		formData   int  	true 	"输出端子ID"
+// 	@Success     200    {object} ResultOK 成功
+// 	@Failure 	 500 	{object} ResultError  失败
+// @router /admin/model/function/fcda-ref/del [post]
+func (c *BusAdminController) DelFuncFcdaRef() {
+	fcdaMgr := new(bo.SysCheckModelFcdaRalationMgr)
+	fcdaMgr.SetUserInfo(c.GetCurrentUserInfo())
+	fcdaMgr.Model = bo.T_data_model_fcda_ref{}
+	fcdaMgr.Model.ModelId, _ = c.GetInt("model_id", 0)
+	fcdaMgr.Model.FromFcdaId, _ = c.GetInt("from_fcda_id", 0)
+	fcdaMgr.Model.ToFcdaId, _ = c.GetInt("to_fcda_id")
+	if fcdaMgr.Model.ModelId == 0 {
+		c.Data["json"] = c.ResultError("模型ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	if fcdaMgr.Model.FromFcdaId == 0 {
+		c.Data["json"] = c.ResultError("输入端子ID不能为空!")
+		c.ServeJSON()
+		return
+	}
+	if fcdaMgr.Model.ToFcdaId == 0 {
+		c.Data["json"] = c.ResultError("接收端子ID不能为空")
+		c.ServeJSON()
+		return
+	}
+	//清除原关系
+	err := fcdaMgr.Delete()
+	if err != nil {
+		c.Data["json"] = c.ResultError(err.Error())
+		c.ServeJSON()
+		return
+	}
+	c.Data["json"] = c.ResultOK("", 0)
+	c.ServeJSON()
+}

+ 3 - 1
service/models/bo/check_sysmodel_ied_fcda_relation.go

@@ -76,7 +76,9 @@ func (c *SysCheckModelFcdaRalationMgr) Delete() (err error) {
 	dblog.Eventtype = enum.OptEventType_Bus
 	dblog.Eventlevel = enum.OptEventLevel_Hight
 	db := orm.NewOrm()
-	if c.Model.FromFcdaId > 0 {
+	if c.Model.FromFcdaId > 0 && c.Model.ToFcdaId > 0 {
+		_, err = db.Raw("delete from t_data_model_fcda_ref where model_id=? and from_fcda_id=? and to_fcda_id=?", c.Model.ModelId, c.Model.FromFcdaId, c.Model.ToFcdaId).Exec()
+	} else if c.Model.FromFcdaId > 0 {
 		_, err = db.Raw("delete from t_data_model_fcda_ref where model_id=? and (from_fcda_id=? or to_fcda_id=?) and to_ied_code=? and goosesv=?", c.Model.ModelId, c.Model.FromFcdaId, c.Model.FromFcdaId, c.Model.ToIedCode, c.Model.Goosesv).Exec()
 	} else if c.Model.ToFcdaId > 0 {
 		_, err = db.Raw("delete from t_data_model_fcda_ref where model_id=? and (from_fcda_id=? or to_fcda_id=?)", c.Model.ModelId, c.Model.ToFcdaId, c.Model.ToFcdaId).Exec()

+ 21 - 13
service/models/bo/check_sysmodel_ied_func.go

@@ -169,7 +169,8 @@ func (c *SysCheckModelIedFuncMgr) Copy(oldModelid, newModelId int) error {
 }
 
 //根据model中指定的id删除
-func (c *SysCheckModelIedFuncMgr) Delete() (err error) {
+//onlyFunc: true表示只删除功能数据,不进行关联端子删除;false表示需要关联删除端子。默认为关联删除端子
+func (c *SysCheckModelIedFuncMgr) Delete(onlyFunc ...bool) (err error) {
 	dblog := new(SystemLog)
 	dblog.SetUserInfo(c.GetUserInfo())
 	dblog.Audittype = enum.AuditType_check_model
@@ -192,19 +193,25 @@ func (c *SysCheckModelIedFuncMgr) Delete() (err error) {
 		dblog.Description = fmt.Sprintf("删除%s(%d)失败:%s", sysCheckModel_iedFuncDesc, c.Model.ModelId, err.Error())
 		dblog.Fail2()
 	} else {
-		fcdaMgr := new(SysCheckModelIedFuncFcdaMgr)
-		fcdaMgr.Model = T_data_model_func_fcda{ModelId: c.Model.ModelId}
-		if c.Model.Id > 0 {
-			fcdaMgr.Model.FuncId = c.Model.Id
+		isnotdelFcda := false
+		if len(onlyFunc) > 0 {
+			isnotdelFcda = onlyFunc[0]
 		}
-		if c.Model.IedType != "" {
-			//删除所有功能的相关数据
-			for _, row := range funcLst {
-				fcdaMgr.Model.FuncId, _ = strconv.Atoi(tools.IsEmpty(row["id"]))
+		if !isnotdelFcda {
+			fcdaMgr := new(SysCheckModelIedFuncFcdaMgr)
+			fcdaMgr.Model = T_data_model_func_fcda{ModelId: c.Model.ModelId}
+			if c.Model.Id > 0 {
+				fcdaMgr.Model.FuncId = c.Model.Id
+			}
+			if c.Model.IedType != "" {
+				//删除所有功能的相关数据
+				for _, row := range funcLst {
+					fcdaMgr.Model.FuncId, _ = strconv.Atoi(tools.IsEmpty(row["id"]))
+					fcdaMgr.Delete()
+				}
+			} else {
 				fcdaMgr.Delete()
 			}
-		} else {
-			fcdaMgr.Delete()
 		}
 		dblog.Description = fmt.Sprintf("删除%s(%d)成功", sysCheckModel_iedFuncDesc, c.Model.ModelId)
 		dblog.Success2()
@@ -282,11 +289,12 @@ func (c *SysCheckModelIedFuncMgr) Imp(param map[string]interface{}) (bool, error
 		if inorout == "" {
 			return false, errors.New(fmt.Sprintf("第%d行:信号方向不能为空", i))
 		}
-		func_id = funcMap[func_name]
+		funckey := fmt.Sprintf("%d%s%s", modelId, ied_type, func_name)
+		func_id = funcMap[funckey]
 		if func_id == 0 {
 			//获取功能id
 			func_id, _ = c.GetFuncId(modelId, ied_type, func_name)
-			funcMap[func_name] = func_id
+			funcMap[funckey] = func_id
 		}
 		if func_id > 0 {
 			fcdaKey := fmt.Sprintf("%d%s", func_id, fcda_name)

+ 25 - 6
service/models/bo/check_sysmodel_ied_func_fcda.go

@@ -7,6 +7,7 @@ import (
 	"scd_check_tools/models/enum"
 	"scd_check_tools/tools"
 	"strconv"
+	"strings"
 
 	"github.com/astaxie/beego/orm"
 )
@@ -160,17 +161,17 @@ func (c *SysCheckModelIedFuncFcdaMgr) Delete() (err error) {
 					//删除功能定义数据
 					funcMgr := new(SysCheckModelIedFuncMgr)
 					funcMgr.Model.Id = one.FuncId
-					funcMgr.Delete()
+					funcMgr.Delete(true)
 				}
 			}
 		} else if c.Model.FuncId > 0 {
 			funcMgr := new(SysCheckModelIedFuncMgr)
 			funcMgr.Model.Id = c.Model.FuncId
-			funcMgr.Delete()
+			funcMgr.Delete(true)
 		} else {
 			funcMgr := new(SysCheckModelIedFuncMgr)
 			funcMgr.Model.ModelId = c.Model.ModelId
-			funcMgr.Delete()
+			funcMgr.Delete(true)
 		}
 	}
 	return err
@@ -183,12 +184,20 @@ func (c *SysCheckModelIedFuncFcdaMgr) One(id int) (T_data_model_func_fcda, error
 	return tmp, err
 }
 
-func (c *SysCheckModelIedFuncFcdaMgr) GetList() ([]orm.Params, error) {
+//获取指定模型及装置功能下的端子信息列表
+//funcids:指定的功能编码列表。可不传
+func (c *SysCheckModelIedFuncFcdaMgr) GetList(funcids ...[]string) ([]orm.Params, error) {
 	o := orm.NewOrm()
 	sqlParamters := []interface{}{c.Model.ModelId}
 	outsql := ""
+	desc := ""
 	if c.Model.Inorout == "接收" {
-		outsql = ",(select id from t_data_model_fcda_ref where model_id=? and to_fcda_id=t.id) from_fcda_id"
+		outsql = ",(select from_fcda_id from t_data_model_fcda_ref where model_id=? and to_fcda_id=t.id) from_fcda_id"
+		sqlParamters = append(sqlParamters, c.Model.ModelId)
+		desc = " from_fcda_id," //已有关联关系的端子排在前面
+	}
+	if c.Model.Inorout == "输出" {
+		outsql = ",(select to_fcda_id from t_data_model_fcda_ref where model_id=? and from_fcda_id=t.id) to_fcda_id"
 		sqlParamters = append(sqlParamters, c.Model.ModelId)
 	}
 	sql := "select t.*,t1.func_name" + outsql + " from t_data_model_func_fcda t,t_data_model_func_def t1 where t1.id=t.func_id and t.model_id=? "
@@ -196,6 +205,9 @@ func (c *SysCheckModelIedFuncFcdaMgr) GetList() ([]orm.Params, error) {
 		sql = sql + " and t.func_id=?"
 		sqlParamters = append(sqlParamters, c.Model.FuncId)
 	}
+	if len(funcids) > 0 {
+		sql = sql + " and t.func_id in(" + strings.Join(funcids[0], ",") + ")"
+	}
 	if c.Model.Svorgoose != "" {
 		sql = sql + " and t.svorgoose=?"
 		sqlParamters = append(sqlParamters, c.Model.Svorgoose)
@@ -204,7 +216,14 @@ func (c *SysCheckModelIedFuncFcdaMgr) GetList() ([]orm.Params, error) {
 		sql = sql + " and t.inorout=?"
 		sqlParamters = append(sqlParamters, c.Model.Inorout)
 	}
-	sql = sql + " order by t.id"
+	sql = sql + " order by " + desc + " t.id"
+	if c.Model.Inorout == "输出" {
+		sql = "select a.id,a.model_id,a.func_id,a.fcda_name,a.fcda_match_exp,a.svorgoose,a.inorout,ifnull(a.to_fcda_id,0) to_fcda_id,ifnull(ff1.fcda_name,'') to_fcda_name,ifnull(fd1.ied_type,'') to_ied_type from (" +
+			sql + ") a left join t_data_model_func_fcda ff1 on a.to_fcda_id=ff1.id  LEFT JOIN t_data_model_func_def fd1 on ff1.func_id=fd1.id"
+	} else if c.Model.Inorout == "接收" {
+		sql = "select a.id,a.model_id,a.func_id,a.fcda_name,a.fcda_match_exp,a.svorgoose,a.inorout,ifnull(a.from_fcda_id,0) from_fcda_id,ifnull(ff1.fcda_name,'') from_fcda_name,ifnull(fd1.ied_type,'') from_ied_type from (" +
+			sql + ") a left join t_data_model_func_fcda ff1 on a.from_fcda_id=ff1.id  LEFT JOIN t_data_model_func_def fd1 on ff1.func_id=fd1.id"
+	}
 	rowset := []orm.Params{}
 	_, err := o.Raw(sql, sqlParamters).Values(&rowset)
 	if err != nil {

+ 1 - 1
service/models/bo/checktools_area.go

@@ -562,7 +562,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
 	//从间隔装置中过滤出指定类型的IED
 	var filterAreaIeds = func(ied_type, volLevelCode string, s1 []orm.Params) []orm.Params {
 		iedlst := []orm.Params{}
-		if volLevelCode == "" {
+		if volLevelCode == "" || (volLevelCode != "H" && volLevelCode != "M" && volLevelCode != "L") {
 			for _, r := range s1 {
 				if strings.HasPrefix(tools.IsEmpty(r["ied_name"]), ied_type) {
 					iedlst = append(iedlst, r)

+ 18 - 0
service/routers/commentsRouter_controllers.go

@@ -612,6 +612,24 @@ func init() {
 
     beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
         beego.ControllerComments{
+            Method: "DelAllFuncFcda",
+            Router: "/admin/model/fcda/delall",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
+        beego.ControllerComments{
+            Method: "DelFuncFcdaRef",
+            Router: "/admin/model/function/fcda-ref/del",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"] = append(beego.GlobalControllerRouter["scd_check_tools/controllers:BusAdminController"],
+        beego.ControllerComments{
             Method: "GetFuncFcdaRef",
             Router: "/admin/model/function/fcda-ref/list",
             AllowHTTPMethods: []string{"get"},

+ 60 - 3
service/static/swagger/swagger.json

@@ -395,6 +395,52 @@
                 }
             }
         },
+        "/admin/model/function/fcda-ref/del": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "删除端子之间的关联关系",
+                "description": "删除端子之间的关联关系",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "model_id",
+                        "description": "模型ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "from_fcda_id",
+                        "description": "输入端子ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "to_fcda_id",
+                        "description": "输出端子ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/model/function/fcda-ref/list": {
             "get": {
                 "tags": [
@@ -479,19 +525,26 @@
                         "in": "formData",
                         "name": "from_fcda_id",
                         "description": "输出装置端子ID",
-                        "required": true,
                         "type": "integer",
                         "format": "int64"
                     },
                     {
                         "in": "formData",
                         "name": "to_fcda_ids",
-                        "description": "输入装置端子ID列表。多个ID间使用逗号分隔",
-                        "required": true,
+                        "description": "输入装置端子ID",
                         "type": "string"
                     },
                     {
                         "in": "formData",
+                        "name": "batch_fcda_ids",
+                        "description": "批量保存端子关系。类型为序列化的二维数组字符串。数组元素为:[[fromfcdaid,tofcdaid],...]",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/json-string"
+                        }
+                    },
+                    {
+                        "in": "formData",
                         "name": "goosesv",
                         "description": "信号类型。值范围:GOOSE|SV",
                         "required": true,
@@ -6406,6 +6459,10 @@
         "WarpOK": {
             "title": "WarpOK",
             "type": "object"
+        },
+        "json-string": {
+            "title": "json-string",
+            "type": "object"
         }
     },
     "tags": [

+ 42 - 3
service/static/swagger/swagger.yml

@@ -271,6 +271,38 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/model/function/fcda-ref/del:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 删除端子之间的关联关系
+      description: 删除端子之间的关联关系
+      parameters:
+      - in: formData
+        name: model_id
+        description: 模型ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: from_fcda_id
+        description: 输入端子ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: to_fcda_id
+        description: 输出端子ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/model/function/fcda-ref/list:
     get:
       tags:
@@ -331,15 +363,19 @@ paths:
       - in: formData
         name: from_fcda_id
         description: 输出装置端子ID
-        required: true
         type: integer
         format: int64
       - in: formData
         name: to_fcda_ids
-        description: 输入装置端子ID列表。多个ID间使用逗号分隔
-        required: true
+        description: 输入装置端子ID
         type: string
       - in: formData
+        name: batch_fcda_ids
+        description: 批量保存端子关系。类型为序列化的二维数组字符串。数组元素为:[[fromfcdaid,tofcdaid],...]
+        required: true
+        schema:
+          $ref: '#/definitions/json-string'
+      - in: formData
         name: goosesv
         description: 信号类型。值范围:GOOSE|SV
         required: true
@@ -4347,6 +4383,9 @@ definitions:
   WarpOK:
     title: WarpOK
     type: object
+  json-string:
+    title: json-string
+    type: object
 tags:
 - name: scd_check_tools/controllersApiController
   description: |

+ 60 - 3
service/swagger/swagger.json

@@ -395,6 +395,52 @@
                 }
             }
         },
+        "/admin/model/function/fcda-ref/del": {
+            "post": {
+                "tags": [
+                    "scd_check_tools/controllersBusAdminController"
+                ],
+                "summary": "删除端子之间的关联关系",
+                "description": "删除端子之间的关联关系",
+                "parameters": [
+                    {
+                        "in": "formData",
+                        "name": "model_id",
+                        "description": "模型ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "from_fcda_id",
+                        "description": "输入端子ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    },
+                    {
+                        "in": "formData",
+                        "name": "to_fcda_id",
+                        "description": "输出端子ID",
+                        "required": true,
+                        "type": "integer",
+                        "format": "int64"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "成功",
+                        "schema": {
+                            "$ref": "#/definitions/ResultOK"
+                        }
+                    },
+                    "500": {
+                        "description": "{object} ResultError  失败"
+                    }
+                }
+            }
+        },
         "/admin/model/function/fcda-ref/list": {
             "get": {
                 "tags": [
@@ -479,19 +525,26 @@
                         "in": "formData",
                         "name": "from_fcda_id",
                         "description": "输出装置端子ID",
-                        "required": true,
                         "type": "integer",
                         "format": "int64"
                     },
                     {
                         "in": "formData",
                         "name": "to_fcda_ids",
-                        "description": "输入装置端子ID列表。多个ID间使用逗号分隔",
-                        "required": true,
+                        "description": "输入装置端子ID",
                         "type": "string"
                     },
                     {
                         "in": "formData",
+                        "name": "batch_fcda_ids",
+                        "description": "批量保存端子关系。类型为序列化的二维数组字符串。数组元素为:[[fromfcdaid,tofcdaid],...]",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/json-string"
+                        }
+                    },
+                    {
+                        "in": "formData",
                         "name": "goosesv",
                         "description": "信号类型。值范围:GOOSE|SV",
                         "required": true,
@@ -6406,6 +6459,10 @@
         "WarpOK": {
             "title": "WarpOK",
             "type": "object"
+        },
+        "json-string": {
+            "title": "json-string",
+            "type": "object"
         }
     },
     "tags": [

+ 42 - 3
service/swagger/swagger.yml

@@ -271,6 +271,38 @@ paths:
             $ref: '#/definitions/ResultOK'
         "500":
           description: '{object} ResultError  失败'
+  /admin/model/function/fcda-ref/del:
+    post:
+      tags:
+      - scd_check_tools/controllersBusAdminController
+      summary: 删除端子之间的关联关系
+      description: 删除端子之间的关联关系
+      parameters:
+      - in: formData
+        name: model_id
+        description: 模型ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: from_fcda_id
+        description: 输入端子ID
+        required: true
+        type: integer
+        format: int64
+      - in: formData
+        name: to_fcda_id
+        description: 输出端子ID
+        required: true
+        type: integer
+        format: int64
+      responses:
+        "200":
+          description: 成功
+          schema:
+            $ref: '#/definitions/ResultOK'
+        "500":
+          description: '{object} ResultError  失败'
   /admin/model/function/fcda-ref/list:
     get:
       tags:
@@ -331,15 +363,19 @@ paths:
       - in: formData
         name: from_fcda_id
         description: 输出装置端子ID
-        required: true
         type: integer
         format: int64
       - in: formData
         name: to_fcda_ids
-        description: 输入装置端子ID列表。多个ID间使用逗号分隔
-        required: true
+        description: 输入装置端子ID
         type: string
       - in: formData
+        name: batch_fcda_ids
+        description: 批量保存端子关系。类型为序列化的二维数组字符串。数组元素为:[[fromfcdaid,tofcdaid],...]
+        required: true
+        schema:
+          $ref: '#/definitions/json-string'
+      - in: formData
         name: goosesv
         description: 信号类型。值范围:GOOSE|SV
         required: true
@@ -4347,6 +4383,9 @@ definitions:
   WarpOK:
     title: WarpOK
     type: object
+  json-string:
+    title: json-string
+    type: object
 tags:
 - name: scd_check_tools/controllersApiController
   description: |