From 4ddf6db1226a1165c30cc654ab2b8c08a352887d Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Fri, 6 Sep 2024 11:44:24 +0800 Subject: [PATCH] add: filter dupliate title in kpi_c_title --- features/pm/kpi_c_title/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/pm/kpi_c_title/controller.go b/features/pm/kpi_c_title/controller.go index 56bba7af..68d3e5c7 100644 --- a/features/pm/kpi_c_title/controller.go +++ b/features/pm/kpi_c_title/controller.go @@ -126,7 +126,7 @@ func (k *KpiCTitle) Post(c *gin.Context) { c.JSON(http.StatusBadRequest, services.ErrResp(err.Error())) return } - result := dborm.DefaultDB().Where("ne_type=? and kpi_id=?", title.NeType, title.KpiID).First(&title) + result := dborm.DefaultDB().Where("ne_type=? and (kpi_id=? or title=?)", title.NeType, title.KpiID, title.Title).First(&title) if result.RowsAffected > 0 { c.JSON(http.StatusInternalServerError, services.ErrResp("target kpiC title already exist")) return