电子药箱通讯服务端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.ServiceModel;
  6. using RDH.Data.Models;
  7. namespace RDH.Data.BLL
  8. {
  9. public partial class SectionBLL : BaseOrclBLL<Section>, ISectionBLL
  10. {
  11. public SectionBLL() : base()
  12. {
  13. AliasTableName = "sec";
  14. }
  15. internal override String TABLE_NAME { get { return "SECTION"; } }//TB_NAME
  16. internal override string ENTITY_NAME { get { return "Section"; } }
  17. internal override String KEY_COLUMN { get { return "KEY"; } }//KEY_COLUMN
  18. internal override void InitMaps()
  19. {
  20. ColumnPropMaps.Add("KEY", "Key");
  21. ColumnPropMaps.Add("CREATE_BY", "CreateBy");
  22. ColumnPropMaps.Add("CREATE_TIME", "CreateTime");
  23. ColumnPropMaps.Add("IS_ACTIVE", "IsActive");
  24. ColumnPropMaps.Add("SECTION_ID", "SectionId");
  25. ColumnPropMaps.Add("SECTION_NAME", "SectionName");
  26. ColumnPropMaps.Add("SECTION_LEADER", "SectionLeader");
  27. ColumnPropMaps.Add("SECTION_STATES", "SectionStates");
  28. ColumnPropMaps.Add("SECTION_DESCRIPTION", "SectionDescription");
  29. ColumnPropMaps.Add("FLAG", "Flag");
  30. ColumnPropMaps.Add("CLIENT_TIME", "ClientTime");
  31. ColumnPropMaps.Add("SERVER_TIME", "ServerTime");
  32. ColumnPropMaps.Add("EXT01", "Ext01");
  33. ColumnPropMaps.Add("EXT02", "Ext02");
  34. ColumnPropMaps.Add("EXT03", "Ext03");
  35. ColumnPropMaps.Add("EXT04", "Ext04");
  36. ColumnPropMaps.Add("EXT05", "Ext05");
  37. ColumnPropMaps.Add("EXT06", "Ext06");
  38. ColumnPropMaps.Add("EXT07", "Ext07");
  39. ColumnPropMaps.Add("EXT08", "Ext08");
  40. ColumnPropMaps.Add("EXT09", "Ext09");
  41. ColumnPropMaps.Add("EXT10", "Ext10");//COLUMN_MAPS
  42. }
  43. internal override object GetParam(Section section)
  44. {
  45. return new
  46. {
  47. Key = section.Key,
  48. CreateBy = section.CreateBy,
  49. CreateTime = section.CreateTime,
  50. IsActive = section.IsActive,
  51. IsDelete = section.IsDelete,
  52. SectionId = section.SectionId,
  53. SectionName = section.SectionName,
  54. SectionLeader = section.SectionLeader,
  55. SectionStates = section.SectionStates,
  56. SectionDescription = section.SectionDescription,
  57. Flag = section.Flag,
  58. ClientTime = section.ClientTime,
  59. ServerTime = section.ServerTime,
  60. Ext01 = section.Ext01,
  61. Ext02 = section.Ext02,
  62. Ext03 = section.Ext03,
  63. Ext04 = section.Ext04,
  64. Ext05 = section.Ext05,
  65. Ext06 = section.Ext06,
  66. Ext07 = section.Ext07,
  67. Ext08 = section.Ext08,
  68. Ext09 = section.Ext09,
  69. Ext10 = section.Ext10, //Params
  70. };
  71. }
  72. public IEnumerable<Section> ListSection()
  73. {
  74. SqlBuilder sqlBuilder = new SqlBuilder(this);
  75. UserInfoBLL userInfoBLL = new UserInfoBLL();
  76. TableJoinInfo userTable = new TableJoinInfo
  77. {
  78. LeftDal = this,
  79. LeftColumnName = "CREATE_BY",
  80. RightDal = userInfoBLL,
  81. RightColumnName = userInfoBLL.KEY_COLUMN,
  82. JoinType = TableJoinTypes.Left,
  83. };
  84. sqlBuilder.AppendSelectionTable(userTable);
  85. return SqlMapper.Query<Section, UserInfo, Section>(ConnectionFactory.Current.GetSessionConnection(),
  86. sqlBuilder.ToString(),
  87. (s, ui) =>
  88. {
  89. s.UserInfo = ui;
  90. return s;
  91. },
  92. splitOn: sqlBuilder.GetSpiltors());
  93. }
  94. public Section GetBySectionId(string sectionId)
  95. {
  96. var sql = BuildBaseSql();
  97. return SqlMapper.Query<Section>(ConnectionFactory.Current.GetSessionConnection(),
  98. sql + " WHERE SECTION_ID = :SectionId",
  99. new { SectionId = sectionId }).FirstOrDefault();
  100. }
  101. public Section SearchSection(String sectionID, String sectionName)
  102. {
  103. StringBuilder sql = new StringBuilder();
  104. sql.Append(BuildBaseSql());
  105. sql.Append(" WHERE 1=1");
  106. if (!String.IsNullOrEmpty(sectionID))
  107. {
  108. sql.Append(" AND SECTION_ID=:sectionId");
  109. }
  110. if (!String.IsNullOrEmpty(sectionName))
  111. {
  112. sql.Append(" AND SECTION_NAME=:sectionName");
  113. }
  114. return SqlMapper.Query<Section>(ConnectionFactory.Current.GetSessionConnection(),
  115. sql.ToString(),
  116. new { sectionId = sectionID, sectionName = sectionName }).FirstOrDefault();
  117. }
  118. }
  119. }