ExamRegistrationMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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.ExamRegistrationDao">
  8. <resultMap type="com.keao.edu.user.entity.ExamRegistration" id="ExamRegistration">
  9. <id column="id_" property="id" />
  10. <result column="examination_basic_id_" property="examinationBasicId" />
  11. <result column="student_id_" property="studentId" />
  12. <result column="organ_id_" property="organId" />
  13. <result column="subject_id_" property="subjectId" />
  14. <result column="level_" property="level" />
  15. <result column="level_fee_" property="levelFee" />
  16. <result column="song_json_" property="songJson" />
  17. <result column="last_exam_level_" property="lastExamLevel" />
  18. <result column="last_exam_certificate_url_" property="lastExamCertificateUrl" />
  19. <result column="exam_music_theory_level_" property="examMusicTheoryLevel" />
  20. <result column="theory_level_fee_" property="theoryLevelFee" />
  21. <result column="last_music_theory_level_" property="lastMusicTheoryLevel" />
  22. <result column="last_music_theory_certificate_url_" property="lastMusicTheoryCertificateUrl" />
  23. <result column="adviser_name_" property="adviserName" />
  24. <result column="adviser_phone_" property="adviserPhone" />
  25. <result column="card_no_" property="cardNo" />
  26. <result column="status_" property="status" />
  27. <result column="create_time_" property="createTime" />
  28. <result column="update_time_" property="updateTime" />
  29. <result column="tenant_id_" property="tenantId" />
  30. <result column="memo_" property="memo" />
  31. <association property="sysUser" columnPrefix="sys_user_" resultMap="com.keao.edu.user.dao.StudentDao.Student"/>
  32. <association property="subject" columnPrefix="subject_" resultMap="com.keao.edu.user.dao.SubjectDao.Subject"/>
  33. <association property="examinationBasic" columnPrefix="examination_basic_" resultMap="com.keao.edu.user.dao.ExaminationBasicDao.ExaminationBasic"/>
  34. </resultMap>
  35. <resultMap id="ExamRegistrationRoomDto" type="com.keao.edu.user.dto.ExamRegistrationRoomDto" extends="ExamRegistration">
  36. <result column="exam_room_id_" property="examRoomId"/>
  37. <result column="exam_start_time_" property="examStartTime"/>
  38. <result column="exam_end_time_" property="examEndTime"/>
  39. </resultMap>
  40. <!-- 根据主键查询一条记录 -->
  41. <select id="get" resultMap="ExamRegistration" >
  42. SELECT * FROM exam_registration WHERE id_ = #{id}
  43. </select>
  44. <!-- 全查询 -->
  45. <select id="findAll" resultMap="ExamRegistration">
  46. SELECT * FROM exam_registration ORDER BY id_
  47. </select>
  48. <!-- 向数据库增加一条记录 -->
  49. <insert id="insert" parameterType="com.keao.edu.user.entity.ExamRegistration" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  50. INSERT INTO exam_registration (examination_basic_id_, student_id_, organ_id_,subject_id_, level_, level_fee_,
  51. song_json_, last_exam_level_, last_exam_certificate_url_,exam_music_theory_level_, theory_level_fee_,
  52. last_music_theory_level_,last_music_theory_certificate_url_, adviser_name_,adviser_phone_, card_no_, status_,
  53. create_time_, update_time_, tenant_id_,memo_)
  54. VALUES (#{examinationBasicId}, #{studentId}, #{organId}, #{subjectId}, #{level}, #{levelFee}, #{songJson},
  55. #{lastExamLevel}, #{lastExamCertificateUrl}, #{examMusicTheoryLevel}, #{theoryLevelFee}, #{lastMusicTheoryLevel},
  56. #{lastMusicTheoryCertificateUrl}, #{adviserName}, #{adviserPhone}, #{cardNo}, #{status},#{createTime},
  57. #{updateTime}, #{tenantId}, #{memo})
  58. </insert>
  59. <!-- 根据主键查询一条记录 -->
  60. <update id="update" parameterType="com.keao.edu.user.entity.ExamRegistration">
  61. UPDATE exam_registration
  62. <set>
  63. <if test="examinationBasicId != null">
  64. examination_basic_id_ = #{examinationBasicId},
  65. </if>
  66. <if test="studentId != null">
  67. student_id_ = #{studentId},
  68. </if>
  69. <if test="organId != null">
  70. organ_id_ = #{organId},
  71. </if>
  72. <if test="subjectId != null">
  73. subject_id_ = #{subjectId},
  74. </if>
  75. <if test="level != null">
  76. level_ = #{level},
  77. </if>
  78. <if test="levelFee != null">
  79. level_fee_ = #{levelFee},
  80. </if>
  81. <if test="songJson != null">
  82. song_json_ = #{songJson},
  83. </if>
  84. <if test="lastExamLevel != null">
  85. last_exam_level_ = #{lastExamLevel},
  86. </if>
  87. <if test="lastExamCertificateUrl != null">
  88. last_exam_certificate_url_ = #{lastExamCertificateUrl},
  89. </if>
  90. <if test="examMusicTheoryLevel!= null">
  91. exam_music_theory_level_ = #{examMusicTheoryLevel},
  92. </if>
  93. <if test="theoryLevelFee!= null">
  94. theory_level_fee_ = #{theoryLevelFee},
  95. </if>
  96. <if test="lastMusicTheoryLevel != null">
  97. last_music_theory_level_ = #{lastMusicTheoryLevel},
  98. </if>
  99. <if test="lastMusicTheoryCertificateUrl != null">
  100. last_music_theory_certificate_url_ = #{lastMusicTheoryCertificateUrl},
  101. </if>
  102. <if test="adviserName != null">
  103. adviser_name_ = #{adviserName},
  104. </if>
  105. <if test="adviserPhone != null">
  106. adviser_phone_ = #{adviserPhone},
  107. </if>
  108. <if test="cardNo!=null">
  109. card_no_ =#{cardNo},
  110. </if>
  111. <if test="status!=null">
  112. status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  113. </if>
  114. <if test="tenantId != null">
  115. tenant_id_ = #{tenantId},
  116. </if>
  117. <if test="createTime != null">
  118. create_time_ = #{createTime},
  119. </if>
  120. <if test="memo!=null">
  121. memo_ = #{memo},
  122. </if>
  123. update_time_ = NOW()
  124. </set>
  125. WHERE id_ = #{id}
  126. </update>
  127. <update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamRegistration">
  128. <foreach collection="regists" item="regist" separator=";">
  129. UPDATE exam_registration
  130. <set>
  131. <if test="regist.examinationBasicId != null">
  132. examination_basic_id_ = #{regist.examinationBasicId},
  133. </if>
  134. <if test="regist.studentId != null">
  135. student_id_ = #{regist.studentId},
  136. </if>
  137. <if test="regist.organId != null">
  138. organ_id_ = #{regist.organId},
  139. </if>
  140. <if test="regist.subjectId != null">
  141. subject_id_ = #{regist.subjectId},
  142. </if>
  143. <if test="regist.level != null">
  144. level_ = #{regist.level},
  145. </if>
  146. <if test="regist.levelFee != null">
  147. level_fee_ = #{regist.levelFee},
  148. </if>
  149. <if test="regist.songJson != null">
  150. song_json_ = #{regist.songJson},
  151. </if>
  152. <if test="regist.lastExamLevel != null">
  153. last_exam_level_ = #{regist.lastExamLevel},
  154. </if>
  155. <if test="regist.lastExamCertificateUrl != null">
  156. last_exam_certificate_url_ = #{regist.lastExamCertificateUrl},
  157. </if>
  158. <if test="regist.examMusicTheoryLevel!= null">
  159. exam_music_theory_level_ = #{regist.examMusicTheoryLevel},
  160. </if>
  161. <if test="regist.theoryLevelFee!= null">
  162. theory_level_fee_ = #{regist.theoryLevelFee},
  163. </if>
  164. <if test="regist.lastMusicTheoryLevel != null">
  165. last_music_theory_level_ = #{regist.lastMusicTheoryLevel},
  166. </if>
  167. <if test="regist.lastMusicTheoryCertificateUrl != null">
  168. last_music_theory_certificate_url_ = #{regist.lastMusicTheoryCertificateUrl},
  169. </if>
  170. <if test="regist.adviserName != null">
  171. adviser_name_ = #{regist.adviserName},
  172. </if>
  173. <if test="regist.adviserPhone != null">
  174. adviser_phone_ = #{regist.adviserPhone},
  175. </if>
  176. <if test="regist.cardNo!=null">
  177. card_no_ =#{regist.cardNo},
  178. </if>
  179. <if test="regist.status!=null">
  180. status_ = #{regist.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
  181. </if>
  182. <if test="regist.tenantId != null">
  183. tenant_id_ = #{regist.tenantId},
  184. </if>
  185. <if test="regist.memo!=null">
  186. memo_ = #{regist.memo},
  187. </if>
  188. update_time_ = NOW()
  189. </set>
  190. WHERE id_ = #{id}
  191. </foreach>
  192. </update>
  193. <!-- 根据主键删除一条记录 -->
  194. <delete id="delete" >
  195. DELETE FROM exam_registration WHERE id_ = #{id}
  196. </delete>
  197. <sql id="queryCondition">
  198. <where>
  199. <if test="organIds!=null">
  200. AND er.organ_id_ IN
  201. <foreach collection="organIds" item="organId" separator="," open="(" close=")">
  202. #{organId}
  203. </foreach>
  204. </if>
  205. <if test="examId!=null">
  206. AND er.examination_basic_id_ = #{examId}
  207. </if>
  208. <if test="organId != null">
  209. AND er.organ_id_ = #{organId}
  210. </if>
  211. <if test="subjectId!=null">
  212. AND er.subject_id_ = #{subjectId}
  213. </if>
  214. <if test="level!=null">
  215. AND er.level_ = #{level}
  216. </if>
  217. <if test="status!=null">
  218. AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
  219. </if>
  220. </where>
  221. </sql>
  222. <!-- 分页查询 -->
  223. <select id="queryPage" resultMap="ExamRegistration" parameterType="map">
  224. SELECT
  225. er.id_,
  226. er.examination_basic_id_,
  227. er.exam_music_theory_level_,
  228. er.card_no_,
  229. er.student_id_,
  230. er.memo_,
  231. su.real_name_ sys_user_real_name_,
  232. er.last_exam_certificate_url_,
  233. er.last_music_theory_certificate_url_,
  234. er.level_fee_,
  235. er.theory_level_fee_,
  236. er.organ_id_,
  237. er.subject_id_,
  238. er.level_,
  239. erp.trans_amount_,
  240. er.status_,
  241. er.create_time_
  242. FROM
  243. exam_registration er
  244. LEFT JOIN sys_user su ON er.student_id_ = su.id_
  245. LEFT JOIN exam_registration_payment erp ON er.id_ = erp.exam_registration_id_
  246. <include refid="queryCondition"/>
  247. ORDER BY er.id_
  248. <include refid="global.limit"/>
  249. </select>
  250. <!-- 查询当前表的总记录数 -->
  251. <select id="queryCount" resultType="int">
  252. SELECT COUNT(*) FROM exam_registration er
  253. <include refid="queryCondition"/>
  254. </select>
  255. <sql id="queryExamRegistCondition">
  256. <where>
  257. <if test="organIds!=null">
  258. AND er.organ_id_ IN
  259. <foreach collection="organIds" item="organId" separator="," open="(" close=")">
  260. #{organId}
  261. </foreach>
  262. </if>
  263. <if test="examId!=null">
  264. AND er.examination_basic_id_ = #{examId}
  265. </if>
  266. <if test="organId!=null">
  267. AND er.organ_id_ = #{organId}
  268. </if>
  269. <if test="subjectId!=null">
  270. AND er.subject_id_ = #{subjectId}
  271. </if>
  272. <if test="level!=null">
  273. AND er.level_ = #{level}
  274. </if>
  275. <if test="status!=null">
  276. AND er.status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
  277. </if>
  278. <if test="inRoom!=null and inRoom=0">
  279. AND ersr.exam_room_id_ IS NULL
  280. </if>
  281. <if test="inRoom!=null and inRoom=1">
  282. AND ersr.exam_room_id_ IS NOT NULL
  283. </if>
  284. </where>
  285. </sql>
  286. <select id="queryExamRegist" resultMap="ExamRegistrationRoomDto" parameterType="map">
  287. SELECT
  288. er.id_,
  289. er.examination_basic_id_,
  290. er.exam_music_theory_level_,
  291. er.card_no_,
  292. er.student_id_,
  293. er.memo_,
  294. su.real_name_ sys_user_real_name_,
  295. su.phone_ sys_user_phone_,
  296. er.last_exam_certificate_url_,
  297. er.last_music_theory_certificate_url_,
  298. er.level_fee_,
  299. er.theory_level_fee_,
  300. er.song_json_,
  301. er.organ_id_,
  302. er.subject_id_,
  303. er.level_,
  304. erp.trans_amount_,
  305. er.status_,
  306. er.create_time_,
  307. ersr.exam_room_id_,
  308. ero.exam_start_time_,
  309. ero.exam_end_time_
  310. FROM
  311. exam_registration er
  312. LEFT JOIN sys_user su ON er.student_id_ = su.id_
  313. LEFT JOIN exam_registration_payment erp ON er.id_ = erp.exam_registration_id_
  314. LEFT JOIN exam_room_student_relation ersr ON ersr.exam_registration_id_ = er.id_
  315. LEFT JOIN exam_room ero ON ero.id_ = ersr.exam_room_id_
  316. <include refid="queryCondition"/>
  317. ORDER BY er.id_ DESC
  318. <include refid="global.limit"/>
  319. </select>
  320. <select id="countExamRegist" resultType="int">
  321. SELECT COUNT(*) FROM exam_registration er
  322. LEFT JOIN exam_room_student_relation ersr ON ersr.exam_registration_id_ = er.id_
  323. <include refid="queryCondition"/>
  324. </select>
  325. <select id="countWithoutExamRoomStudentNum" resultType="int">
  326. SELECT
  327. COUNT(ersr.id_)
  328. FROM
  329. exam_registration er
  330. LEFT JOIN exam_room_student_relation ersr ON ersr.student_id_ = er.student_id_
  331. WHERE 1=1
  332. <if test="organIds!=null">
  333. AND er.organ_id_ IN
  334. <foreach collection="organIds" item="organI" separator="," open="(" close=")">
  335. #{organI}
  336. </foreach>
  337. </if>
  338. AND er.examination_basic_id_ = #{examId}
  339. AND ersr.id_ IS NULL
  340. </select>
  341. <select id="countInExamRoomStudentNum" resultType="int">
  342. SELECT
  343. COUNT(ersr.id_)
  344. FROM
  345. exam_room_student_relation ersr
  346. LEFT JOIN exam_registration er ON ersr.exam_registration_id_ = er.id_
  347. WHERE 1=1
  348. <if test="organIds!=null">
  349. AND er.organ_id_ IN
  350. <foreach collection="organIds" item="organI" separator="," open="(" close=")">
  351. #{organI}
  352. </foreach>
  353. </if>
  354. AND ersr.examination_basic_id_ = #{examId}
  355. </select>
  356. <resultMap id="ExamRegistrationStatisticsDto" type="com.keao.edu.user.dto.ExamRegistrationStatisticsDto">
  357. <result property="totalRegistrationStudentNum" column="totalRegistrationStudentNum"/>
  358. <result property="childOrganRegistrationStudentNum" column="childOrganRegistrationStudentNum"/>
  359. <result property="waitAuditStudentNum" column="waitAuditStudentNum"/>
  360. <result property="refundedStudentNum" column="refundedStudentNum"/>
  361. </resultMap>
  362. <select id="getExamRegistrationStaticsInfo" resultMap="ExamRegistrationStatisticsDto">
  363. SELECT
  364. COUNT( er.student_id_ ) totalRegistrationStudentNum,
  365. SUM( CASE WHEN er.organ_id_ != #{selfOrganId} THEN 1 ELSE 0 END ) childOrganRegistrationStudentNum,
  366. SUM( CASE WHEN er.status_ = 'AUDIT_WAIT' THEN 1 ELSE 0 END ) waitAuditStudentNum,
  367. SUM( CASE WHEN er.status_ = 'REFUNDED' THEN 1 ELSE 0 END ) refundedStudentNum
  368. FROM
  369. exam_registration er
  370. WHERE
  371. er.examination_basic_id_ = #{examId}
  372. <if test="organIds!=null">
  373. AND er.organ_id_ IN
  374. <foreach collection="organIds" item="organId" separator="," open="(" close=")">
  375. #{organId}
  376. </foreach>
  377. </if>
  378. </select>
  379. <select id="countTotalRegistrationStudentNumWithExam" resultType="int">
  380. SELECT
  381. COUNT(er.id_)
  382. FROM
  383. exam_registration er
  384. WHERE 1=1
  385. <if test="organIds!=null">
  386. AND er.organ_id_ IN
  387. <foreach collection="organIds" item="organI" separator="," open="(" close=")">
  388. #{organI}
  389. </foreach>
  390. </if>
  391. AND er.examination_basic_id_ = #{examId}
  392. AND er.status_ != ''
  393. </select>
  394. <select id="getWithExamAndStudents" resultMap="ExamRegistration">
  395. SELECT * FROM exam_registration WHERE examination_basic_id_=#{examId} AND student_id_ IN
  396. <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
  397. #{studentId}
  398. </foreach>
  399. </select>
  400. <select id="getRegists" resultMap="ExamRegistration">
  401. SELECT * FROM exam_registration WHERE id_ IN
  402. <foreach collection="registIds" item="registId" separator="," open="(" close=")">
  403. #{registId}
  404. </foreach>
  405. </select>
  406. <resultMap id="ExamRegistrationDtoMap" type="com.keao.edu.user.dto.ExamRegistrationDto" extends="ExamRegistration">
  407. <result property="studentName" column="studentName"/>
  408. <result property="subjectName" column="subjectName"/>
  409. <result property="examBaseName" column="examBaseName"/>
  410. <result property="examStartTime" column="expect_exam_start_time_"/>
  411. <result property="examEndTime" column="expect_exam_end_time_"/>
  412. <result property="enrollEndTime" column="enroll_end_time_"/>
  413. <result property="enrollStartTime" column="enroll_start_time_"/>
  414. </resultMap>
  415. <select id="countStudentList" resultType="java.lang.Integer">
  416. SELECT COUNT(er.id_) FROM exam_registration er
  417. <include refid="queryStudentListSql"/>
  418. </select>
  419. <sql id="queryStudentListSql">
  420. <where>
  421. <if test="studentId != null">
  422. er.student_id_ = #{studentId}
  423. </if>
  424. <if test="examRegistrationId != null">
  425. er.id_ = #{examRegistrationId}
  426. </if>
  427. <if test="tenantId != null and tenantId != 0">
  428. er.tenant_id_ = #{tenantId}
  429. </if>
  430. <if test="status != null and status != ''">
  431. er.status_ = #{status}
  432. </if>
  433. </where>
  434. </sql>
  435. <select id="queryStudentList" resultMap="ExamRegistrationDtoMap">
  436. SELECT er.*,eb.enroll_end_time_,eb.enroll_start_time_,eb.expect_exam_end_time_,eb.expect_exam_start_time_,eb.name_ examBaseName
  437. FROM exam_registration er
  438. LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
  439. <include refid="queryStudentListSql"/>
  440. ORDER BY er.update_time_ DESC
  441. <include refid="global.limit"/>
  442. </select>
  443. <resultMap id="ExamRecordDtoMap" type="com.keao.edu.user.dto.ExamRecordDto" extends="ExamRegistration">
  444. <result property="subjectName" column="subjectName"/>
  445. <result property="examBaseName" column="examBaseName"/>
  446. <result property="examCertificationId" column="examCertificationId"/>
  447. <association property="studentExamResult" resultMap="com.keao.edu.user.dao.StudentExamResultDao.StudentExamResult"/>
  448. </resultMap>
  449. <select id="queryExamList" resultMap="ExamRecordDtoMap">
  450. SELECT er.*,ser.* FROM exam_registration er
  451. LEFT JOIN student_exam_result ser ON er.id_ = ser.exam_registration_id_
  452. WHERE ser.id_ IS NOT NULL AND er.student_id_ = #{studentId}
  453. </select>
  454. <select id="countExamList" resultType="java.lang.Integer">
  455. SELECT COUNT(er.id_) FROM exam_registration er
  456. LEFT JOIN student_exam_result ser ON er.id_ = ser.exam_registration_id_
  457. WHERE ser.id_ IS NOT NULL AND er.student_id_ = #{studentId}
  458. </select>
  459. <!-- 获取报名信息 -->
  460. <select id="getExamRegistration" resultMap="ExamRegistrationDtoMap">
  461. SELECT er.*,s.name_ subjectName,su.real_name_ studentName,eb.expect_exam_start_time_,eb.expect_exam_end_time_ FROM exam_registration er
  462. LEFT JOIN sys_user su ON su.id_ = er.student_id_
  463. LEFT JOIN examination_basic eb ON er.examination_basic_id_ = eb.id_
  464. LEFT JOIN subject s on er.subject_id_ = s.id_
  465. WHERE er.id_ = #{examRegistrationId}
  466. </select>
  467. <select id="getExamRegistrationInfo" resultMap="ExamRegistration">
  468. SELECT er.*, su.id_ sys_user_id_, su.real_name_ sys_user_real_name_,su.phone_ sys_user_phone_ , s.id_ subject_id_,
  469. s.name_ subject_name_ ,eb.name_ examination_basic_name_
  470. FROM exam_registration er
  471. LEFT JOIN examination_basic eb ON eb.id_=er.examination_basic_id_
  472. LEFT JOIN sys_user su ON er.student_id_ = su.id_
  473. LEFT JOIN subject s on er.subject_id_ = s.id_
  474. WHERE er.id_ = #{id}
  475. </select>
  476. <select id="getRegistration" resultMap="ExamRegistration">
  477. SELECT * FROM exam_registration
  478. <where>
  479. <if test="examId != null">
  480. AND examination_basic_id_ = #{examId}
  481. </if>
  482. <if test="studentId != null">
  483. AND student_id_ =#{studentId}
  484. </if>
  485. <if test="subjectId != null">
  486. AND subject_id_=#{subjectId}
  487. </if>
  488. <if test="level != null">
  489. AND level_ = #{level}
  490. </if>
  491. <if test="statusEnumList != null">
  492. AND status_ IN
  493. <foreach collection="statusEnumList" item="status" open="(" close=")" separator=",">
  494. #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
  495. </foreach>
  496. </if>
  497. </where>
  498. LIMIT 1
  499. </select>
  500. </mapper>