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