MusicTheoryMapper.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.MusicTheoryDao">
  8. <resultMap type="com.keao.edu.user.entity.MusicTheory" id="MusicTheory">
  9. <result column="id_" property="id" />
  10. <result column="level_" property="level" />
  11. <result column="fee_" property="fee" />
  12. <result column="tenant_id_" property="tenantId" />
  13. <result column="create_time_" property="createTime" />
  14. <result column="update_time_" property="updateTime" />
  15. </resultMap>
  16. <!-- 根据主键查询一条记录 -->
  17. <select id="get" resultMap="MusicTheory" >
  18. SELECT * FROM music_theory WHERE id_ = #{id}
  19. </select>
  20. <!-- 全查询 -->
  21. <select id="findAll" resultMap="MusicTheory">
  22. SELECT * FROM music_theory ORDER BY id_
  23. </select>
  24. <!-- 向数据库增加一条记录 -->
  25. <insert id="insert" parameterType="com.keao.edu.user.entity.MusicTheory" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  26. INSERT INTO music_theory (id_,level_,fee_,tenant_id_,create_time_,update_time_)
  27. VALUES(#{id},#{level},#{fee},#{tenantId},NOW(),NOW())
  28. </insert>
  29. <!-- 根据主键查询一条记录 -->
  30. <update id="update" parameterType="com.keao.edu.user.entity.MusicTheory">
  31. UPDATE music_theory
  32. <set>
  33. <if test="id != null">
  34. id_ = #{id},
  35. </if>
  36. <if test="fee != null">
  37. fee_ = #{fee},
  38. </if>
  39. <if test="tenantId != null">
  40. tenant_id_ = #{tenantId},
  41. </if>
  42. <if test="level != null">
  43. level_ = #{level},
  44. </if>
  45. update_time_ = NOW()
  46. </set> WHERE id_ = #{id}
  47. </update>
  48. <!-- 根据主键删除一条记录 -->
  49. <delete id="delete" >
  50. DELETE FROM music_theory WHERE id_ = #{id}
  51. </delete>
  52. <!-- 分页查询 -->
  53. <select id="queryPage" resultMap="MusicTheory" parameterType="map">
  54. SELECT * FROM music_theory ORDER BY id_ <include refid="global.limit"/>
  55. </select>
  56. <!-- 查询当前表的总记录数 -->
  57. <select id="queryCount" resultType="int">
  58. SELECT COUNT(*) FROM music_theory
  59. </select>
  60. </mapper>