StudentWithdrawMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.StudentWithdrawDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.StudentWithdraw" id="StudentWithdraw">
  9. <result column="id_" property="id"/>
  10. <result column="user_id_" property="userId"/>
  11. <result column="bank_card_no_" property="bankCardNo"/>
  12. <result column="trans_no_" property="transNo"/>
  13. <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  14. <result column="amount_" property="amount"/>
  15. <result column="fee_user_" property="feeUser"/>
  16. <result column="fee_platform_" property="feePlatform"/>
  17. <result column="description_" property="description"/>
  18. <result column="comment_" property="comment"/>
  19. <result column="withdraw_no_" property="withdrawNo"/>
  20. <result column="create_time_" property="createTime"/>
  21. <result column="modify_time_" property="modifyTime"/>
  22. <result column="channel_" property="channel"/>
  23. <result column="platform_account_no_" property="platformAccountNo"/>
  24. <result column="balance_" property="balance"/>
  25. <result column="real_name_" property="realName"/>
  26. </resultMap>
  27. <!-- 根据主键查询一条记录 -->
  28. <select id="get" resultMap="StudentWithdraw">
  29. SELECT * FROM student_withdraw WHERE id_ = #{id}
  30. </select>
  31. <!-- 全查询 -->
  32. <select id="findAll" resultMap="StudentWithdraw">
  33. SELECT * FROM student_withdraw ORDER BY id_
  34. </select>
  35. <!-- 向数据库增加一条记录 -->
  36. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentWithdraw" useGeneratedKeys="true" keyColumn="id"
  37. keyProperty="id">
  38. INSERT INTO student_withdraw
  39. (id_,user_id_,bank_card_no_,trans_no_,status_,amount_,fee_user_,fee_platform_,description_,comment_,create_time_,modify_time_,withdraw_no_)
  40. VALUES(#{id},#{userId},#{bankCardNo},#{transNo},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  41. #{amount},#{feeUser},#{feePlatform},#{description},#{comment},now(),now(),#{withdrawNo})
  42. </insert>
  43. <!-- 根据主键查询一条记录 -->
  44. <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentWithdraw">
  45. UPDATE student_withdraw
  46. <set>
  47. <if test="status != null">
  48. status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  49. </if>
  50. <if test="userId != null">
  51. user_id_ = #{userId},
  52. </if>
  53. <if test="modifyTime != null">
  54. modify_time_ = #{modifyTime},
  55. </if>
  56. <if test="feePlatform != null">
  57. fee_platform_ = #{feePlatform},
  58. </if>
  59. <if test="comment != null">
  60. comment_ = #{comment},
  61. </if>
  62. <if test="amount != null">
  63. amount_ = #{amount},
  64. </if>
  65. <if test="feeUser != null">
  66. fee_user_ = #{feeUser},
  67. </if>
  68. <if test="bankCardNo != null">
  69. bank_card_no_ = #{bankCardNo},
  70. </if>
  71. <if test="description != null">
  72. description_ = #{description},
  73. </if>
  74. <if test="transNo != null">
  75. trans_no_ = #{transNo},
  76. </if>
  77. <if test="withdrawNo != null">
  78. withdraw_no_ = #{withdrawNo},
  79. </if>
  80. </set>
  81. WHERE id_ = #{id}
  82. </update>
  83. <!-- 根据主键删除一条记录 -->
  84. <delete id="delete">
  85. DELETE FROM student_withdraw WHERE id_ = #{id}
  86. </delete>
  87. <!-- 分页查询 -->
  88. <select id="queryPage" resultMap="StudentWithdraw" parameterType="map">
  89. SELECT sw.*,cad.platform_account_no_,cad.channel_,su.real_name_,cad.balance_
  90. FROM student_withdraw sw
  91. LEFT JOIN sys_user_cash_account_detail cad ON sw.id_ = cad.attribute1_
  92. LEFT JOIN sys_user su ON sw.id_ = cad.attribute1_
  93. <where>
  94. <if test="userId != null">
  95. and sw.user_id_ = #{userId}
  96. </if>
  97. <if test="bankCardNo != null">
  98. and sw.bank_card_no_ = #{bankCardNo}
  99. </if>
  100. </where>
  101. ORDER BY sw.create_time_ DESC
  102. <include refid="global.limit"/>
  103. </select>
  104. <!-- 查询当前表的总记录数 -->
  105. <select id="queryCount" resultType="int">
  106. SELECT COUNT(*) FROM student_withdraw
  107. <where>
  108. <if test="userId != null">
  109. and user_id_ = #{userId}
  110. </if>
  111. <if test="bankCardNo != null">
  112. and bank_card_no_ = #{bankCardNo}
  113. </if>
  114. </where>
  115. </select>
  116. <select id="getByUserId" resultMap="StudentWithdraw" parameterType="Long">
  117. SELECT * FROM student_withdraw
  118. <where>
  119. <if test="userId != null">
  120. user_id_ = #{userId}
  121. </if>
  122. </where>
  123. LIMIT 1
  124. </select>
  125. <select id="queryByUserId" resultType="com.ym.mec.biz.dal.entity.StudentWithdraw">
  126. SELECT * FROM student_withdraw
  127. <where>
  128. <if test="userId != null">
  129. FIND_IN_SET(user_id_,#{userIds})
  130. </if>
  131. </where>
  132. GROUP BY user_id_
  133. </select>
  134. </mapper>