讲师提交 新增是否重复校验

master
xiaochanghai 5 months ago
parent bd00148207
commit 4806eb0260
  1. 12
      Tiobon.Core.Services/CommonServices.cs
  2. 3
      Tiobon.Core.Services/Ghre/Ghre_TeacherServices.cs

@ -3515,7 +3515,17 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
string json = param.jsonParam.ToString();
var dict = JsonHelper.JsonToObj<Ghre_Teacher>(json);
var staffId = dict.StaffId;
dict.StaffId = GetStaffId();
var staff = await Db.Queryable<Ghra_Staff>().FirstAsync(x => x.StaffID == staffId);
if (staff != null)
{
dict.TeacherNo = staff.StaffNo;
dict.TeacherName = staff.StaffName;
}
if (await Db.Queryable<Ghre_Teacher>().AnyAsync(x => x.StaffId == staffId))
throw new Exception($"员工【{staff.StaffName}({staff.StaffNo})】已在讲师列表中!");
//dict.StaffId = GetStaffId();
id = await Db.Insertable(dict).ExecuteReturnSnowflakeIdAsync();

@ -190,6 +190,9 @@ FROM (SELECT A.*,
entity.TeacherNo = staff.StaffNo;
entity.TeacherName = staff.StaffName;
}
if (await base.AnyAsync(x => x.StaffId == entity.StaffId))
throw new Exception($"员工【{staff.StaffName}({staff.StaffNo})】已在讲师列表中!");
}
else
{

Loading…
Cancel
Save