CustomerCardRecordRechargeMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.yijia.customer.mapper.CustomerCardRecordRechargeMapper">
  6. <resultMap type="CustomerCardRecordRecharge" id="CustomerCardRecordRechargeResult">
  7. <result property="id" column="id" />
  8. <result property="orderNo" column="order_no" />
  9. <result property="unionId" column="union_id" />
  10. <result property="customerNo" column="customer_no" />
  11. <result property="customerName" column="customer_name" />
  12. <result property="usageType" column="usage_type" />
  13. <result property="payType" column="pay_type" />
  14. <result property="cardOilsType" column="card_oils_type" />
  15. <result property="amt" column="amt" />
  16. <result property="presentAmt" column="present_amt" />
  17. <result property="balance" column="balance" />
  18. <result property="createTime" column="create_time" />
  19. <result property="stationId" column="station_id" />
  20. <result property="stationName" column="station_name" />
  21. <result property="status" column="status" />
  22. </resultMap>
  23. <sql id="selectCustomerCardRecordRechargeVo">
  24. select id, order_no, union_id, customer_no, customer_name, usage_type, pay_type, card_oils_type, amt, present_amt, balance, create_time, station_id, station_name, status from customer_card_record_recharge
  25. </sql>
  26. <select id="selectCustomerCardRecordRechargeList" parameterType="CustomerCardRecordRecharge" resultMap="CustomerCardRecordRechargeResult">
  27. <include refid="selectCustomerCardRecordRechargeVo"/>
  28. <where>
  29. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  30. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  31. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  32. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  33. <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
  34. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  35. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  36. <if test="amt != null "> and amt = #{amt}</if>
  37. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  38. <if test="balance != null "> and balance = #{balance}</if>
  39. <if test="stationId != null "> and station_id = #{stationId}</if>
  40. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  41. <if test="status != null and status != ''"> and status = #{status}</if>
  42. <if test="stationIdList != null ">
  43. and station_id in
  44. <foreach item="item" index="index" collection="stationIdList"
  45. open="(" separator="," close=")">
  46. #{item}
  47. </foreach>
  48. </if>
  49. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  50. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  51. </if>
  52. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  53. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  54. </if>
  55. </where>
  56. order by id desc
  57. </select>
  58. <select id="selectCustomerCardRecordRechargeById" parameterType="Long" resultMap="CustomerCardRecordRechargeResult">
  59. <include refid="selectCustomerCardRecordRechargeVo"/>
  60. where id = #{id}
  61. </select>
  62. <insert id="insertCustomerCardRecordRecharge" parameterType="CustomerCardRecordRecharge" useGeneratedKeys="true" keyProperty="id">
  63. insert into customer_card_record_recharge
  64. <trim prefix="(" suffix=")" suffixOverrides=",">
  65. <if test="orderNo != null">order_no,</if>
  66. <if test="unionId != null">union_id,</if>
  67. <if test="customerNo != null">customer_no,</if>
  68. <if test="customerName != null">customer_name,</if>
  69. <if test="usageType != null">usage_type,</if>
  70. <if test="payType != null">pay_type,</if>
  71. <if test="cardOilsType != null">card_oils_type,</if>
  72. <if test="amt != null">amt,</if>
  73. <if test="presentAmt != null">present_amt,</if>
  74. <if test="balance != null">balance,</if>
  75. <if test="createTime != null">create_time,</if>
  76. <if test="stationId != null">station_id,</if>
  77. <if test="stationName != null">station_name,</if>
  78. <if test="status != null">status,</if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="orderNo != null">#{orderNo},</if>
  82. <if test="unionId != null">#{unionId},</if>
  83. <if test="customerNo != null">#{customerNo},</if>
  84. <if test="customerName != null">#{customerName},</if>
  85. <if test="usageType != null">#{usageType},</if>
  86. <if test="payType != null">#{payType},</if>
  87. <if test="cardOilsType != null">#{cardOilsType},</if>
  88. <if test="amt != null">#{amt},</if>
  89. <if test="presentAmt != null">#{presentAmt},</if>
  90. <if test="balance != null">#{balance},</if>
  91. <if test="createTime != null">#{createTime},</if>
  92. <if test="stationId != null">#{stationId},</if>
  93. <if test="stationName != null">#{stationName},</if>
  94. <if test="status != null">#{status},</if>
  95. </trim>
  96. </insert>
  97. <update id="updateCustomerCardRecordRecharge" parameterType="CustomerCardRecordRecharge">
  98. update customer_card_record_recharge
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="orderNo != null">order_no = #{orderNo},</if>
  101. <if test="unionId != null">union_id = #{unionId},</if>
  102. <if test="customerNo != null">customer_no = #{customerNo},</if>
  103. <if test="customerName != null">customer_name = #{customerName},</if>
  104. <if test="usageType != null">usage_type = #{usageType},</if>
  105. <if test="payType != null">pay_type = #{payType},</if>
  106. <if test="cardOilsType != null">card_oils_type = #{cardOilsType},</if>
  107. <if test="amt != null">amt = #{amt},</if>
  108. <if test="presentAmt != null">present_amt = #{presentAmt},</if>
  109. <if test="balance != null">balance = #{balance},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="stationId != null">station_id = #{stationId},</if>
  112. <if test="stationName != null">station_name = #{stationName},</if>
  113. <if test="status != null">status = #{status},</if>
  114. </trim>
  115. where id = #{id}
  116. </update>
  117. <delete id="deleteCustomerCardRecordRechargeById" parameterType="Long">
  118. delete from customer_card_record_recharge where id = #{id}
  119. </delete>
  120. <delete id="deleteCustomerCardRecordRechargeByIds" parameterType="String">
  121. delete from customer_card_record_recharge where id in
  122. <foreach item="id" collection="array" open="(" separator="," close=")">
  123. #{id}
  124. </foreach>
  125. </delete>
  126. <select id="czAmtQuery" parameterType="CustomerCardRecordRecharge" resultMap="CustomerCardRecordRechargeResult">
  127. SELECT sum(amt) as amt from customer_card_record_recharge
  128. <where>
  129. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  130. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  131. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  132. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  133. <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
  134. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  135. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  136. <if test="amt != null "> and amt = #{amt}</if>
  137. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  138. <if test="balance != null "> and balance = #{balance}</if>
  139. <if test="stationId != null "> and station_id = #{stationId}</if>
  140. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  141. <if test="status != null and status != ''"> and status = #{status}</if>
  142. <if test="stationIdList != null ">
  143. and station_id in
  144. <foreach item="item" index="index" collection="stationIdList"
  145. open="(" separator="," close=")">
  146. #{item}
  147. </foreach>
  148. </if>
  149. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  150. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  151. </if>
  152. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  153. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  154. </if>
  155. </where>
  156. </select>
  157. <select id="listQydataCZ" parameterType="CustomerCardRecordRecharge" resultMap="CustomerCardRecordRechargeResult">
  158. SELECT date_format(create_time,'%Y-%m-%d') as create_time,sum(amt) as amt
  159. from customer_card_record_recharge
  160. <where>
  161. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  162. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  163. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  164. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  165. <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
  166. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  167. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  168. <if test="amt != null "> and amt = #{amt}</if>
  169. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  170. <if test="balance != null "> and balance = #{balance}</if>
  171. <if test="stationId != null "> and station_id = #{stationId}</if>
  172. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  173. <if test="status != null and status != ''"> and status = #{status}</if>
  174. <if test="stationIdList != null ">
  175. and station_id in
  176. <foreach item="item" index="index" collection="stationIdList"
  177. open="(" separator="," close=")">
  178. #{item}
  179. </foreach>
  180. </if>
  181. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  182. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  183. </if>
  184. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  185. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  186. </if>
  187. </where>
  188. GROUP BY date_format(create_time,'%Y-%m-%d')
  189. </select>
  190. <select id="listCZData" parameterType="CustomerCardRecordRecharge" resultMap="CustomerCardRecordRechargeResult">
  191. SELECT sum(amt) as amt
  192. from customer_card_record_recharge
  193. <where>
  194. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  195. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  196. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  197. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  198. <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
  199. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  200. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  201. <if test="amt != null "> and amt = #{amt}</if>
  202. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  203. <if test="balance != null "> and balance = #{balance}</if>
  204. <if test="stationId != null "> and station_id = #{stationId}</if>
  205. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  206. <if test="status != null and status != ''"> and status = #{status}</if>
  207. <if test="stationIdList != null ">
  208. and station_id in
  209. <foreach item="item" index="index" collection="stationIdList"
  210. open="(" separator="," close=")">
  211. #{item}
  212. </foreach>
  213. </if>
  214. <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
  215. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
  216. </if>
  217. <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
  218. AND date_format(create_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')
  219. </if>
  220. </where>
  221. </select>
  222. <!--存储过程-->
  223. <select id="selectCardDetail" parameterType="CustomerCardRecordRecharge" statementType="CALLABLE" resultMap="CustomerCardRecordRechargeResult">
  224. CALL selectCardDetail(#{strSql,mode=IN},#{createDate,mode=IN},#{pageSetting,mode=IN},#{pageNo,mode=IN})
  225. </select>
  226. <select id="selectCardDetailPage" parameterType="CustomerCardRecordRecharge" statementType="CALLABLE" resultMap="CustomerCardRecordRechargeResult">
  227. CALL selectCardDetailPage(#{strSql,mode=IN},#{createDate,mode=IN})
  228. </select>
  229. </mapper>