|
@@ -319,6 +319,22 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank |
|
@@ -319,6 +319,22 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank |
319
|
return datalist
|
319
|
return datalist
|
320
|
}
|
320
|
}
|
321
|
|
321
|
|
|
|
322
|
+func RankRangeNameOnlyOne(rankTypeId int64, rankRangeId int64, name string) bool {
|
|
|
323
|
+ sql := `SELECT 1 FROM rank_range WHERE rank_type_id=? AND name=? AND id<>? LIMIT 1`
|
|
|
324
|
+ var (
|
|
|
325
|
+ err error
|
|
|
326
|
+ cnt int
|
|
|
327
|
+ )
|
|
|
328
|
+ err = utils.ExecuteQueryOne(&cnt, sql, rankTypeId, name, rankRangeId)
|
|
|
329
|
+ if err != nil {
|
|
|
330
|
+ return false
|
|
|
331
|
+ }
|
|
|
332
|
+ if cnt == 0 {
|
|
|
333
|
+ return true
|
|
|
334
|
+ }
|
|
|
335
|
+ return false
|
|
|
336
|
+}
|
|
|
337
|
+
|
322
|
func AddRankRange(rankTypeId int64, name string, rangetype int8, relationId []int64, companyid int64) error {
|
338
|
func AddRankRange(rankTypeId int64, name string, rangetype int8, relationId []int64, companyid int64) error {
|
323
|
var (
|
339
|
var (
|
324
|
rankRangeDatas []models.RankRangeData
|
340
|
rankRangeDatas []models.RankRangeData
|
|
@@ -430,6 +446,10 @@ func EditRankRange(id int64, name string, rangetype int8, relationId []int64, co |
|
@@ -430,6 +446,10 @@ func EditRankRange(id int64, name string, rangetype int8, relationId []int64, co |
430
|
log.Error("公司不匹配")
|
446
|
log.Error("公司不匹配")
|
431
|
return protocol.NewErrWithMessage("1")
|
447
|
return protocol.NewErrWithMessage("1")
|
432
|
}
|
448
|
}
|
|
|
449
|
+ ok := RankRangeNameOnlyOne(rankRange.RankTypeId, rankRange.Id, name)
|
|
|
450
|
+ if !ok {
|
|
|
451
|
+ return protocol.NewErrWithMessage("10125")
|
|
|
452
|
+ }
|
433
|
rankRangeDatas, err = models.GetRankRangeDataByRangeId(rankRange.Id)
|
453
|
rankRangeDatas, err = models.GetRankRangeDataByRangeId(rankRange.Id)
|
434
|
if err != nil {
|
454
|
if err != nil {
|
435
|
log.Error("获取rank_range_data数据失败;%s", err)
|
455
|
log.Error("获取rank_range_data数据失败;%s", err)
|