master
huanghai 5 years ago
parent eacec9a8c3
commit 414be360b4

@ -58,7 +58,7 @@ func GetByIds(ids []string) ([]models.TBaseTeacher, error) {
*/
func GetMaxSortId(OrgId string) int64 {
//取最大值
sql := "select ifnull(max(sort_id),0) as maxSortId from t_base_teacher_org where org_id=? and b_use=1"
sql := "select ifnull(max(sort_id),0) as maxSortId from t_base_teacher where org_id=? and b_use=1"
listSort, _ := db.SQL(sql, OrgId).Query().List()
SortId := listSort[0]["maxSortId"].(int64)
return SortId

@ -134,7 +134,11 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
//教师的身份ID
model.IdentityId = 2
//排序号
if in.SortId > 0 {
model.SortId = int32(BaseTeacherDao.GetMaxSortId(in.OrgId)) + 1
} else {
model.SortId = in.SortId
}
//主单位与主部门
list := SqlKit.QueryByIds([]string{in.OrgId}, "t_base_organization")
if list == nil || len(list) == 0 {

Loading…
Cancel
Save