|
@@ -219,7 +219,7 @@ func (m *SpeechRecognitionTagMenu) UpdateSortByParentId(parentId, menuId, nowSor
|
|
|
// GetMaxSortByParentId 获取父级分类下最大Sort
|
|
|
func (m *SpeechRecognitionTagMenu) GetMaxSortByParentId(parentId int) (sort int, err error) {
|
|
|
o := global.DbMap[utils.DbNameMaster]
|
|
|
- sql := fmt.Sprintf(`SELECT MAX(sort) AS sort FROM %s WHERE %s = ?`, m.TableName(), SpeechRecognitionTagMenuCols.ParentId)
|
|
|
+ sql := fmt.Sprintf(`SELECT COALESCE(MAX(sort), 0) AS sort FROM %s WHERE %s = ?`, m.TableName(), SpeechRecognitionTagMenuCols.ParentId)
|
|
|
err = o.Raw(sql, parentId).Scan(&sort).Error
|
|
|
return
|
|
|
}
|