Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

105 linhas
5.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.simple.mapper.WxBillRentMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.domain.po.WxBillRent">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="shop_id" jdbcType="BIGINT" property="shopId" />
  7. <result column="user_area" jdbcType="DECIMAL" property="userArea" />
  8. <result column="price" jdbcType="DECIMAL" property="price" />
  9. <result column="need_pay" jdbcType="DECIMAL" property="needPay" />
  10. <result column="receive_pay" jdbcType="DECIMAL" property="receivePay" />
  11. <result column="pay" jdbcType="DECIMAL" property="pay" />
  12. <result column="receive_period" jdbcType="INTEGER" property="receivePeriod" />
  13. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate" />
  14. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
  15. <result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
  16. <result column="expired_day" jdbcType="INTEGER" property="expiredDay" />
  17. <result column="pay_way" jdbcType="INTEGER" property="payWay" />
  18. <result column="receipt_num" jdbcType="VARCHAR" property="receiptNum" />
  19. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  20. <result column="owe" jdbcType="DECIMAL" property="owe" />
  21. <result column="pay_status" jdbcType="Integer" property="payStatus" />
  22. </resultMap>
  23. <sql id="allColumns">
  24. `id`,`shop_id`,`user_area`,`price`,`need_pay`,`receive_pay`,`pay`,`receive_period`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`pay_way`,`receipt_num`,`tenant_id`,`owe`,`pay_status`
  25. </sql>
  26. <sql id="dynamicWhereConditions">
  27. where 1 = 1
  28. <if test=" null != id "> and `id` = #{id} </if>
  29. <if test=" null != shopId "> and `shop_id` = #{shopId} </if>
  30. <if test=" null != userArea "> and `user_area` = #{userArea} </if>
  31. <if test=" null != price "> and `price` = #{price} </if>
  32. <if test=" null != needPay "> and `need_pay` = #{needPay} </if>
  33. <if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
  34. <if test=" null != pay "> and `pay` = #{pay} </if>
  35. <if test=" null != receivePeriod "> and `receive_period` = #{receivePeriod} </if>
  36. <if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
  37. <if test=" null != payDate "> and `pay_date` = #{payDate} </if>
  38. <if test=" null != createtime "> and `createtime` = #{createtime} </if>
  39. <if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
  40. <if test=" null != payWay "> and `pay_way` = #{payWay} </if>
  41. <if test=" null != receiptNum "> and `receipt_num` = #{receiptNum} </if>
  42. <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </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.simple.domain.po.WxBillRent" resultMap="BaseResultMap">
  52. select <include refid="allColumns" /> from wx_bill_rent
  53. <include refid="dynamicWhereConditions" />
  54. </select>
  55. <select id="findListMap" parameterType="com.simple.domain.po.WxBillRent" resultType="hashmap">
  56. select br.id,br.shop_id shopId,br.user_area userArea,br.price,br.need_pay needPay,br.receive_pay receivePay,
  57. br.pay,br.receive_period receivePeriod,br.receive_date receiveDate,br.pay_date payDate,br.createtime,
  58. br.expired_day expiredDay,br.pay_way payWay,br.receipt_num receiptNum,m.`name` merchantName,
  59. s.build_area buildArea,s.operation_area operationArea,s.shop_number shopNumber,br.owe,br.pay_status payStatus
  60. from wx_bill_rent br left join wx_merchant_shop ms on br.shop_id=ms.shop_id and ms.is_del=0
  61. inner join wx_merchant m on ms.merchant_id=m.id
  62. inner join wx_shop s on ms.shop_id=s.id
  63. where 1 = 1
  64. <if test=" null != id "> and br.`id` = #{id} </if>
  65. <if test=" null != shopId "> and br.`shop_id` = #{shopId} </if>
  66. <if test=" null != userArea "> and br.`user_area` = #{userArea} </if>
  67. <if test=" null != price "> and br.`price` = #{price} </if>
  68. <if test=" null != needPay "> and br.`need_pay` = #{needPay} </if>
  69. <if test=" null != receivePay "> and br.`receive_pay` = #{receivePay} </if>
  70. <if test=" null != pay "> and br.`pay` = #{pay} </if>
  71. <if test=" null != receivePeriod "> and br.`receive_period` = #{receivePeriod} </if>
  72. <if test=" null != receiveDate "> and br.`receive_date` = #{receiveDate} </if>
  73. <if test=" null != payDate "> and br.`pay_date` = #{payDate} </if>
  74. <if test=" null != createtime "> and br.`createtime` = #{createtime} </if>
  75. <if test=" null != expiredDay "> and br.`expired_day` = #{expiredDay} </if>
  76. <if test=" null != payWay "> and br.`pay_way` = #{payWay} </if>
  77. <if test=" null != receiptNum "> and br.`receipt_num` = #{receiptNum} </if>
  78. <if test=" null != tenantId "> and br.`tenant_id` = #{tenantId} </if>
  79. <if test=" null != shopNumber "> and br.`shop_number` = #{shopNumber} </if>
  80. <if test=" null != payStatus "> and br.`pay_status` = #{payStatus} </if>
  81. <if test=" null != ids ">
  82. and br.id in
  83. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  84. #{idItem}
  85. </foreach>
  86. </if>
  87. <if test=" null != sortColumns"> order by br.${sortColumns} </if>
  88. </select>
  89. <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
  90. select sum(receive_pay) receivepay,sum(pay) pay,tenant_id from wx_bill_rent
  91. where tenant_id=#{tenantId} and date_format(receive_date,'%Y-%m')=#{receiveDate}
  92. group by tenant_id
  93. </select>
  94. </mapper>