...
|
...
|
@@ -319,6 +319,22 @@ func getRangeDataRelationLsit(rankRangeId int64, rangeType int8) []protocol.Rank |
|
|
return datalist
|
|
|
}
|
|
|
|
|
|
func RankRangeNameOnlyOne(rankTypeId int64, rankRangeId int64, name string) bool {
|
|
|
sql := `SELECT 1 FROM rank_range WHERE rank_type_id=? AND name=? AND id<>? LIMIT 1`
|
|
|
var (
|
|
|
err error
|
|
|
cnt int
|
|
|
)
|
|
|
err = utils.ExecuteQueryOne(&cnt, sql, rankTypeId, name, rankRangeId)
|
|
|
if err != nil {
|
|
|
return false
|
|
|
}
|
|
|
if cnt == 0 {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
func AddRankRange(rankTypeId int64, name string, rangetype int8, relationId []int64, companyid int64) error {
|
|
|
var (
|
|
|
rankRangeDatas []models.RankRangeData
|
...
|
...
|
@@ -430,6 +446,10 @@ func EditRankRange(id int64, name string, rangetype int8, relationId []int64, co |
|
|
log.Error("公司不匹配")
|
|
|
return protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
ok := RankRangeNameOnlyOne(rankRange.RankTypeId, rankRange.Id, name)
|
|
|
if !ok {
|
|
|
return protocol.NewErrWithMessage("10125")
|
|
|
}
|
|
|
rankRangeDatas, err = models.GetRankRangeDataByRangeId(rankRange.Id)
|
|
|
if err != nil {
|
|
|
log.Error("获取rank_range_data数据失败;%s", err)
|
...
|
...
|
|