ExamMusicTheoryMapper.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.ExamMusicTheoryDao">
  8. <resultMap type="com.keao.edu.user.entity.ExamMusicTheory" id="ExamMusicTheory">
  9. <result column="id_" property="id" />
  10. <result column="examination_basic_id_" property="examinationBasicId" />
  11. <result column="level_" property="level" />
  12. <result column="fee_" property="fee" />
  13. <result column="tenant_id_" property="tenantId" />
  14. <result column="create_time_" property="createTime" />
  15. <result column="update_time_" property="updateTime" />
  16. </resultMap>
  17. <!-- 根据主键查询一条记录 -->
  18. <select id="get" resultMap="ExamMusicTheory" >
  19. SELECT * FROM exam_music_theory WHERE id_ = #{id}
  20. </select>
  21. <!-- 全查询 -->
  22. <select id="findAll" resultMap="ExamMusicTheory">
  23. SELECT * FROM exam_music_theory ORDER BY id_
  24. </select>
  25. <!-- 向数据库增加一条记录 -->
  26. <insert id="insert" parameterType="com.keao.edu.user.entity.ExamMusicTheory" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  27. <!--
  28. <selectKey resultClass="int" keyProperty="id" >
  29. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  30. </selectKey>
  31. -->
  32. INSERT INTO exam_music_theory (id_,examination_basic_id_,level_,fee_,tenant_id_,create_time_,update_time_)
  33. VALUES(#{id},#{examinationBasicId},#{level},#{fee},#{tenantId},NOW(),NOW())
  34. </insert>
  35. <insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamMusicTheory" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  36. INSERT INTO exam_music_theory (examination_basic_id_,level_,fee_,tenant_id_,create_time_,update_time_)
  37. VALUES
  38. <foreach collection="emts" item="emt" separator=",">
  39. (#{emt.examinationBasicId},#{emt.level},#{emt.fee},#{emt.tenantId},NOW(),NOW())
  40. </foreach>
  41. </insert>
  42. <!-- 根据主键查询一条记录 -->
  43. <update id="update" parameterType="com.keao.edu.user.entity.ExamMusicTheory">
  44. UPDATE exam_music_theory
  45. <set>
  46. <if test="examinationBasicId != null">
  47. examination_basic_id_ = #{examinationBasicId},
  48. </if>
  49. <if test="fee != null">
  50. fee_ = #{fee},
  51. </if>
  52. <if test="tenantId != null and tenantId != 0">
  53. tenant_id_ = #{tenantId},
  54. </if>
  55. <if test="level != null">
  56. level_ = #{level},
  57. </if>
  58. update_time_ = NOW()
  59. </set> WHERE id_ = #{id}
  60. </update>
  61. <!-- 根据主键删除一条记录 -->
  62. <delete id="delete" >
  63. DELETE FROM exam_music_theory WHERE id_ = #{id}
  64. </delete>
  65. <sql id="queryCondition">
  66. <where>
  67. examination_basic_id_ = #{examId}
  68. </where>
  69. </sql>
  70. <!-- 分页查询 -->
  71. <select id="queryPage" resultMap="ExamMusicTheory" parameterType="map">
  72. SELECT * FROM exam_music_theory
  73. ORDER BY id_
  74. <include refid="global.limit"/>
  75. </select>
  76. <!-- 查询当前表的总记录数 -->
  77. <select id="queryCount" resultType="int">
  78. SELECT COUNT(*) FROM exam_music_theory
  79. </select>
  80. <!-- 获取项目的乐理级别列表 -->
  81. <select id="getTheoryLevelList" resultMap="ExamMusicTheory">
  82. SELECT * FROM exam_music_theory WHERE examination_basic_id_ = #{examinationBasicId} ORDER BY level_ ASC
  83. </select>
  84. </mapper>