TElExamRepoMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.training.elearn.mapper.TElExamRepoMapper">
  6. <resultMap type="TElExamRepo" id="TElExamRepoResult">
  7. <result property="id" column="id" />
  8. <result property="examId" column="exam_id" />
  9. <result property="repoId" column="repo_id" />
  10. <result property="radioCount" column="radio_count" />
  11. <result property="radioScore" column="radio_score" />
  12. <result property="multiCount" column="multi_count" />
  13. <result property="multiScore" column="multi_score" />
  14. <result property="judgeCount" column="judge_count" />
  15. <result property="judgeScore" column="judge_score" />
  16. <result property="saqCount" column="saq_count" />
  17. <result property="saqScore" column="saq_score" />
  18. </resultMap>
  19. <sql id="selectTElExamRepoVo">
  20. select d.id, d.exam_id, d.repo_id, d.radio_count, d.radio_score, d.multi_count, d.multi_score, d.judge_count, d.judge_score, d.saq_count, d.saq_score
  21. ,(SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=1) AS totalRadio,
  22. (SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=2) AS totalMulti,
  23. (SELECT COUNT(0) FROM t_el_qu_repo WHERE repo_id=d.repo_id AND qu_type=3) AS totalJudge
  24. from t_el_exam_repo d
  25. </sql>
  26. <select id="selectTElExamRepoList" parameterType="TElExamRepo" resultMap="TElExamRepoResult">
  27. <include refid="selectTElExamRepoVo"/>
  28. <where>
  29. <if test="examId != null "> and exam_id = #{examId}</if>
  30. <if test="repoId != null "> and repo_id = #{repoId}</if>
  31. <if test="radioCount != null "> and radio_count = #{radioCount}</if>
  32. <if test="radioScore != null "> and radio_score = #{radioScore}</if>
  33. <if test="multiCount != null "> and multi_count = #{multiCount}</if>
  34. <if test="multiScore != null "> and multi_score = #{multiScore}</if>
  35. <if test="judgeCount != null "> and judge_count = #{judgeCount}</if>
  36. <if test="judgeScore != null "> and judge_score = #{judgeScore}</if>
  37. <if test="saqCount != null "> and saq_count = #{saqCount}</if>
  38. <if test="saqScore != null "> and saq_score = #{saqScore}</if>
  39. </where>
  40. <!-- 数据范围过滤 -->
  41. </select>
  42. <select id="selectTElExamRepoById" parameterType="Long" resultMap="TElExamRepoResult">
  43. <include refid="selectTElExamRepoVo"/>
  44. where id = #{id}
  45. </select>
  46. <insert id="insertTElExamRepo" parameterType="TElExamRepo">
  47. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  48. SELECT seq_t_el_exam_repo.NEXTVAL as id FROM DUAL
  49. </selectKey>
  50. insert into t_el_exam_repo
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="id != null">id,</if>
  53. <if test="examId != null">exam_id,</if>
  54. <if test="repoId != null">repo_id,</if>
  55. <if test="radioCount != null">radio_count,</if>
  56. <if test="radioScore != null">radio_score,</if>
  57. <if test="multiCount != null">multi_count,</if>
  58. <if test="multiScore != null">multi_score,</if>
  59. <if test="judgeCount != null">judge_count,</if>
  60. <if test="judgeScore != null">judge_score,</if>
  61. <if test="saqCount != null">saq_count,</if>
  62. <if test="saqScore != null">saq_score,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="id != null">#{id},</if>
  66. <if test="examId != null">#{examId},</if>
  67. <if test="repoId != null">#{repoId},</if>
  68. <if test="radioCount != null">#{radioCount},</if>
  69. <if test="radioScore != null">#{radioScore},</if>
  70. <if test="multiCount != null">#{multiCount},</if>
  71. <if test="multiScore != null">#{multiScore},</if>
  72. <if test="judgeCount != null">#{judgeCount},</if>
  73. <if test="judgeScore != null">#{judgeScore},</if>
  74. <if test="saqCount != null">#{saqCount},</if>
  75. <if test="saqScore != null">#{saqScore},</if>
  76. </trim>
  77. </insert>
  78. <update id="updateTElExamRepo" parameterType="TElExamRepo">
  79. update t_el_exam_repo
  80. <trim prefix="SET" suffixOverrides=",">
  81. <if test="examId != null">exam_id = #{examId},</if>
  82. <if test="repoId != null">repo_id = #{repoId},</if>
  83. <if test="radioCount != null">radio_count = #{radioCount},</if>
  84. <if test="radioScore != null">radio_score = #{radioScore},</if>
  85. <if test="multiCount != null">multi_count = #{multiCount},</if>
  86. <if test="multiScore != null">multi_score = #{multiScore},</if>
  87. <if test="judgeCount != null">judge_count = #{judgeCount},</if>
  88. <if test="judgeScore != null">judge_score = #{judgeScore},</if>
  89. <if test="saqCount != null">saq_count = #{saqCount},</if>
  90. <if test="saqScore != null">saq_score = #{saqScore},</if>
  91. </trim>
  92. where id = #{id}
  93. </update>
  94. <delete id="deleteTElExamRepoById" parameterType="Long">
  95. delete from t_el_exam_repo where id = #{id}
  96. </delete>
  97. <delete id="deleteTElExamRepoByExamId" parameterType="Long">
  98. delete from t_el_exam_repo where exam_id = #{examId}
  99. </delete>
  100. <delete id="deleteTElExamRepoByIds" parameterType="String">
  101. delete from t_el_exam_repo where id in
  102. <foreach item="id" collection="array" open="(" separator="," close=")">
  103. #{id}
  104. </foreach>
  105. </delete>
  106. </mapper>