ExaminationBasicMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.keao.edu.user.dao.ExaminationBasicDao">
  8. <resultMap type="com.keao.edu.user.entity.ExaminationBasic" id="ExaminationBasic">
  9. <result column="id_" property="id" />
  10. <result column="name_" property="name" />
  11. <result column="exam_mode_" property="examMode" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
  12. <result column="exam_location_id_list_" property="examLocationIdList" />
  13. <result column="status_" property="status" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
  14. <result column="enroll_start_time_" property="enrollStartTime" />
  15. <result column="enroll_end_time_" property="enrollEndTime" />
  16. <result column="expect_exam_start_time_" property="expectExamStartTime" />
  17. <result column="expect_exam_end_time_" property="expectExamEndTime" />
  18. <result column="poster_title_" property="posterTitle" />
  19. <result column="poster_profile_" property="posterProfile" />
  20. <result column="poster_background_img_" property="posterBackgroundImg" />
  21. <result column="create_time_" property="createTime" />
  22. <result column="update_time_" property="updateTime" />
  23. <result column="tenant_id_" property="tenantId" />
  24. <result column="memo_" property="memo" />
  25. <result column="organ_id_" property="organId"/>
  26. <result column="creator_id_" property="creatorId"/>
  27. </resultMap>
  28. <resultMap id="ExaminationBasicDto" type="com.keao.edu.user.dto.ExaminationBasicDto" extends="ExaminationBasic">
  29. </resultMap>
  30. <!-- 根据主键查询一条记录 -->
  31. <select id="get" resultMap="ExaminationBasic" >
  32. SELECT * FROM examination_basic WHERE id_ = #{id}
  33. </select>
  34. <select id="getExaminationBasic" resultMap="ExaminationBasicDto" >
  35. SELECT * FROM examination_basic WHERE id_ = #{examId}
  36. </select>
  37. <!-- 全查询 -->
  38. <select id="findAll" resultMap="ExaminationBasic">
  39. SELECT * FROM examination_basic WHERE tenant_id_=#{tenantId}
  40. </select>
  41. <!-- 向数据库增加一条记录 -->
  42. <insert id="insert" parameterType="com.keao.edu.user.entity.ExaminationBasic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  43. INSERT INTO examination_basic (id_,name_,exam_mode_,exam_location_id_list_,status_,enroll_start_time_,enroll_end_time_,expect_exam_start_time_,expect_exam_end_time_,poster_title_,poster_profile_,poster_background_img_,creator_id_,create_time_,update_time_,tenant_id_,memo_,organ_id_)
  44. VALUES(#{id},#{name},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examLocationIdList},#{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{enrollStartTime},#{enrollEndTime},#{expectExamStartTime},#{expectExamEndTime},#{posterTitle},#{posterProfile},#{posterBackgroundImg},#{creatorId},NOW(),NOW(),#{tenantId},#{memo},#{organId})
  45. </insert>
  46. <update id="update" parameterType="com.keao.edu.user.entity.ExamOrganizationRelation">
  47. UPDATE examination_basic
  48. <set>
  49. <if test="name != null">
  50. name_ = #{name},
  51. </if>
  52. <if test="examMode != null">
  53. exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  54. </if>
  55. <if test="examLocationIdList != null">
  56. exam_location_id_list_ = #{examLocationIdList},
  57. </if>
  58. <if test="status != null">
  59. status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  60. </if>
  61. <if test="enrollStartTime != null">
  62. enroll_start_time_ = #{enrollStartTime},
  63. </if>
  64. <if test="enrollEndTime != null">
  65. enroll_end_time_ = #{enrollEndTime},
  66. </if>
  67. <if test="expectExamStartTime != null">
  68. expect_exam_start_time_ = #{expectExamStartTime},
  69. </if>
  70. <if test="expectExamEndTime != null">
  71. expect_exam_end_time_ = #{expectExamEndTime},
  72. </if>
  73. <if test="posterTitle != null">
  74. poster_title_ = #{posterTitle},
  75. </if>
  76. <if test="posterProfile != null">
  77. poster_profile_ = #{posterProfile},
  78. </if>
  79. <if test="posterBackgroundImg != null">
  80. poster_profile_ = #{posterBackgroundImg},
  81. </if>
  82. <if test="tenantId != null">
  83. tenant_id_ = #{tenantId},
  84. </if>
  85. <if test="memo!=null">
  86. memo_=#{memo},
  87. </if>
  88. <if test="creatorId!=null">
  89. creator_id_=#{creatorId},
  90. </if>
  91. update_time_ = NOW()
  92. </set> WHERE id_ = #{id}
  93. </update>
  94. <update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamOrganizationRelation">
  95. <foreach collection="exams" item="exam" separator=";">
  96. UPDATE examination_basic
  97. <set>
  98. <if test="name != null">
  99. name_ = #{exam.name},
  100. </if>
  101. <if test="examMode != null">
  102. exam_mode_ = #{exam.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  103. </if>
  104. <if test="examLocationIdList != null">
  105. exam_location_id_list_ = #{exam.examLocationIdList},
  106. </if>
  107. <if test="status != null">
  108. status_ = #{exam.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  109. </if>
  110. <if test="enrollStartTime != null">
  111. enroll_start_time_ = #{exam.enrollStartTime},
  112. </if>
  113. <if test="enrollEndTime != null">
  114. enroll_end_time_ = #{exam.enrollEndTime},
  115. </if>
  116. <if test="expectExamStartTime != null">
  117. expect_exam_start_time_ = #{exam.expectExamStartTime},
  118. </if>
  119. <if test="expectExamEndTime != null">
  120. expect_exam_end_time_ = #{exam.expectExamEndTime},
  121. </if>
  122. <if test="posterTitle != null">
  123. poster_title_ = #{exam.posterTitle},
  124. </if>
  125. <if test="posterProfile != null">
  126. poster_profile_ = #{exam.posterProfile},
  127. </if>
  128. <if test="posterBackgroundImg != null">
  129. poster_profile_ = #{exam.posterBackgroundImg},
  130. </if>
  131. <if test="tenantId != null">
  132. tenant_id_ = #{exam.tenantId},
  133. </if>
  134. <if test="memo!=null">
  135. memo_=#{memo},
  136. </if>
  137. <if test="creatorId!=null">
  138. creator_id_=#{creatorId},
  139. </if>
  140. update_time_ = NOW()
  141. </set> WHERE id_ = #{exam.id}
  142. </foreach>
  143. </update>
  144. <!-- 根据主键删除一条记录 -->
  145. <delete id="delete" >
  146. DELETE FROM examination_basic WHERE id_ = #{id}
  147. </delete>
  148. <sql id="queryCondition">
  149. <where>
  150. tenant_id_=#{tenantId}
  151. <if test="examStatus!=null">
  152. AND status_=#{examStatus}
  153. </if>
  154. <if test="search!=null">
  155. AND (id_=#{search} OR name_ LIKE CONCAT(#{search}, '%'))
  156. </if>
  157. </where>
  158. </sql>
  159. <!-- 分页查询 -->
  160. <select id="queryPage" resultMap="ExaminationBasic" parameterType="map">
  161. SELECT * FROM examination_basic
  162. <include refid="queryCondition"/>
  163. <include refid="global.limit"/>
  164. </select>
  165. <!-- 查询当前表的总记录数 -->
  166. <select id="queryCount" resultType="int">
  167. SELECT COUNT(*) FROM examination_basic
  168. <include refid="queryCondition"/>
  169. </select>
  170. <select id="findExaminationBasics" resultMap="ExaminationBasicDto" parameterType="map">
  171. SELECT * FROM examination_basic
  172. <include refid="queryCondition"/>
  173. ORDER BY id_ DESC
  174. <include refid="global.limit"/>
  175. </select>
  176. <select id="countExaminationBasics" resultType="int">
  177. SELECT COUNT(*) FROM examination_basic
  178. <include refid="queryCondition"/>
  179. </select>
  180. <select id="getNeedUpdateStatusExams" resultMap="ExaminationBasic">
  181. SELECT * FROM examination_basic WHERE status_ IN ('NOT_START', 'APPLYING', 'APPLIED')
  182. </select>
  183. <select id="getExams" resultMap="ExaminationBasicDto">
  184. SELECT * FROM examination_basic
  185. WHERE status_ IN ('EXAM_END')
  186. AND id_ IN
  187. <foreach collection="examIds" item="examId" separator="," open="(" close=")">
  188. #{examId}
  189. </foreach>
  190. </select>
  191. </mapper>