MusicGroupPaymentCalenderStudentDetailMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail" id="MusicGroupPaymentCalenderStudentDetail">
  9. <result column="id_" property="id" />
  10. <result column="user_id_" property="userId" />
  11. <result column="phone_" property="phone" />
  12. <result column="username_" property="username" />
  13. <result column="course_original_price_" property="courseOriginalPrice" />
  14. <result column="course_current_price_" property="courseCurrentPrice" />
  15. <result column="master_sub_course_price_" property="masterSubCoursePrice" />
  16. <result column="course_type_" property="courseType" />
  17. <result column="course_time_" property="courseTime" />
  18. <result column="class_group_id_" property="classGroupId" />
  19. <result column="batch_no_" property="batchNo" />
  20. <result column="create_time_" property="createTime" />
  21. <result column="update_time_" property="updateTime" />
  22. </resultMap>
  23. <!-- 根据主键查询一条记录 -->
  24. <select id="get" resultMap="MusicGroupPaymentCalenderStudentDetail" >
  25. SELECT * FROM music_group_payment_calender_student_detail WHERE id_ = #{id}
  26. </select>
  27. <!-- 全查询 -->
  28. <select id="findAll" resultMap="MusicGroupPaymentCalenderStudentDetail">
  29. SELECT * FROM music_group_payment_calender_student_detail ORDER BY id_
  30. </select>
  31. <!-- 向数据库增加一条记录 -->
  32. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  33. INSERT INTO music_group_payment_calender_student_detail (id_,user_id_,phone_,username_,course_original_price_,
  34. course_current_price_,course_type_,course_time_,class_group_id_,batch_no_,create_time_,update_time_,master_sub_course_price_)
  35. VALUES(#{id},#{userId},#{phone},#{username},#{courseOriginalPrice},#{courseCurrentPrice},
  36. #{courseType},#{courseTime},#{classGroupId},#{batchNo},NOW(),NOW(),#{masterSubCoursePrice})
  37. </insert>
  38. <!-- 根据主键查询一条记录 -->
  39. <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail">
  40. UPDATE music_group_payment_calender_student_detail <set>
  41. <if test="userId != null">
  42. user_id_ = #{userId},
  43. </if>
  44. <if test="masterSubCoursePrice != null">
  45. master_sub_course_price_ = #{masterSubCoursePrice},
  46. </if>
  47. <if test="classGroupId != null">
  48. class_group_id_ = #{classGroupId},
  49. </if>
  50. <if test="courseCurrentPrice != null">
  51. course_current_price_ = #{courseCurrentPrice},
  52. </if>
  53. <if test="courseType != null">
  54. course_type_ = #{courseType},
  55. </if>
  56. <if test="courseOriginalPrice != null">
  57. course_original_price_ = #{courseOriginalPrice},
  58. </if>
  59. <if test="batchNo != null">
  60. batch_no_ = #{batchNo},
  61. </if>
  62. <if test="phone != null">
  63. phone_ = #{phone},
  64. </if>
  65. <if test="courseTime != null">
  66. course_time_ = #{courseTime},
  67. </if>
  68. <if test="username != null">
  69. username_ = #{username},
  70. </if>
  71. update_time_ = NOW()
  72. </set> WHERE id_ = #{id}
  73. </update>
  74. <!-- 根据主键删除一条记录 -->
  75. <delete id="delete" >
  76. DELETE FROM music_group_payment_calender_student_detail WHERE id_ = #{id}
  77. </delete>
  78. <!-- 分页查询 -->
  79. <select id="queryPage" resultMap="MusicGroupPaymentCalenderStudentDetail" parameterType="map">
  80. SELECT * FROM music_group_payment_calender_student_detail ORDER BY id_ <include refid="global.limit"/>
  81. </select>
  82. <!-- 查询当前表的总记录数 -->
  83. <select id="queryCount" resultType="int">
  84. SELECT COUNT(*) FROM music_group_payment_calender_student_detail
  85. </select>
  86. <insert id="batchInsert">
  87. INSERT INTO music_group_payment_calender_student_detail (user_id_,phone_,username_,course_original_price_,
  88. course_current_price_,course_type_,course_time_,class_group_id_,batch_no_,create_time_,update_time_,master_sub_course_price_)
  89. VALUES
  90. <foreach collection="musicGroupPaymentCalenderStudentDetails" item="item" index="index" separator=",">
  91. (#{item.userId},#{item.phone},#{item.username},#{item.courseOriginalPrice},#{item.courseCurrentPrice},
  92. #{item.courseType},#{item.courseTime},#{item.classGroupId},#{batchNo},NOW(),NOW(),#{item.masterSubCoursePrice})
  93. </foreach>
  94. </insert>
  95. <update id="batchUpdate">
  96. <foreach collection="musicGroupPaymentCalenderStudentDetails" item="item" index="index" open="" close="" separator=";">
  97. UPDATE music_group_payment_calender_student_detail
  98. <set>
  99. <if test="item.courseCurrentPrice != null">
  100. course_current_price_ = #{item.courseCurrentPrice},
  101. </if>
  102. <if test="item.courseOriginalPrice != null">
  103. course_original_price_ = #{item.courseOriginalPrice},
  104. </if>
  105. update_time_ = NOW()
  106. </set>
  107. WHERE id_ = #{item.id}
  108. </foreach>
  109. </update>
  110. <update id="updateByCourseType">
  111. UPDATE music_group_payment_calender_student_detail
  112. SET course_current_price_ = #{courseCurrentPrice},update_time_ = NOW()
  113. WHERE course_type_ = #{courseType} AND batch_no_ = #{batchNo} AND user_id_ IN
  114. <foreach collection="studentIds" separator="," item="userId" open="(" close=")">
  115. #{userId}
  116. </foreach>
  117. </update>
  118. <select id="findByBatchNo" resultMap="MusicGroupPaymentCalenderStudentDetail">
  119. SELECT * FROM music_group_payment_calender_student_detail where batch_no_ = #{batchNo}
  120. </select>
  121. <select id="findByBatchNoAndUserId" resultMap="MusicGroupPaymentCalenderStudentDetail">
  122. SELECT * FROM music_group_payment_calender_student_detail where batch_no_ = #{batchNo} AND user_id_ = #{userId}
  123. </select>
  124. <delete id="delByBatchNo">
  125. DELETE FROM music_group_payment_calender_student_detail WHERE batch_no_ = #{batchNo}
  126. </delete>
  127. </mapper>