|
@@ -708,12 +708,12 @@ func MoveEdbClassify(req data_manage.MoveEdbClassifyReq, sysUser *system.Admin,
|
|
|
nextSort = nextEdbInfo.Sort
|
|
|
}
|
|
|
|
|
|
- err, errMsg = moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify, edbInfo, prevEdbInfo, parentClassifyId, prevSort, nextSort, classifyType)
|
|
|
+ err, errMsg = moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify, nextClassify, edbInfo, prevEdbInfo, nextEdbInfo, parentClassifyId, prevSort, nextSort, classifyType)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// moveEdbClassify 移动指标分类
|
|
|
-func moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify *data_manage.EdbClassify, edbInfo, prevEdbInfo *data_manage.EdbInfo, parentClassifyId int, prevSort, nextSort int, classifyType uint8) (err error, errMsg string) {
|
|
|
+func moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify, nextClassify *data_manage.EdbClassify, edbInfo, prevEdbInfo, nextEdbInfo *data_manage.EdbInfo, parentClassifyId int, prevSort, nextSort int, classifyType uint8) (err error, errMsg string) {
|
|
|
updateCol := make([]string, 0)
|
|
|
// 移动对象为分类, 判断分类是否存在
|
|
|
if edbClassifyInfo != nil {
|
|
@@ -763,6 +763,18 @@ func moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify *data_
|
|
|
edbClassifyInfo.Sort = prevClassify.Sort + 1
|
|
|
edbClassifyInfo.ModifyTime = time.Now()
|
|
|
updateCol = append(updateCol, "Sort", "ModifyTime")
|
|
|
+ } else if prevClassify == nil && nextClassify == nil && prevEdbInfo == nil && nextEdbInfo == nil && parentClassifyId > 0 {
|
|
|
+ //处理只拖动到目录里,默认放到目录底部的情况
|
|
|
+ var maxSort int
|
|
|
+ maxSort, err = GetEdbClassifyMaxSort(parentClassifyId, classifyType)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "移动失败"
|
|
|
+ err = errors.New("查询组内排序信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbClassifyInfo.Sort = maxSort + 1 //那就是排在组内最后一位
|
|
|
+ edbClassifyInfo.ModifyTime = time.Now()
|
|
|
+ updateCol = append(updateCol, "Sort", "ModifyTime")
|
|
|
} else {
|
|
|
// 拖动到父级分类的第一位
|
|
|
firstClassify, tmpErr := data_manage.GetFirstEdbClassifyByParentId(parentClassifyId)
|
|
@@ -858,6 +870,18 @@ func moveEdbClassify(parentEdbClassifyInfo, edbClassifyInfo, prevClassify *data_
|
|
|
edbInfo.Sort = prevEdbInfo.Sort + 1
|
|
|
edbInfo.ModifyTime = time.Now()
|
|
|
updateCol = append(updateCol, "Sort", "ModifyTime")
|
|
|
+ } else if prevClassify == nil && nextClassify == nil && prevEdbInfo == nil && nextEdbInfo == nil && parentClassifyId > 0 {
|
|
|
+ //处理只拖动到目录里,默认放到目录底部的情况
|
|
|
+ var maxSort int
|
|
|
+ maxSort, err = GetEdbClassifyMaxSort(parentClassifyId, classifyType)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "移动失败"
|
|
|
+ err = errors.New("查询组内排序信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ edbInfo.Sort = maxSort + 1 //那就是排在组内最后一位
|
|
|
+ edbInfo.ModifyTime = time.Now()
|
|
|
+ updateCol = append(updateCol, "Sort", "ModifyTime")
|
|
|
} else {
|
|
|
// 拖动到父级分类的第一位
|
|
|
firstClassify, tmpErr := data_manage.GetFirstEdbClassifyByParentId(parentClassifyId)
|