ExamCertificationMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.ExamCertificationDao">
  8. <resultMap type="com.keao.edu.user.entity.ExamCertification" id="ExamCertification">
  9. <result column="id_" property="id" />
  10. <result column="examination_basic_id_" property="examinationBasicId" />
  11. <result column="exam_registration_id_" property="examRegistrationId" />
  12. <result column="student_id_" property="studentId" />
  13. <result column="card_no_" property="cardNo" />
  14. <result column="subject_id_" property="subjectId" />
  15. <result column="level_" property="level" />
  16. <result column="exam_start_time_" property="examStartTime" />
  17. <result column="exam_end_time_" property="examEndTime" />
  18. <result column="exam_address_" property="examAddress" />
  19. <result column="create_time_" property="createTime" />
  20. <result column="update_time_" property="updateTime" />
  21. <result column="tenant_id_" property="tenantId" />
  22. </resultMap>
  23. <!-- 根据主键查询一条记录 -->
  24. <select id="get" resultMap="ExamCertification" >
  25. SELECT * FROM exam_certification WHERE id_ = #{id}
  26. </select>
  27. <!-- 全查询 -->
  28. <select id="findAll" resultMap="ExamCertification">
  29. SELECT * FROM exam_certification ORDER BY id_
  30. </select>
  31. <!-- 向数据库增加一条记录 -->
  32. <insert id="insert" parameterType="com.keao.edu.user.entity.ExamCertification" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  33. INSERT INTO exam_certification (id_,examination_basic_id_,student_id_,card_no_,subject_id_,
  34. level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_,exam_registration_id_)
  35. VALUES(#{id},#{examinationBasicId},#{studentId},#{cardNo},#{subjectId},#{level},#{examStartTime},
  36. #{examEndTime},#{examAddress},NOW(),NOW(),#{tenantId},#{examRegistrationId})
  37. </insert>
  38. <insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamCertification" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  39. INSERT INTO exam_certification (examination_basic_id_,student_id_,card_no_,subject_id_,
  40. level_,exam_start_time_,exam_end_time_,exam_address_,create_time_,update_time_,tenant_id_,exam_registration_id_)
  41. VALUES
  42. <foreach collection="ecs" item="ec" separator=",">
  43. (#{ec.examinationBasicId},#{ec.studentId},#{ec.cardNo},#{ec.subjectId},#{ec.level},#{ec.examStartTime},
  44. #{ec.examEndTime},#{ec.examAddress},NOW(),NOW(),#{ec.tenantId},#{ec.examRegistrationId})
  45. </foreach>
  46. </insert>
  47. <!-- 根据主键查询一条记录 -->
  48. <update id="update" parameterType="com.keao.edu.user.entity.ExamCertification">
  49. UPDATE exam_certification
  50. <set>
  51. <if test="examinationBasicId != null">
  52. examination_basic_id_ = #{examinationBasicId},
  53. </if>
  54. <if test="examRegistrationId != null">
  55. exam_registration_id_ = #{examRegistrationId},
  56. </if>
  57. <if test="subjectId != null">
  58. subject_id_ = #{subjectId},
  59. </if>
  60. <if test="examEndTime != null">
  61. exam_end_time_ = #{examEndTime},
  62. </if>
  63. <if test="examStartTime != null">
  64. exam_start_time_ = #{examStartTime},
  65. </if>
  66. <if test="tenantId != null">
  67. tenant_id_ = #{tenantId},
  68. </if>
  69. <if test="cardNo != null">
  70. card_no_ = #{cardNo},
  71. </if>
  72. <if test="studentId != null">
  73. student_id_ = #{studentId},
  74. </if>
  75. <if test="level != null">
  76. level_ = #{level},
  77. </if>
  78. <if test="examAddress != null">
  79. exam_address_ = #{examAddress},
  80. </if>
  81. update_time_ = NOW()
  82. </set> WHERE id_ = #{id}
  83. </update>
  84. <!-- 根据主键删除一条记录 -->
  85. <delete id="delete" >
  86. DELETE FROM exam_certification WHERE id_ = #{id}
  87. </delete>
  88. <!-- 分页查询 -->
  89. <select id="queryPage" resultMap="ExamCertification" parameterType="map">
  90. SELECT * FROM exam_certification ORDER BY id_
  91. <include refid="global.limit"/>
  92. </select>
  93. <!-- 查询当前表的总记录数 -->
  94. <select id="queryCount" resultType="int">
  95. SELECT COUNT(*) FROM exam_certification
  96. </select>
  97. <select id="findByStuAndBasicId" resultMap="ExamCertification">
  98. SELECT * FROM exam_certification WHERE examination_basic_id_ = #{basicId} AND student_id_ = #{studentId} LIMIT 1
  99. </select>
  100. </mapper>