ExaminationBasicMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. </resultMap>
  25. <!-- 根据主键查询一条记录 -->
  26. <select id="get" resultMap="ExaminationBasic" >
  27. SELECT * FROM examination_basic WHERE id_ = #{id}
  28. </select>
  29. <!-- 全查询 -->
  30. <select id="findAll" resultMap="ExaminationBasic">
  31. SELECT * FROM examination_basic WHERE tenant_id_=#{tenantId}
  32. </select>
  33. <!-- 向数据库增加一条记录 -->
  34. <insert id="insert" parameterType="com.keao.edu.user.entity.ExaminationBasic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  35. 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_,create_time_,update_time_,tenant_id_)
  36. 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},NOW(),NOW(),#{tenantId})
  37. </insert>
  38. <update id="update" parameterType="com.keao.edu.user.entity.ExamAgencyRelation">
  39. UPDATE examination_basic
  40. <set>
  41. <if test="name != null">
  42. AND name_ = #{name},
  43. </if>
  44. <if test="examMode != null">
  45. AND exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  46. </if>
  47. <if test="examLocationIdList != null">
  48. AND exam_location_id_list_ = #{examLocationIdList},
  49. </if>
  50. <if test="status != null">
  51. AND status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  52. </if>
  53. <if test="enrollStartTime != null">
  54. AND enroll_start_time_ = #{enrollStartTime},
  55. </if>
  56. <if test="enrollEndTime != null">
  57. AND enroll_end_time_ = #{enrollEndTime},
  58. </if>
  59. <if test="expectExamStartTime != null">
  60. AND expect_exam_start_time_ = #{expectExamStartTime},
  61. </if>
  62. <if test="expectExamEndTime != null">
  63. AND expect_exam_end_time_ = #{expectExamEndTime},
  64. </if>
  65. <if test="posterTitle != null">
  66. AND poster_title_ = #{posterTitle},
  67. </if>
  68. <if test="posterProfile != null">
  69. AND poster_profile_ = #{posterProfile},
  70. </if>
  71. <if test="posterBackgroundImg != null">
  72. AND poster_profile_ = #{posterBackgroundImg},
  73. </if>
  74. <if test="tenantId != null">
  75. AND tenant_id_ = #{tenantId},
  76. </if>
  77. update_time_ = NOW()
  78. </set> WHERE id_ = #{id}
  79. </update>
  80. <update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamAgencyRelation">
  81. <foreach collection="exams" item="exam" separator=";">
  82. UPDATE examination_basic
  83. <set>
  84. <if test="name != null">
  85. AND name_ = #{exam.name},
  86. </if>
  87. <if test="examMode != null">
  88. AND exam_mode_ = #{exam.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  89. </if>
  90. <if test="examLocationIdList != null">
  91. AND exam_location_id_list_ = #{exam.examLocationIdList},
  92. </if>
  93. <if test="status != null">
  94. AND status_ = #{exam.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  95. </if>
  96. <if test="enrollStartTime != null">
  97. AND enroll_start_time_ = #{exam.enrollStartTime},
  98. </if>
  99. <if test="enrollEndTime != null">
  100. AND enroll_end_time_ = #{exam.enrollEndTime},
  101. </if>
  102. <if test="expectExamStartTime != null">
  103. AND expect_exam_start_time_ = #{exam.expectExamStartTime},
  104. </if>
  105. <if test="expectExamEndTime != null">
  106. AND expect_exam_end_time_ = #{exam.expectExamEndTime},
  107. </if>
  108. <if test="posterTitle != null">
  109. AND poster_title_ = #{exam.posterTitle},
  110. </if>
  111. <if test="posterProfile != null">
  112. AND poster_profile_ = #{exam.posterProfile},
  113. </if>
  114. <if test="posterBackgroundImg != null">
  115. AND poster_profile_ = #{exam.posterBackgroundImg},
  116. </if>
  117. <if test="tenantId != null">
  118. AND tenant_id_ = #{exam.tenantId},
  119. </if>
  120. update_time_ = NOW()
  121. </set> WHERE id_ = #{exam.id}
  122. </foreach>
  123. </update>
  124. <!-- 根据主键删除一条记录 -->
  125. <delete id="delete" >
  126. DELETE FROM examination_basic WHERE id_ = #{id}
  127. </delete>
  128. <sql id="queryCondition">
  129. <where>
  130. tenant_id_=#{tenantId}
  131. <if test="examStatus!=null">
  132. status_=#{examStatus}
  133. </if>
  134. </where>
  135. </sql>
  136. <!-- 分页查询 -->
  137. <select id="queryPage" resultMap="ExaminationBasic" parameterType="map">
  138. SELECT * FROM examination_basic
  139. <include refid="queryCondition"/>
  140. <include refid="global.limit"/>
  141. </select>
  142. <!-- 查询当前表的总记录数 -->
  143. <select id="queryCount" resultType="int">
  144. SELECT COUNT(*) FROM examination_basic
  145. <include refid="queryCondition"/>
  146. </select>
  147. <select id="getNeedUpdateStatusExams" resultMap="ExaminationBasic">
  148. SELECT * FROM examination_basic WHERE status_ IN ('NOT_START', 'APPLYING', 'APPLIED')
  149. </select>
  150. </mapper>