This commit is contained in:
tanglong 2025-06-06 17:17:18 +08:00
parent 9e3d1254b4
commit c9db953153
2 changed files with 24 additions and 11 deletions

View File

@ -139,6 +139,11 @@ namespace VOL.Business.Services.School
school_Entity.CreateDate = DateTime.Now; school_Entity.CreateDate = DateTime.Now;
school_Entity.Creator = UserContext.Current.UserId; school_Entity.Creator = UserContext.Current.UserId;
var gradeEntityList = new List<S_SchoolAssocGrade>();
if (paramDto.SchoolType == SchoolType.School)
{
var natureList = await _natureAssocGradeRepository.FindAsync(x => x.NatureId == paramDto.SchoolNatureId); var natureList = await _natureAssocGradeRepository.FindAsync(x => x.NatureId == paramDto.SchoolNatureId);
if (natureList == null || natureList.Count == 0) if (natureList == null || natureList.Count == 0)
throw new Exception($"未找到学校性质:{paramDto.SchoolNatureId}"); throw new Exception($"未找到学校性质:{paramDto.SchoolNatureId}");
@ -147,8 +152,6 @@ namespace VOL.Business.Services.School
if (user != null) if (user != null)
throw new Exception($"用户名为{paramDto.UserName}的学校已存在"); throw new Exception($"用户名为{paramDto.UserName}的学校已存在");
var gradeEntityList = new List<S_SchoolAssocGrade>();
foreach (var nature in natureList) foreach (var nature in natureList)
{ {
gradeEntityList.Add(new S_SchoolAssocGrade() gradeEntityList.Add(new S_SchoolAssocGrade()
@ -157,6 +160,16 @@ namespace VOL.Business.Services.School
GradeId = nature.GradeId GradeId = nature.GradeId
}); });
} }
}
else
{
var grade = await _gradeRepository.FindAsIQueryable(x => x.GradeName == "运动馆").FirstOrDefaultAsync();
gradeEntityList.Add(new S_SchoolAssocGrade()
{
SchoolCode = nextSchoolCode,
GradeId = grade?.Id ?? 0
});
}
var userEntity = new Sys_User() var userEntity = new Sys_User()
{ {

View File

@ -62,7 +62,7 @@ namespace VOL.Model.School.Request
/// <summary> /// <summary>
///学校性质Id ///学校性质Id
/// </summary> /// </summary>
public int SchoolNatureId { get; set; } public int? SchoolNatureId { get; set; }
/// <summary> /// <summary>
///学校编号 ///学校编号