UserWithdrawMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. <mapper namespace="com.xc.dao.UserWithdrawMapper" >
  4. <resultMap id="BaseResultMap" type="com.xc.pojo.UserWithdraw" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="user_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  8. <arg column="nick_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  9. <arg column="agent_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  10. <arg column="with_amt" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  11. <arg column="apply_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  12. <arg column="trans_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  13. <arg column="with_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  14. <arg column="bank_no" jdbcType="VARCHAR" javaType="java.lang.String" />
  15. <arg column="bank_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  16. <arg column="bank_address" jdbcType="VARCHAR" javaType="java.lang.String" />
  17. <arg column="with_status" jdbcType="INTEGER" javaType="java.lang.Integer" />
  18. <arg column="with_fee" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  19. <arg column="with_msg" jdbcType="VARCHAR" javaType="java.lang.String" />
  20. <arg column="with_amt_rMB" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  21. <arg column="with_fee_rMB" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
  22. <arg column="agent_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  23. <arg column="phone" jdbcType="VARCHAR" javaType="java.lang.String" />
  24. <!-- <arg column="ordersn" jdbcType="VARCHAR" javaType="java.lang.String" />-->
  25. </constructor>
  26. </resultMap>
  27. <sql id="Base_Column_List" >
  28. id, user_id, nick_name, agent_id, with_amt, apply_time, trans_time, with_name, bank_no,
  29. bank_name, bank_address, with_status, with_fee, with_msg, with_amt_rMB, with_fee_rMB,agent_name ,phone
  30. </sql>
  31. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  32. select
  33. <include refid="Base_Column_List" />
  34. from user_withdraw
  35. where id = #{id,jdbcType=INTEGER}
  36. </select>
  37. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  38. delete from user_withdraw
  39. where id = #{id,jdbcType=INTEGER}
  40. </delete>
  41. <insert id="insert" parameterType="com.xc.pojo.UserWithdraw" >
  42. insert into user_withdraw (id, user_id, nick_name,
  43. agent_id, with_amt, apply_time,
  44. trans_time, with_name, bank_no,
  45. bank_name, bank_address, with_status,
  46. with_fee, with_msg, with_amt_rMB, with_fee_rMB ,agent_name, phone)
  47. values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
  48. #{agentId,jdbcType=INTEGER}, #{withAmt,jdbcType=DECIMAL}, #{applyTime,jdbcType=TIMESTAMP},
  49. #{transTime,jdbcType=TIMESTAMP}, #{withName,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR},
  50. #{bankName,jdbcType=VARCHAR}, #{bankAddress,jdbcType=VARCHAR}, #{withStatus,jdbcType=INTEGER},
  51. #{withFee,jdbcType=DECIMAL}, #{withMsg,jdbcType=VARCHAR}, #{withAmtRMB,jdbcType=DECIMAL}, #{withFeeRMB,jdbcType=DECIMAL},
  52. #{agentName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR})
  53. </insert>
  54. <insert id="insertSelective" parameterType="com.xc.pojo.UserWithdraw" >
  55. insert into user_withdraw
  56. <trim prefix="(" suffix=")" suffixOverrides="," >
  57. <if test="id != null" >
  58. id,
  59. </if>
  60. <if test="userId != null" >
  61. user_id,
  62. </if>
  63. <if test="nickName != null" >
  64. nick_name,
  65. </if>
  66. <if test="agentId != null" >
  67. agent_id,
  68. </if>
  69. <if test="withAmt != null" >
  70. with_amt,
  71. </if>
  72. <if test="applyTime != null" >
  73. apply_time,
  74. </if>
  75. <if test="transTime != null" >
  76. trans_time,
  77. </if>
  78. <if test="withName != null" >
  79. with_name,
  80. </if>
  81. <if test="bankNo != null" >
  82. bank_no,
  83. </if>
  84. <if test="bankName != null" >
  85. bank_name,
  86. </if>
  87. <if test="bankAddress != null" >
  88. bank_address,
  89. </if>
  90. <if test="withStatus != null" >
  91. with_status,
  92. </if>
  93. <if test="withFee != null" >
  94. with_fee,
  95. </if>
  96. <if test="withMsg != null" >
  97. with_msg,
  98. </if>
  99. <if test="withAmtRMB != null" >
  100. with_amt_rMB,
  101. </if>
  102. <if test="withFeeRMB != null" >
  103. with_fee_rMB,
  104. </if>
  105. </trim>
  106. <trim prefix="values (" suffix=")" suffixOverrides="," >
  107. <if test="id != null" >
  108. #{id,jdbcType=INTEGER},
  109. </if>
  110. <if test="userId != null" >
  111. #{userId,jdbcType=INTEGER},
  112. </if>
  113. <if test="nickName != null" >
  114. #{nickName,jdbcType=VARCHAR},
  115. </if>
  116. <if test="agentId != null" >
  117. #{agentId,jdbcType=INTEGER},
  118. </if>
  119. <if test="withAmt != null" >
  120. #{withAmt,jdbcType=DECIMAL},
  121. </if>
  122. <if test="applyTime != null" >
  123. #{applyTime,jdbcType=TIMESTAMP},
  124. </if>
  125. <if test="transTime != null" >
  126. #{transTime,jdbcType=TIMESTAMP},
  127. </if>
  128. <if test="withName != null" >
  129. #{withName,jdbcType=VARCHAR},
  130. </if>
  131. <if test="bankNo != null" >
  132. #{bankNo,jdbcType=VARCHAR},
  133. </if>
  134. <if test="bankName != null" >
  135. #{bankName,jdbcType=VARCHAR},
  136. </if>
  137. <if test="bankAddress != null" >
  138. #{bankAddress,jdbcType=VARCHAR},
  139. </if>
  140. <if test="withStatus != null" >
  141. #{withStatus,jdbcType=INTEGER},
  142. </if>
  143. <if test="withFee != null" >
  144. #{withFee,jdbcType=DECIMAL},
  145. </if>
  146. <if test="withMsg != null" >
  147. #{withMsg,jdbcType=VARCHAR},
  148. </if>
  149. <if test="withAmtRMB != null" >
  150. #{withAmtRMB,jdbcType=DECIMAL},
  151. </if>
  152. <if test="withFeeRMB != null" >
  153. #{withFeeRMB,jdbcType=DECIMAL},
  154. </if>
  155. </trim>
  156. </insert>
  157. <update id="updateByPrimaryKeySelective" parameterType="com.xc.pojo.UserWithdraw" >
  158. update user_withdraw
  159. <set >
  160. <if test="userId != null" >
  161. user_id = #{userId,jdbcType=INTEGER},
  162. </if>
  163. <if test="nickName != null" >
  164. nick_name = #{nickName,jdbcType=VARCHAR},
  165. </if>
  166. <if test="agentId != null" >
  167. agent_id = #{agentId,jdbcType=INTEGER},
  168. </if>
  169. <if test="withAmt != null" >
  170. with_amt = #{withAmt,jdbcType=DECIMAL},
  171. </if>
  172. <if test="applyTime != null" >
  173. apply_time = #{applyTime,jdbcType=TIMESTAMP},
  174. </if>
  175. <if test="transTime != null" >
  176. trans_time = #{transTime,jdbcType=TIMESTAMP},
  177. </if>
  178. <if test="withName != null" >
  179. with_name = #{withName,jdbcType=VARCHAR},
  180. </if>
  181. <if test="bankNo != null" >
  182. bank_no = #{bankNo,jdbcType=VARCHAR},
  183. </if>
  184. <if test="bankName != null" >
  185. bank_name = #{bankName,jdbcType=VARCHAR},
  186. </if>
  187. <if test="bankAddress != null" >
  188. bank_address = #{bankAddress,jdbcType=VARCHAR},
  189. </if>
  190. <if test="withStatus != null" >
  191. with_status = #{withStatus,jdbcType=INTEGER},
  192. </if>
  193. <if test="withFee != null" >
  194. with_fee = #{withFee,jdbcType=DECIMAL},
  195. </if>
  196. <if test="withMsg != null" >
  197. with_msg = #{withMsg,jdbcType=VARCHAR},
  198. </if>
  199. <if test="withAmtRMB != null" >
  200. with_amt_rMB = #{withAmtRMB,jdbcType=DECIMAL},
  201. </if>
  202. <if test="withFeeRMB != null" >
  203. with_fee_rMB = #{withFeeRMB,jdbcType=DECIMAL},
  204. </if>
  205. <if test="agentName != null" >
  206. agent_name = #{agentName,jdbcType=VARCHAR},
  207. </if>
  208. <if test="phone != null" >
  209. phone = #{phone,jdbcType=VARCHAR},
  210. </if>
  211. <!-- <if test="ordersn != null" >-->
  212. <!-- ordersn = #{ordersn,jdbcType=VARCHAR},-->
  213. <!-- </if>-->
  214. </set>
  215. where id = #{id,jdbcType=INTEGER}
  216. </update>
  217. <update id="updateByPrimaryKey" parameterType="com.xc.pojo.UserWithdraw" >
  218. update user_withdraw
  219. set user_id = #{userId,jdbcType=INTEGER},
  220. nick_name = #{nickName,jdbcType=VARCHAR},
  221. agent_id = #{agentId,jdbcType=INTEGER},
  222. with_amt = #{withAmt,jdbcType=DECIMAL},
  223. apply_time = #{applyTime,jdbcType=TIMESTAMP},
  224. trans_time = #{transTime,jdbcType=TIMESTAMP},
  225. with_name = #{withName,jdbcType=VARCHAR},
  226. bank_no = #{bankNo,jdbcType=VARCHAR},
  227. bank_name = #{bankName,jdbcType=VARCHAR},
  228. bank_address = #{bankAddress,jdbcType=VARCHAR},
  229. with_status = #{withStatus,jdbcType=INTEGER},
  230. with_fee = #{withFee,jdbcType=DECIMAL},
  231. with_msg = #{withMsg,jdbcType=VARCHAR},
  232. with_amt_rMB = #{withAmtRMB,jdbcType=DECIMAL},
  233. with_fee_rMB = #{withFeeRMB,jdbcType=DECIMAL}
  234. where id = #{id,jdbcType=INTEGER}
  235. </update>
  236. <select id="findUserWithList" parameterType="map" resultMap="BaseResultMap">
  237. SELECT
  238. <include refid="Base_Column_List"/>
  239. FROM user_withdraw
  240. <where>
  241. user_id = #{uid}
  242. <if test="withStatus != null and withStatus != '' ">
  243. and with_status = #{withStatus}
  244. </if>
  245. </where>
  246. order by id desc
  247. </select>
  248. <!-- <select id="selectByOrdersn" resultMap="BaseResultMap">-->
  249. <!-- select-->
  250. <!-- <include refid="Base_Column_List" />-->
  251. <!-- from user_withdraw-->
  252. <!-- where ordersn = #{ordersn,jdbcType=VARCHAR}-->
  253. <!-- </select>-->
  254. <select id="listByAgent" resultMap="BaseResultMap" parameterType="map">
  255. SELECT
  256. <include refid="Base_Column_List"/>
  257. FROM user_withdraw
  258. <where>
  259. agent_id = #{searchId}
  260. <if test="realName != null and realName != '' ">
  261. and nick_name like CONCAT('%','${realName}','%')
  262. </if>
  263. <if test="state != null">
  264. and with_status = #{state}
  265. </if>
  266. </where>
  267. ORDER BY id DESC
  268. </select>
  269. <select id="listByAdmin" resultMap="BaseResultMap" parameterType="map">
  270. SELECT
  271. <include refid="Base_Column_List"/>
  272. FROM user_withdraw
  273. <where>
  274. <if test="agentId != null">
  275. and agent_id = #{agentId}
  276. </if>
  277. <if test="userId != null">
  278. and user_id = #{userId}
  279. </if>
  280. <if test="realName != null and realName != '' ">
  281. and nick_name like CONCAT('%','${realName}','%')
  282. </if>
  283. <if test="state != null">
  284. and with_status = #{state}
  285. </if>
  286. <if test="beginTime != null and beginTime != '' ">
  287. and trans_time <![CDATA[>=]]> #{beginTime}
  288. </if>
  289. <if test="endTime != null and endTime != '' ">
  290. and trans_time <![CDATA[<=]]> #{endTime}
  291. </if>
  292. </where>
  293. ORDER BY id DESC
  294. </select>
  295. <select id="CountSpWithSumAmtByState" parameterType="integer" resultType="decimal">
  296. SELECT sum(with_amt) FROM user_withdraw WHERE with_status = #{withState}
  297. </select>
  298. <select id="CountSpWithSumRmbAmtByState" parameterType="integer" resultType="decimal">
  299. SELECT sum(with_amt_rMB) FROM user_withdraw WHERE with_status = #{withState}
  300. </select>
  301. <select id="CountSpWithSumAmtFeeRmbByState" parameterType="integer" resultType="decimal">
  302. SELECT sum(with_fee_rMB) FROM user_withdraw WHERE with_status = #{withState}
  303. </select>
  304. <delete id="deleteByUserId" parameterType="integer">
  305. DELETE FROM user_withdraw WHERE user_id = #{userId}
  306. </delete>
  307. </mapper>