add: filter dupliate title in kpi_c_title

This commit is contained in:
2024-09-06 11:44:24 +08:00
parent 5f49780b70
commit 4ddf6db122

View File

@@ -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