You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

119 lines
6.0 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.WxBillDailyMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillDaily">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="receive_pay" jdbcType="BIGINT" property="receivePay"/>
  7. <result column="pay" jdbcType="BIGINT" property="pay"/>
  8. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" />
  9. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  10. <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
  11. <result column="expired_day" jdbcType="INTEGER" property="expiredDay" />
  12. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  13. <result column="owe" jdbcType="BIGINT" property="owe"/>
  14. <result column="status" jdbcType="INTEGER" property="status" />
  15. <result column="is_del" jdbcType="INTEGER" property="isDel" />
  16. <result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
  17. <result column="user_id" jdbcType="BIGINT" property="userId" />
  18. <result column="shop_id" jdbcType="BIGINT" property="shopId" />
  19. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
  20. <result column="type" jdbcType="INTEGER" property="type" />
  21. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  22. <result column="pay_way" jdbcType="INTEGER" property="payWay"/>
  23. <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/>
  24. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  25. <result column="starttime" property="starttime"/>
  26. <result column="endtime" property="endtime"/>
  27. <result column="freeze" property="freeze"/>
  28. <result column="build_way" property="buildWay"/>
  29. <result column="service_charge_pay" property="serviceChargePay"/>
  30. </resultMap>
  31. <sql id="allColumns">
  32. `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,
  33. `tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`,
  34. `rent_shop_type`,`pay_way`,`price_detail`,`starttime`,`endtime`,freeze,build_way,service_charge_pay
  35. </sql>
  36. <sql id="dynamicWhereConditions">
  37. where 1 = 1
  38. <if test=" null != id "> and `id` = #{id} </if>
  39. <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
  40. <if test=" null != pay "> and `pay` = #{pay} </if>
  41. <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
  42. <if test=" null != payDate "> and `pay_date` = #{payDate} </if>
  43. <if test=" null != createtime "> and `createtime` = #{createtime} </if>
  44. <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
  45. <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
  46. <if test=" null != owe "> and `owe` = #{owe} </if>
  47. <if test=" null != status "> and `status` = #{status} </if>
  48. <if test=" null != isDel "> and `is_del` = #{isDel} </if>
  49. <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
  50. <if test=" null != userId "> and `user_id` = #{userId} </if>
  51. <if test=" null != shopId "> and `shop_id` = #{shopId} </if>
  52. <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
  53. <if test=" null != type "> and `type` = #{type} </if>
  54. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  55. <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
  56. <if test=" null != buildWay ">and `build_way` = #{buildWay}</if>
  57. <if test=" null != ids ">
  58. and id in
  59. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  60. #{idItem}
  61. </foreach>
  62. </if>
  63. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  64. </sql>
  65. <select id="findList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="BaseResultMap">
  66. select <include refid="allColumns" /> from wx_bill_daily
  67. <include refid="dynamicWhereConditions" />
  68. </select>
  69. <select id="queryBillDailyList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="BaseResultMap">
  70. select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day` ,
  71. case when br.status=1 then br.owe else 0 end owe,br.`status`,m.`name` merchant_name,s.shop_number,
  72. br.`updatetime`,br.`merchant_id`,br.shop_id,br.type,br.`rent_shop_type`,br.pay_way,br.price_detail,
  73. br.`starttime`,br.`endtime`,br.`build_way`,br.freeze,br.service_charge_pay
  74. from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id
  75. left join wx_shop s on br.shop_id=s.id
  76. <where>
  77. <if test=" null != freeze ">and br.`freeze` = #{freeze}</if>
  78. <if test=" null != id ">and br.`id` = #{id}</if>
  79. <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
  80. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  81. <if test=" null != status ">and br.`status` = #{status}</if>
  82. <if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
  83. <if test=" null != type ">and br.`type` = #{type}</if>
  84. <if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
  85. <if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
  86. <if test=" null != starttime and null!=endtime ">and br.`receive_date` between #{starttime} and #{endtime}
  87. </if>
  88. <if test=" null != buildWay ">and br.`build_way` = #{buildWay}</if>
  89. </where>
  90. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  91. <if test=" null == sortColumns">order by id desc</if>
  92. </select>
  93. <update id="updateNotPaidStatus" parameterType="hashmap">
  94. update wx_bill_daily set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
  95. where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0
  96. </update>
  97. <update id="updateWaitPayStatus" parameterType="hashmap">
  98. update wx_bill_daily set status=#{waitPay} where tenant_id=#{tenantId}
  99. and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
  100. </update>
  101. </mapper>