You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

243 lines
7.0 KiB

  1. using Dapper;
  2. using Learun.DataBase.Repository;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Text;
  8. namespace Learun.Application.TwoDevelopment.EducationalAdministration
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-05-18 14:35
  15. /// 描 述:学籍信息管理
  16. /// </summary>
  17. public class StuInfoBasicTwoService : RepositoryFactory
  18. {
  19. #region 构造函数和属性
  20. private string fieldSql;
  21. public StuInfoBasicTwoService()
  22. {
  23. fieldSql=@"
  24. t.id,
  25. t.StuNo,
  26. t.StuName,
  27. t.IdCard,
  28. t.Birthday,
  29. t.GraduateDate,
  30. t.Age,
  31. t.Sex,
  32. t.HuKouPaperNum,
  33. t.OriginAddress,
  34. t.ResidenceNo,
  35. t.FamilyRelation,
  36. t.NationalityNo,
  37. t.CultureDegreeNo,
  38. t.FatherName,
  39. t.FatherIdCard,
  40. t.FatherPhone,
  41. t.MotherName,
  42. t.MotherIdCard,
  43. t.MotherPhone,
  44. t.TeachSituation,
  45. t.WorkUnits,
  46. t.Phone,
  47. t.HealthType,
  48. t.DisableType,
  49. t.PartyFaceNo,
  50. t.MainBusiness,
  51. t.Remark,
  52. t.OriginalCountry,
  53. t.OriginalVillage,
  54. t.OriginalSchool,
  55. t.OriginalGrade,
  56. t.OriginalTeacher,
  57. t.OriginalTeacherPhone,
  58. t.OriginalClass,
  59. t.OriginalClassType,
  60. t.OriginalStudyWay,
  61. t.OriginalStudyPeriod,
  62. t.OriginalStudentStatus,
  63. t.Province,
  64. t.Area,
  65. t.Country,
  66. t.Village,
  67. t.Hamlet,
  68. t.Groups,
  69. t.DoorNum,
  70. t.XinJiangStatus,
  71. t.ReadCountry,
  72. t.ReadVillage,
  73. t.ReadSchool,
  74. t.ReadStudyPeriod,
  75. t.ReadGrade,
  76. t.DivisionType,
  77. t.PlanType,
  78. t.AdmissionTime,
  79. t.ReadTeacher,
  80. t.ReadTeacherPhone,
  81. t.ReadClass,
  82. t.GraduateNo,
  83. t.ReadClassType,
  84. t.ReadStudyWay,
  85. t.ReadStudentStatus
  86. ";
  87. }
  88. #endregion
  89. #region 获取数据
  90. /// <summary>
  91. /// 获取列表数据
  92. /// <summary>
  93. /// <returns></returns>
  94. public IEnumerable<StuInfoBasicTwoEntity> GetList( string queryJson )
  95. {
  96. try
  97. {
  98. //参考写法
  99. //var queryParam = queryJson.ToJObject();
  100. // 虚拟参数
  101. //var dp = new DynamicParameters(new { });
  102. //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
  103. var strSql = new StringBuilder();
  104. strSql.Append("SELECT ");
  105. strSql.Append(fieldSql);
  106. strSql.Append(" FROM StuInfoBasicTwo t ");
  107. return this.BaseRepository("CollegeMIS").FindList<StuInfoBasicTwoEntity>(strSql.ToString());
  108. }
  109. catch (Exception ex)
  110. {
  111. if (ex is ExceptionEx)
  112. {
  113. throw;
  114. }
  115. else
  116. {
  117. throw ExceptionEx.ThrowServiceException(ex);
  118. }
  119. }
  120. }
  121. /// <summary>
  122. /// 获取列表分页数据
  123. /// <param name="pagination">分页参数</param>
  124. /// <summary>
  125. /// <returns></returns>
  126. public IEnumerable<StuInfoBasicTwoEntity> GetPageList(Pagination pagination, string queryJson)
  127. {
  128. try
  129. {
  130. var strSql = new StringBuilder();
  131. strSql.Append("SELECT ");
  132. strSql.Append(fieldSql);
  133. strSql.Append(" FROM StuInfoBasicTwo t ");
  134. return this.BaseRepository("CollegeMIS").FindList<StuInfoBasicTwoEntity>(strSql.ToString(), pagination);
  135. }
  136. catch (Exception ex)
  137. {
  138. if (ex is ExceptionEx)
  139. {
  140. throw;
  141. }
  142. else
  143. {
  144. throw ExceptionEx.ThrowServiceException(ex);
  145. }
  146. }
  147. }
  148. /// <summary>
  149. /// 获取实体数据
  150. /// <param name="keyValue">主键</param>
  151. /// <summary>
  152. /// <returns></returns>
  153. public StuInfoBasicTwoEntity GetEntity(string keyValue)
  154. {
  155. try
  156. {
  157. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicTwoEntity>(keyValue);
  158. }
  159. catch (Exception ex)
  160. {
  161. if (ex is ExceptionEx)
  162. {
  163. throw;
  164. }
  165. else
  166. {
  167. throw ExceptionEx.ThrowServiceException(ex);
  168. }
  169. }
  170. }
  171. #endregion
  172. #region 提交数据
  173. /// <summary>
  174. /// 删除实体数据
  175. /// <param name="keyValue">主键</param>
  176. /// <summary>
  177. /// <returns></returns>
  178. public void DeleteEntity(string keyValue)
  179. {
  180. try
  181. {
  182. this.BaseRepository("CollegeMIS").Delete<StuInfoBasicTwoEntity>(t=>t.id == keyValue);
  183. }
  184. catch (Exception ex)
  185. {
  186. if (ex is ExceptionEx)
  187. {
  188. throw;
  189. }
  190. else
  191. {
  192. throw ExceptionEx.ThrowServiceException(ex);
  193. }
  194. }
  195. }
  196. /// <summary>
  197. /// 保存实体数据(新增、修改)
  198. /// <param name="keyValue">主键</param>
  199. /// <summary>
  200. /// <returns></returns>
  201. public void SaveEntity(string keyValue, StuInfoBasicTwoEntity entity)
  202. {
  203. try
  204. {
  205. if (!string.IsNullOrEmpty(keyValue))
  206. {
  207. entity.Modify(keyValue);
  208. this.BaseRepository("CollegeMIS").Update(entity);
  209. }
  210. else
  211. {
  212. entity.Create();
  213. this.BaseRepository("CollegeMIS").Insert(entity);
  214. }
  215. }
  216. catch (Exception ex)
  217. {
  218. if (ex is ExceptionEx)
  219. {
  220. throw;
  221. }
  222. else
  223. {
  224. throw ExceptionEx.ThrowServiceException(ex);
  225. }
  226. }
  227. }
  228. #endregion
  229. }
  230. }