MusicGroupSubjectPlanMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.ym.mec.web.dal.dao.MusicGroupSubjectPlanDao">
  8. <resultMap type="com.ym.mec.web.dal.entity.MusicGroupSubjectPlan" id="MusicGroupSubjectPlan">
  9. <result column="id_" property="id"/>
  10. <result column="music_group_id_" property="musicGroupId"/>
  11. <result column="subject_id_" property="subjectId"/>
  12. <result column="expected_student_num_" property="expectedStudentNum"/>
  13. <result column="apply_student_num_" property="applyStudentNum"/>
  14. <result column="fee_" property="fee"/>
  15. <result column="kit_group_purchase_type_" property="kitGroupPurchaseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  16. <result column="deposit_fee_" property="depositFee"/>
  17. <result column="create_time_" property="createTime"/>
  18. <result column="update_time_" property="updateTime"/>
  19. </resultMap>
  20. <!-- 根据主键查询一条记录 -->
  21. <select id="get" resultMap="MusicGroupSubjectPlan">
  22. SELECT * FROM music_group_subject_plan WHERE id_ = #{id}
  23. </select>
  24. <!-- 全查询 -->
  25. <select id="findAll" resultMap="MusicGroupSubjectPlan">
  26. SELECT * FROM music_group_subject_plan ORDER BY id_
  27. </select>
  28. <!-- 向数据库增加一条记录 -->
  29. <insert id="insert" parameterType="com.ym.mec.web.dal.entity.MusicGroupSubjectPlan" useGeneratedKeys="true"
  30. keyColumn="id" keyProperty="id">
  31. <!--
  32. <selectKey resultClass="int" keyProperty="id" >
  33. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  34. </selectKey>
  35. -->
  36. INSERT INTO music_group_subject_plan
  37. (id_,music_group_id_,subject_id_,expected_student_num_,apply_student_num_,fee_,kit_group_purchase_type_,deposit_fee_,create_time_,update_time_)
  38. VALUES(#{id},#{musicGroupId},#{subjectId},#{expectedStudentNum},#{applyStudentNum},#{fee},#{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{depositFee},#{createTime},#{updateTime})
  39. </insert>
  40. <!-- 根据主键查询一条记录 -->
  41. <update id="update" parameterType="com.ym.mec.web.dal.entity.MusicGroupSubjectPlan">
  42. UPDATE music_group_subject_plan
  43. <set>
  44. <if test="subjectId != null">
  45. subject_id_ = #{subjectId},
  46. </if>
  47. <if test="applyStudentNum != null">
  48. apply_student_num_ = #{applyStudentNum},
  49. </if>
  50. <if test="fee != null">
  51. fee_ = #{fee},
  52. </if>
  53. <if test="kitGroupPurchaseType != null">
  54. kit_group_purchase_type_ = #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  55. </if>
  56. <if test="updateTime != null">
  57. update_time_ = #{updateTime},
  58. </if>
  59. <if test="depositFee != null">
  60. deposit_fee_ = #{depositFee},
  61. </if>
  62. <if test="expectedStudentNum != null">
  63. expected_student_num_ = #{expectedStudentNum},
  64. </if>
  65. <if test="musicGroupId != null">
  66. music_group_id_ = #{musicGroupId},
  67. </if>
  68. </set>
  69. WHERE id_ = #{id}
  70. </update>
  71. <!-- 根据主键删除一条记录 -->
  72. <delete id="delete">
  73. DELETE FROM music_group_subject_plan WHERE id_ = #{id}
  74. </delete>
  75. <!-- 分页查询 -->
  76. <select id="queryPage" resultMap="MusicGroupSubjectPlan" parameterType="map">
  77. SELECT * FROM music_group_subject_plan ORDER BY id_
  78. <include refid="global.limit"/>
  79. </select>
  80. <!-- 查询当前表的总记录数 -->
  81. <select id="queryCount" resultType="int">
  82. SELECT COUNT(*) FROM music_group_subject_plan
  83. </select>
  84. <resultMap type="com.ym.mec.web.dal.utilEntity.SubSetViewUtilEntity" id="findSubByGroupIdMap">
  85. <result column="plan_id_" property="planId" />
  86. <result column="sub_id_" property="subId" />
  87. <result column="sub_name_" property="subName" />
  88. <result column="expected_student_num_" property="expectedStudentNum" />
  89. </resultMap>
  90. <select id="findSubByGroupId" resultMap="findSubByGroupIdMap">
  91. SELECT mgsp.id_ plan_id_,mgsp.expected_student_num_,s.name_ sub_name_,s.id_ sub_id_
  92. FROM music_group_subject_plan mgsp
  93. LEFT JOIN `subject` s ON mgsp.subject_id_ = s.id_
  94. WHERE mgsp.music_group_id_ = #{musicGroupId}
  95. </select>
  96. </mapper>