@@ -103,6 +103,57 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
dp.Add("Remark", "%" + queryParam["Remark"].ToString() + "%", DbType.String);
strSql.Append(" AND t.Remark Like @Remark ");
}
if (!queryParam["CheckMark"].IsEmpty())
{
dp.Add("CheckMark", "" + queryParam["CheckMark"].ToString() + "", DbType.String);
if (queryParam["CheckMark"].ToString() == "1")
{
strSql.Append(" AND t.CheckMark=@CheckMark ");
}
else
{
strSql.Append(" AND (t.CheckMark is null or t.CheckMark='0') ");
}
}
if (!queryParam["StuCode"].IsEmpty())
{
dp.Add("StuCode", "%" + queryParam["StuCode"].ToString() + "%", DbType.String);
strSql.Append(" AND t.StuCode Like @StuCode ");
}
if (!queryParam["PartyFaceNo"].IsEmpty())
{
dp.Add("PartyFaceNo", "" + queryParam["PartyFaceNo"].ToString() + "", DbType.String);
strSql.Append(" AND t.PartyFaceNo = @PartyFaceNo ");
}
if (!queryParam["EduSystem"].IsEmpty())
{
dp.Add("EduSystem", "" + queryParam["EduSystem"].ToString() + "", DbType.String);
strSql.Append(" AND t.EduSystem = @EduSystem ");
}
if (!queryParam["HealthStatus"].IsEmpty())
{
dp.Add("HealthStatus", "" + queryParam["HealthStatus"].ToString() + "", DbType.String);
strSql.Append(" AND t.HealthStatus = @HealthStatus ");
}
if (!queryParam["StudyModality"].IsEmpty())
{
dp.Add("StudyModality", "" + queryParam["StudyModality"].ToString() + "", DbType.String);
strSql.Append(" AND t.StudyModality = @StudyModality ");
}
if (!queryParam["Photo"].IsEmpty())
{
dp.Add("Photo", "" + queryParam["Photo"].ToString() + "", DbType.String);
if (queryParam["Photo"].ToString() == "1")
{
strSql.Append(" AND t.Photo is not null ");
}
else
{
strSql.Append(" AND t.Photo is null ");
}
}
return this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(strSql.ToString(), dp, pagination);
}
catch (Exception ex)
@@ -447,13 +498,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
var url = AppDomain.CurrentDomain.BaseDirectory;
foreach (var stuInfo in stuList)
{
//照片不为空
if (!string.IsNullOrEmpty(stuInfo.Photo))
//判断要上传的照片在本地服务器中是否存在
var photoPath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
if (System.IO.File.Exists(photoPath))
{
var annex = this.BaseRepository()
.FindEntity<AnnexesFileEntity>(a => a.F_FolderId == stuInfo.Photo);
if (annex == null)
//学籍表中照片字段不为空
if (!string.IsNullOrEmpty(stuInfo.Photo))
{
var annex = this.BaseRepository()
.FindEntity<AnnexesFileEntity>(a => a.F_FolderId == stuInfo.Photo);
if (annex == null)
{
var annexEntity = new AnnexesFileEntity()
{
F_Id = Guid.NewGuid().ToString(),
F_FileName = stuInfo.IdentityCardNo + ".jpg",
F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
};
this.BaseRepository().Insert(annexEntity);
}
else
{
annex.F_FileName = stuInfo.IdentityCardNo + ".jpg";
annex.F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
this.BaseRepository().Update(annex);
}
}
else
{
stuInfo.Photo = Guid.NewGuid().ToString();
var annexEntity = new AnnexesFileEntity()
{
F_Id = Guid.NewGuid().ToString(),
@@ -461,32 +537,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
};
annexEntity.Create();
this.BaseRepository("CollegeMIS").Update(stuInfo);
this.BaseRepository().Insert(annexEntity);
}
else
{
annex.F_FileName = stuInfo.IdentityCardNo + ".jpg";
annex.F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
this.BaseRepository().Update(annex);
}
}
else
{
stuInfo.Photo = Guid.NewGuid().ToString();
var annexEntity = new AnnexesFileEntity()
{
F_Id = Guid.NewGuid().ToString(),
F_FileName = stuInfo.IdentityCardNo + ".jpg",
F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
};
annexEntity.Create();
this.BaseRepository("CollegeMIS").Update(stuInfo);
this.BaseRepository().Insert(annexEntity);
}
}
}
catch (Exception ex)