|
|
|
@ -14,6 +14,14 @@ var db = DbUtil.Engine
|
|
|
|
|
|
|
|
|
|
//增加
|
|
|
|
|
func AddBasePosition(model models.TBasePosition) (int64, error) {
|
|
|
|
|
if model.SortId == 0 {
|
|
|
|
|
sql := `select ifnull(max(sort_id),0) as maxSortId from t_base_position where parent_id=?`
|
|
|
|
|
list, err := db.SQL(sql, model.ParentId).Query().List()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return -1, err
|
|
|
|
|
}
|
|
|
|
|
model.SortId = int32(list[0]["maxSortId"].(int64) + 1)
|
|
|
|
|
}
|
|
|
|
|
return db.Insert(model)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|