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

@ -38,9 +38,9 @@ func (s *Rpc) GetBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
//通用获取单条
list := SqlKit.QueryByIds([]string{in.PersonId}, "t_base_teacher")
//处理从教年月
if len(list)>0{
if list[0]["cjny"].(string)[0:4]=="1900"{
list[0]["cjny"]=""
if len(list) > 0 {
if list[0]["cjny"].(string)[0:4] == "1900" {
list[0]["cjny"] = ""
}
}
//将结果序列化
@ -123,7 +123,7 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
model.Cjny = DateUtil.ConvertDate("1900-01-01")
} else {
//如果只传了年和月,手工补上日和时间
model.Cjny = DateUtil.ConvertDate( in.Cjny + "-01")
model.Cjny = DateUtil.ConvertDate(in.Cjny + "-01")
}
model.StageId = in.StageId
model.SubjectId = in.SubjectId
@ -134,7 +134,11 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
//教师的身份ID
model.IdentityId = 2
//排序号
model.SortId = int32(BaseTeacherDao.GetMaxSortId(in.OrgId)) + 1
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 {
@ -200,7 +204,7 @@ func (s *Rpc) DeleteBaseTeacher(ctx context.Context, in *BaseTeacherProto.Delete
return &reply, err
}
//删除人员时,对应的班主任,也要删除一下~
err=BaseClassDao.ClearPersonBzr(in.Ids)
err = BaseClassDao.ClearPersonBzr(in.Ids)
if err != nil {
LogUtil.Error(ErrorConst.SqlUpdateError, "执行ClearPersonBzr时发生严重错误"+err.Error())
reply.Success = false
@ -286,11 +290,11 @@ func (s *Rpc) UpdateBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelA
model.Zcm = in.Zcm
model.Bzlbm = in.Bzlbm
//排序号
model.SortId=in.SortId
model.SortId = in.SortId
if len(in.Cjny) == 0 {
model.Cjny = DateUtil.ConvertDate("1900-01-01")
} else {
model.Cjny = DateUtil.ConvertDate(in.Cjny+"-01")
model.Cjny = DateUtil.ConvertDate(in.Cjny + "-01")
}
model.StageId = in.StageId

Loading…
Cancel
Save