MusicTheoryMapper.xml 2.9 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.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="create_time_" property="createTime" />
  13. <result column="update_time_" property="updateTime" />
  14. <result column="tenant_id_" property="tenantId" />
  15. </resultMap>
  16. <sql id="Base_Column_List">
  17. id_, level_, fee_, create_time_, update_time_, tenant_id_
  18. </sql>
  19. <!-- 根据主键查询一条记录 -->
  20. <select id="get" resultMap="MusicTheory" >
  21. SELECT <include refid="Base_Column_List"/> FROM music_theory WHERE id_ = #{id}
  22. </select>
  23. <!-- 全查询 -->
  24. <select id="findAll" resultMap="MusicTheory">
  25. SELECT <include refid="Base_Column_List"/> FROM music_theory WHERE tenant_id_ = #{tenantId} ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.keao.edu.user.entity.MusicTheory" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  29. INSERT INTO music_theory (id_,level_,fee_,create_time_,update_time_,tenant_id_)
  30. VALUES(#{id},#{level},#{fee},NOW(),NOW(),#{tenantId})
  31. </insert>
  32. <!-- 根据主键查询一条记录 -->
  33. <update id="update" parameterType="com.keao.edu.user.entity.MusicTheory">
  34. UPDATE music_theory
  35. <set>
  36. <if test="level != null">
  37. level_ = #{level},
  38. </if>
  39. <if test="id != null">
  40. id_ = #{id},
  41. </if>
  42. <if test="fee != null">
  43. fee_ = #{fee},
  44. </if>
  45. <if test="createTime != null">
  46. create_time_ = #{createTime},
  47. </if>
  48. <if test="tenantId">
  49. tenant_id_ = #{tenantId},
  50. </if>
  51. update_time_ = NOW()
  52. </set> WHERE id_ = #{id}
  53. </update>
  54. <!-- 根据主键删除一条记录 -->
  55. <delete id="delete" >
  56. DELETE FROM music_theory WHERE id_ = #{id}
  57. </delete>
  58. <sql id="queryCondition">
  59. <where>
  60. 1=1 AND tenant_id_ = #{tenantId}
  61. <!--<if test="subjectList!=null">-->
  62. <!--AND FIND_IN_SET(#{subjectList}, subject_list_)-->
  63. <!--</if>-->
  64. <!--<if test="search!=null">-->
  65. <!--AND (id_=#{search} OR song_name_ LIKE CONCAT('%', #{search}, '%'))-->
  66. <!--</if>-->
  67. </where>
  68. </sql>
  69. <!-- 分页查询 -->
  70. <select id="queryPage" resultMap="MusicTheory" parameterType="map">
  71. SELECT * FROM music_theory
  72. <include refid="queryCondition"/>
  73. ORDER BY id_
  74. <include refid="global.limit"/>
  75. </select>
  76. <!-- 查询当前表的总记录数 -->
  77. <select id="queryCount" resultType="int">
  78. SELECT COUNT(*) FROM music_theory
  79. <include refid="queryCondition"/>
  80. </select>
  81. <select id="getWithTenant" resultMap="MusicTheory">
  82. SELECT * FROM music_theory WHERE tenant_id_=#{tenantId}
  83. </select>
  84. </mapper>