Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

95 řádky
4.6 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="INTEGER" property="receivePay" />
  7. <result column="pay" jdbcType="INTEGER" 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="INTEGER" 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. </resultMap>
  22. <sql id="allColumns">
  23. `id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`tenant_id`,`owe`,`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`updatetime`,`type`
  24. </sql>
  25. <sql id="dynamicWhereConditions">
  26. where 1 = 1
  27. <if test=" null != id "> and `id` = #{id} </if>
  28. <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
  29. <if test=" null != pay "> and `pay` = #{pay} </if>
  30. <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
  31. <if test=" null != payDate "> and `pay_date` = #{payDate} </if>
  32. <if test=" null != createtime "> and `createtime` = #{createtime} </if>
  33. <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
  34. <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
  35. <if test=" null != owe "> and `owe` = #{owe} </if>
  36. <if test=" null != status "> and `status` = #{status} </if>
  37. <if test=" null != isDel "> and `is_del` = #{isDel} </if>
  38. <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
  39. <if test=" null != userId "> and `user_id` = #{userId} </if>
  40. <if test=" null != shopId "> and `shop_id` = #{shopId} </if>
  41. <if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
  42. <if test=" null != type "> and `type` = #{type} </if>
  43. <if test=" null != ids ">
  44. and id in
  45. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  46. #{idItem}
  47. </foreach>
  48. </if>
  49. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  50. </sql>
  51. <select id="findList" parameterType="com.iformall.domain.po.WxBillDaily" resultMap="BaseResultMap">
  52. select <include refid="allColumns" /> from wx_bill_daily
  53. <include refid="dynamicWhereConditions" />
  54. </select>
  55. <select id="queryBillDailyList" parameterType="com.iformall.domain.po.WxBillDaily" resultType="hashmap">
  56. select br.`id`,br.`receive_pay` receivePay,br.`pay`,br.`receive_date` receiveDate,
  57. br.`pay_date` payDate,br.`createtime`,br.`expired_day` expiredDay,br.`owe`,br.`status`,
  58. m.`name` merchantName,s.shop_number shopNumber,br.`updatetime`,
  59. br.`merchant_id` merchantId,br.shop_id shopId,br.type
  60. from wx_bill_daily br left join wx_merchant m on br.merchant_id=m.id
  61. left join wx_shop s on br.shop_id=s.id
  62. <where>
  63. <if test=" null != id ">and br.`id` = #{id}</if>
  64. <if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
  65. <if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
  66. <if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if>
  67. <if test=" null != status ">and br.`status` = #{status}</if>
  68. <if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
  69. <if test=" null != type ">and br.`type` = #{type}</if>
  70. </where>
  71. order by id desc
  72. </select>
  73. <update id="updateNotPaidStatus" parameterType="hashmap">
  74. update wx_bill_daily set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
  75. where tenant_id=#{tenantId} and status!=#{paid} and DATEDIFF(now(),receive_date)>0
  76. </update>
  77. <update id="updateWaitPayStatus" parameterType="hashmap">
  78. update wx_bill_daily set status=#{waitPay} where tenant_id=#{tenantId}
  79. and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
  80. </update>
  81. </mapper>