placeWithDrawalsLogsMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. namespace:必须与对应的接口全类名一致
  5. -->
  6. <mapper namespace="com.iamberry.wechat.service.mapper.PlaceWithDrawalsLogsMapper">
  7. <sql id="allField" >
  8. w.PLACE_WITHDRAWALS_ID id,
  9. w.PLACE_OPENID openid,
  10. w.PLACE_WITHDRAWALS_PLACE_ID placeId,
  11. w.PLACE_WITHDRAWALS_NUM withDrawalsNum,
  12. w.PLACE_WITHDRAWALS_NAME withDrawalsName,
  13. w.PLACE_LOGS_TEL tel,
  14. w.PLACE_LOGS_CREATE_DATE createDate,
  15. w.PLACE_ACCOUNT_NO accountNo,
  16. w.PLACE_BANK_LOCAL bankLocal,
  17. w.PLACE_STATUS status
  18. </sql>
  19. <select id="getOneWithDrawalsLogs" parameterType="integer" resultType="PlaceWithDrawalsLogs">
  20. SELECT
  21. <include refid="allField"/>
  22. FROM tb_iamberry_place_withdrawals_logs w WHERE w.PLACE_WITHDRAWALS_ID = #{id}
  23. </select>
  24. <select id="selectAll" resultType="PlaceWithDrawalsLogs" parameterType="PlaceWithDrawalsLogs">
  25. select
  26. <include refid="allField"/>
  27. from tb_iamberry_place_withdrawals_logs w
  28. <where>
  29. <if test="openid!=null and openid!=''" >
  30. w.PLACE_OPENID=#{openid}
  31. </if>
  32. <if test="placeId!=null and placeId!=''" >
  33. and w.PLACE_WITHDRAWALS_PLACE=#{placeId}
  34. </if>
  35. <if test="tel!=null and tel!=''" >
  36. and w.PLACE_LOGS_TELR=#{tel}
  37. </if>
  38. </where>
  39. order by w.PLACE_LOGS_CREATE_DATE DESC
  40. <if test="page!=null and page.recordBegin>0 and page.pageSize>0 ">
  41. limit ${page.recordBegin},${page.pageSize}
  42. </if>
  43. <if test="page!=null and page.recordBegin==0 and page.pageSize>0 ">
  44. limit ${page.pageSize}
  45. </if>
  46. </select>
  47. <select id="selectAllMore" resultType="PlaceWithDrawalsLogs" parameterType="PlaceWithDrawalsLogs">
  48. select
  49. <include refid="allField"/>,
  50. (select role_name from tb_iamberry_place_role where role_id=p.place_role_id ) roleName,
  51. p.place_name name
  52. from tb_iamberry_place_withdrawals_logs w
  53. left join tb_iamberry_place_info p
  54. on p.place_id=w.place_withdrawals_place_id
  55. <where>
  56. <if test="openid!=null and openid!=''" >
  57. w.PLACE_OPENID=#{openid}
  58. </if>
  59. <if test="placeId!=null and placeId!=''" >
  60. and w.PLACE_WITHDRAWALS_PLACE_id=#{placeId}
  61. </if>
  62. <if test="tel!=null and tel!=''" >
  63. and w.PLACE_LOGS_TELR=#{tel}
  64. </if>
  65. <if test="status!=null and status!=''" >
  66. and w.PLACE_STATUS=${status}
  67. </if>
  68. <if test="name!=null and name!=''" >
  69. and p.place_name like CONCAT('%',#{name},'%')
  70. </if>
  71. <if test="beginDate!=null and beginDate!=''">
  72. and w.place_logs_create_date &gt; #{beginDate}
  73. </if>
  74. <if test="endDate!=null and endDate!=''">
  75. and w.place_logs_create_date &lt; #{endDate}
  76. </if>
  77. </where>
  78. order by PLACE_LOGS_CREATE_DATE DESC
  79. <if test="page!=null and page.recordBegin>0 and page.pageSize>0 ">
  80. limit ${page.recordBegin},${page.pageSize}
  81. </if>
  82. <if test="page!=null and page.recordBegin==0 and page.pageSize>0 ">
  83. limit ${page.pageSize}
  84. </if>
  85. </select>
  86. <select id="getAllCount" resultType="integer">
  87. select count(PLACE_WITHDRAWALS_ID) from tb_iamberry_place_withdrawals_logs
  88. <where>
  89. <if test="openid!=null and openid!=''" >
  90. PLACE_OPENID=#{openid}
  91. </if>
  92. <if test="placeId!=null and placeId!=''" >
  93. and PLACE_WITHDRAWALS_PLACE_ID=#{placeId}
  94. </if>
  95. <if test="tel!=null and tel!=''" >
  96. and PLACE_LOGS_TEL=#{tel}
  97. </if>
  98. <if test="status!=null and status!=''" >
  99. and PLACE_STATUS=${status}
  100. </if>
  101. </where>
  102. </select>
  103. <select id="getAllCountMore" resultType="integer">
  104. select count(PLACE_WITHDRAWALS_ID) from tb_iamberry_place_withdrawals_logs w
  105. left join tb_iamberry_place_info p
  106. on p.place_id=w.place_withdrawals_place_id
  107. <where>
  108. <if test="openid!=null and openid!=''" >
  109. and w.PLACE_OPENID=#{openid}
  110. </if>
  111. <if test="placeId!=null and placeId!=''" >
  112. and w.PLACE_WITHDRAWALS_PLACE_ID=#{placeId}
  113. </if>
  114. <if test="tel!=null and tel!=''" >
  115. and w.PLACE_LOGS_TEL=#{tel}
  116. </if>
  117. <if test="status!=null and status!=''" >
  118. and w.PLACE_STATUS=${status}
  119. </if>
  120. <if test="name!=null and name!=''" >
  121. and p.place_name like CONCAT('%',#{name},'%')
  122. </if>
  123. <if test="beginDate!=null and beginDate!=''">
  124. and w.place_logs_create_date &gt; #{beginDate}
  125. </if>
  126. <if test="endDate!=null and endDate!=''">
  127. and w.place_logs_create_date &lt; #{endDate}
  128. </if>
  129. </where>
  130. </select>
  131. <select id="getApplyCount" resultType="integer">
  132. select count(PLACE_WITHDRAWALS_ID) from tb_iamberry_place_withdrawals_logs
  133. where DATE_FORMAT(place_logs_create_date,'%Y%m')=#{dateMonth}
  134. and place_openid=#{id}
  135. and place_status in(1,2)
  136. </select>
  137. <insert id="insert">
  138. insert into
  139. tb_iamberry_place_withdrawals_logs(
  140. PLACE_OPENID ,
  141. PLACE_WITHDRAWALS_PLACE_ID ,
  142. PLACE_WITHDRAWALS_NUM ,
  143. PLACE_WITHDRAWALS_NAME ,
  144. PLACE_LOGS_TEL ,
  145. PLACE_LOGS_CREATE_DATE ,
  146. PLACE_ACCOUNT_NO ,
  147. PLACE_BANK_LOCAL ,
  148. REMARK ,
  149. PLACE_STATUS
  150. )
  151. values(
  152. #{openid},
  153. #{placeId},
  154. #{withDrawalsNum},
  155. #{withDrawalsName},
  156. #{tel},
  157. #{createDate},
  158. #{accountNo},
  159. #{bankLocal},
  160. #{remark},
  161. #{status}
  162. )
  163. </insert>
  164. <update id="update" >
  165. update tb_iamberry_place_withdrawals_logs
  166. <set>
  167. <if test="status>0">
  168. PLACE_STATUS =#{status},
  169. </if>
  170. <if test="remark!=null and remark!=''">
  171. REMARK =#{remark}
  172. </if>
  173. </set>
  174. WHERE place_withdrawals_id = ${id}
  175. </update>
  176. <delete id="delete" parameterType="integer">
  177. delete from tb_iamberry_place_withdrawals_logs
  178. WHERE place_withdrawals_id = #{id}
  179. </delete>
  180. <select id="getTotalMoneyByPlaceId" parameterType="Integer" resultType="Integer">
  181. select sum(PLACE_WITHDRAWALS_NUM) toTalMoney from tb_iamberry_place_withdrawals_logs
  182. where PLACE_WITHDRAWALS_PLACE_ID = #{id} and PLACE_STATUS =2
  183. </select>
  184. <select id="selectAllMoney" parameterType="PlaceWithDrawalsLogs" resultType="Integer">
  185. SELECT
  186. IFNULL(sum(PLACE_WITHDRAWALS_NUM),0) toTalMoney
  187. FROM
  188. tb_iamberry_place_withdrawals_logs
  189. WHERE
  190. PLACE_WITHDRAWALS_PLACE_ID = #{placeId}
  191. and PLACE_STATUS = #{status}
  192. </select>
  193. </mapper>