using Dapper;
using Learun.DataBase.Repository;
using Learun.Util;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创 建:超级管理员
/// 日 期:2020-05-21 16:16
/// 描 述:毕业学生信息
///
public class StuInfoGraduateService : RepositoryFactory
{
#region 构造函数和属性
private string fieldSql;
public StuInfoGraduateService()
{
fieldSql=@"
t.StuId,
t.StuNo,
t.StuCode,
t.NoticeNo,
t.GraduateYear,
t.ksh,
t.DeptNo,
t.MajorNo,
t.Grade,
t.ClassNo,
t.StuName,
t.SpellFull,
t.SpellBrief,
t.GenderNo,
t.Birthday,
t.PartyFaceNo,
t.FamilyOriginNo,
t.NationalityNo,
t.ProvinceNo,
t.RegionNo,
t.ResidenceNo,
t.TestStuSortNo,
t.HealthStatusNo,
t.WillNo,
t.TestStuSubjectNo,
t.GraduateNo,
t.PlanFormNo,
t.IsThreeGood,
t.IsExcellent,
t.IsNormalCadre,
t.IsProvinceFirstThree,
t.OverseasChineseNo,
t.MatriculateSort,
t.ComeProvinceNo,
t.HighSchoolNo,
t.HighSchoolName,
t.EntranceDate,
t.Religion,
t.GoodAt,
t.IdentityCardNo,
t.JoinPartyDate,
t.JoinLeagueDate,
t.InSchoolAddress,
t.InSchoolTelephone,
t.AbmormityMoveMark,
t.AwardMark,
t.PunishMark,
t.LinkmanMark,
t.StuNoChangeMark,
t.FinishSchoolMark,
t.CurrentRegisterMark,
t.FinishSchoolDate,
t.DiplomaNo,
t.DiplomaRemark,
t.Remark,
t.Photo,
t.TeachPlanNo,
t.CheckMark,
t.mobile,
t.EMail,
t.QQ,
t.FatherUnit,
t.FatherName,
t.FatherPhone,
t.MatherName,
t.MatherUnit,
t.MatherPhone,
t.username,
t.password,
t.MailAddress,
t.PostalCode,
t.InSchoolStatus,
t.TransMark,
t.ClassTutorNo,
t.ResumeCheck,
t.PracStatus,
t.RegisterStatus,
t.PunishmentDate,
t.F_CityId,
t.F_CountyId,
t.F_ProvinceId,
t.F_SchoolId,
t.EduSystem,
t.StudyModality,
t.SyncFlag,
t.ChangeStatus,
t.Balance,
t.HealthStatus
";
}
#endregion
#region 获取数据
///
/// 获取列表数据
///
///
public IEnumerable GetList( string queryJson )
{
try
{
//参考写法
//var queryParam = queryJson.ToJObject();
// 虚拟参数
//var dp = new DynamicParameters(new { });
//dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(fieldSql);
strSql.Append(" FROM StuInfoGraduate t ");
return this.BaseRepository("CollegeMIS").FindList(strSql.ToString());
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
///
/// 获取列表分页数据
/// 分页参数
///
///
public IEnumerable GetPageList(Pagination pagination, string queryJson)
{
try
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(fieldSql);
strSql.Append(" FROM StuInfoGraduate t ");
return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
///
/// 获取实体数据
/// 主键
///
///
public StuInfoGraduateEntity GetEntity(string keyValue)
{
try
{
return this.BaseRepository("CollegeMIS").FindEntity(keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
public void DeleteEntity(string keyValue)
{
try
{
this.BaseRepository("CollegeMIS").Delete(t=>t.StuId == keyValue);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
public void SaveEntity(string keyValue, StuInfoGraduateEntity entity)
{
try
{
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);
this.BaseRepository("CollegeMIS").Update(entity);
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
}
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}
#endregion
}
}