后台服务
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

190 行
8.7 KiB

  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.iformall.mapper.WxBillOtherMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillOther">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/>
  9. <result column="pay" jdbcType="BIGINT" property="pay"/>
  10. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" />
  11. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  12. <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
  13. <result column="expired_day" jdbcType="INTEGER" property="expiredDay" />
  14. <result column="owe" jdbcType="BIGINT" property="owe"/>
  15. <result column="status" jdbcType="INTEGER" property="status" />
  16. <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
  17. <result column="apply_pay_img" jdbcType="INTEGER" property="applyPayImg"/>
  18. <result column="apply_update_time" jdbcType="INTEGER" property="applyUpdateTime"/>
  19. <result column="is_del" jdbcType="INTEGER" property="isDel" />
  20. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  21. <result column="user_id" jdbcType="BIGINT" property="userId" />
  22. <result column="shop_id" jdbcType="BIGINT" property="shopId" />
  23. <result column="shop_name" jdbcType="VARCHAR" property="shopName" />
  24. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
  25. <result column="name" jdbcType="VARCHAR" property="name" />
  26. <result column="comments" jdbcType="VARCHAR" property="comments" />
  27. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  28. <result column="pay_way" jdbcType="INTEGER" property="payWay"/>
  29. <result column="merchant_name" property="merchantName"/>
  30. <result column="starttime" property="starttime"/>
  31. <result column="endtime" property="endtime"/>
  32. <result column="freeze" property="freeze"/>
  33. <result column="service_charge_pay" property="serviceChargePay"/>
  34. </resultMap>
  35. <sql id="allColumns">
  36. `id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,
  37. `owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`name`,`comments`,
  38. `rent_shop_type`,`pay_way`,`starttime`,`endtime`,endtime,service_charge_pay,`apply_status`,`apply_pay_img`,`apply_update_time`
  39. </sql>
  40. <sql id="dynamicWhereConditions">
  41. where 1 = 1
  42. <if test=" null != id "> and `id` = #{id} </if>
  43. <if test=" null != tenantId and '' != tenantId">
  44. and `tenant_id` = #{tenantId}
  45. </if>
  46. <if test=" null != parentTenantId and '' != parentTenantId">
  47. and `parent_tenant_id` = #{parentTenantId}
  48. </if>
  49. <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
  50. <if test=" null != pay "> and `pay` = #{pay} </if>
  51. <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
  52. <if test=" null != payDate "> and `pay_date` = #{payDate} </if>
  53. <if test=" null != createtime "> and `createtime` = #{createtime} </if>
  54. <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
  55. <if test=" null != owe "> and `owe` = #{owe} </if>
  56. <if test=" null != status "> and `status` = #{status} </if>
  57. <if test=" null != applyStatus ">and `apply_status` = #{applyStatus}</if>
  58. <if test=" null != isDel "> and `is_del` = #{isDel} </if>
  59. <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
  60. <if test=" null != userId "> and `user_id` = #{userId} </if>
  61. <if test=" null != shopId "> and `shop_id` = #{shopId} </if>
  62. <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
  63. <if test=" null != name "> and `name` = #{name} </if>
  64. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  65. <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
  66. <if test=" null != ids ">
  67. and id in
  68. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  69. #{idItem}
  70. </foreach>
  71. </if>
  72. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  73. </sql>
  74. <select id="findList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap">
  75. select <include refid="allColumns" /> from wx_bill_other
  76. <include refid="dynamicWhereConditions" />
  77. </select>
  78. <select id="queryBillList" parameterType="com.iformall.domain.po.WxBillOther" resultMap="BaseResultMap">
  79. select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`, br.`pay_date`,br.`createtime`,br.`expired_day`,
  80. case when br.status=1 then br.owe else 0 end owe,br.`status`,m.`name`
  81. merchant_name,br.shop_name,br.`updatetime`,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,
  82. br.`merchant_id`,br.shop_id,br.name,br.comments,br.`rent_shop_type`,br.pay_way,
  83. br.`starttime`,br.`endtime`,br.freeze,br.service_charge_pay
  84. from wx_bill_other br left join wx_merchant m on br.merchant_id=m.id
  85. <where>
  86. <if test=" null != id ">and br.`id` = #{id}</if>
  87. <if test=" null != freeze ">and br.`freeze` = #{freeze}</if>
  88. <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
  89. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  90. <if test=" null != status ">and br.`status` = #{status}</if>
  91. <if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if>
  92. <if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
  93. <if test=" null != name and ''!=name">and br.`name` like concat('%',#{name},'%')</if>
  94. <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
  95. <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
  96. <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime}
  97. </if>
  98. </where>
  99. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  100. <if test=" null == sortColumns">order by id desc</if>
  101. </select>
  102. <update id="updateNotPaidStatus" parameterType="hashmap">
  103. update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
  104. where 1=1
  105. <if test=" null != tenantId and '' != tenantId">
  106. and `tenant_id` = #{tenantId}
  107. </if>
  108. <if test=" null != parentTenantId and '' != parentTenantId">
  109. and `parent_tenant_id` = #{parentTenantId}
  110. </if>
  111. and status!=#{paid} and DATEDIFF(now(),receive_date)>0
  112. </update>
  113. <update id="updateWaitPayStatus" parameterType="hashmap">
  114. update wx_bill_other set status=#{waitPay} where 1=1
  115. <if test=" null != tenantId and '' != tenantId">
  116. and `tenant_id` = #{tenantId}
  117. </if>
  118. <if test=" null != parentTenantId and '' != parentTenantId">
  119. and `parent_tenant_id` = #{parentTenantId}
  120. </if>
  121. and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
  122. </update>
  123. <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap">
  124. select round(sum(t.receivepay)/100,2) receivepay,round(sum(t.pay)/100,2) pay from
  125. (
  126. select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other
  127. where 1=1
  128. <if test=" null != tenantId and '' != tenantId">
  129. and `tenant_id` = #{tenantId}
  130. </if>
  131. <if test=" null != parentTenantId and '' != parentTenantId">
  132. and `parent_tenant_id` = #{parentTenantId}
  133. </if>
  134. and receive_date between #{startdate} and #{enddate}
  135. union
  136. select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_daily
  137. where 1=1
  138. <if test=" null != tenantId and '' != tenantId">
  139. and `tenant_id` = #{tenantId}
  140. </if>
  141. <if test=" null != parentTenantId and '' != parentTenantId">
  142. and `parent_tenant_id` = #{parentTenantId}
  143. </if>
  144. and receive_date between #{startdate} and #{enddate}
  145. ) t
  146. </select>
  147. <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap">
  148. select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from
  149. (
  150. select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily
  151. where status = 1
  152. <if test=" null != tenantId and '' != tenantId">
  153. and `tenant_id` = #{tenantId}
  154. </if>
  155. <if test=" null != parentTenantId and '' != parentTenantId">
  156. and `parent_tenant_id` = #{parentTenantId}
  157. </if>
  158. and receive_date between #{startdate} and #{enddate}
  159. union all
  160. select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily
  161. where status = 1
  162. <if test=" null != tenantId and '' != tenantId">
  163. and `tenant_id` = #{tenantId}
  164. </if>
  165. <if test=" null != parentTenantId and '' != parentTenantId">
  166. and `parent_tenant_id` = #{parentTenantId}
  167. </if>
  168. and receive_date between #{startdate} and #{enddate}
  169. ) res
  170. </select>
  171. </mapper>