|
@@ -247,10 +247,11 @@ func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error)
|
|
|
// UpdateExcelInfoSortByClassifyId 根据表格id更新排序
|
|
|
func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string) (err error) {
|
|
|
o := orm.NewOrmUsingDB("data")
|
|
|
- sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? and sort > ? AND is_delete=0 `
|
|
|
+ sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? AND is_delete=0 AND ( sort > ? `
|
|
|
if prevExcelInfoId > 0 {
|
|
|
- sql += ` or (excel_info_id > ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
|
|
|
+ sql += ` or (excel_info_id < ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
|
|
|
}
|
|
|
+ sql += `)`
|
|
|
_, err = o.Raw(sql, classifyId, nowSort).Exec()
|
|
|
return
|
|
|
}
|