StudentPaymentOrderDetailMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.StudentPaymentOrderDetailDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail" id="StudentPaymentOrderDetail">
  9. <result column="id_" property="id"/>
  10. <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  11. <result column="goods_id_list_" property="goodsIdList"/>
  12. <result column="price_" property="price"/>
  13. <result column="create_time_" property="createTime"/>
  14. <result column="update_time_" property="updateTime"/>
  15. <result column="payment_order_id_" property="paymentOrderId"/>
  16. </resultMap>
  17. <!-- 根据主键查询一条记录 -->
  18. <select id="get" resultMap="StudentPaymentOrderDetail">
  19. SELECT * FROM student_payment_order_detail WHERE id_ = #{id}
  20. </select>
  21. <!-- 全查询 -->
  22. <select id="findAll" resultMap="StudentPaymentOrderDetail">
  23. SELECT *
  24. FROM student_payment_order_detail
  25. ORDER BY id_
  26. </select>
  27. <!-- 向数据库增加一条记录 -->
  28. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail" useGeneratedKeys="true"
  29. keyColumn="id" keyProperty="id">
  30. <!--
  31. <selectKey resultClass="int" keyProperty="id" >
  32. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  33. </selectKey>
  34. -->
  35. INSERT INTO student_payment_order_detail
  36. (id_,type_,goods_id_list_,price_,create_time_,update_time_,payment_order_id_)
  37. VALUES(#{id},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goodsIdList},#{price},now(),now(),#{paymentOrderId})
  38. </insert>
  39. <!-- 根据主键查询一条记录 -->
  40. <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail">
  41. UPDATE student_payment_order_detail
  42. <set>
  43. <if test="price != null">
  44. price_ = #{price},
  45. </if>
  46. <if test="goodsIdList != null">
  47. goods_id_list_ = #{goodsIdList},
  48. </if>
  49. <if test="updateTime != null">
  50. update_time_ = NOW(),
  51. </if>
  52. <if test="paymentOrderId != null">
  53. payment_order_id_ = #{paymentOrderId},
  54. </if>
  55. <if test="type != null">
  56. type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  57. </if>
  58. </set>
  59. WHERE id_ = #{id}
  60. </update>
  61. <!-- 根据主键删除一条记录 -->
  62. <delete id="delete">
  63. DELETE FROM student_payment_order_detail WHERE id_ = #{id}
  64. </delete>
  65. <!-- 分页查询 -->
  66. <select id="queryPage" resultMap="StudentPaymentOrderDetail" parameterType="map">
  67. SELECT * FROM student_payment_order_detail ORDER BY id_
  68. <include refid="global.limit"/>
  69. </select>
  70. <!-- 查询当前表的总记录数 -->
  71. <select id="queryCount" resultType="int">
  72. SELECT COUNT(*)
  73. FROM student_payment_order_detail
  74. </select>
  75. <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
  76. INSERT INTO student_payment_order_detail
  77. (id_,type_,goods_id_list_,price_,create_time_,update_time_,payment_order_id_)
  78. VALUES
  79. <foreach collection="studentPaymentOrderDetailList" item="orderDetail" separator=",">
  80. (#{orderDetail.id},#{orderDetail.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{orderDetail.goodsIdList},#{orderDetail.price},now(),now(),#{orderDetail.paymentOrderId})
  81. </foreach>
  82. </insert>
  83. <!-- 查询注册订单详情 -->
  84. <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
  85. SELECT spod.* FROM student_payment_order spo
  86. LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
  87. WHERE spo.music_group_id_ = #{musicGroupId}
  88. AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  89. AND spo.type_ = 'APPLY'
  90. </select>
  91. <!-- 查询订单详情 -->
  92. <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
  93. SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
  94. </select>
  95. <!-- 查询用户注册订单详情 -->
  96. <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
  97. SELECT spod.* FROM student_payment_order spo
  98. LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
  99. WHERE spo.user_id_ = #{userId}
  100. AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  101. AND spo.type_ = 'APPLY'
  102. </select>
  103. </mapper>