add: filter dupliate title in kpi_c_title
This commit is contained in:
@@ -126,7 +126,7 @@ func (k *KpiCTitle) Post(c *gin.Context) {
|
|||||||
c.JSON(http.StatusBadRequest, services.ErrResp(err.Error()))
|
c.JSON(http.StatusBadRequest, services.ErrResp(err.Error()))
|
||||||
return
|
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 {
|
if result.RowsAffected > 0 {
|
||||||
c.JSON(http.StatusInternalServerError, services.ErrResp("target kpiC title already exist"))
|
c.JSON(http.StatusInternalServerError, services.ErrResp("target kpiC title already exist"))
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user