Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

136 righe
6.3 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.WxFinanceReceiveMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFinanceReceive">
  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="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  9. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  10. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/>
  11. <result column="receive_money" jdbcType="VARCHAR" property="receiveMoney"/>
  12. <result column="pay_money" jdbcType="VARCHAR" property="payMoney"/>
  13. <result column="set_off_money" jdbcType="VARCHAR" property="setOffMoney"/>
  14. <result column="status" jdbcType="INTEGER" property="status"/>
  15. <result column="type" jdbcType="INTEGER" property="type"/>
  16. <result column="money_detail" jdbcType="VARCHAR" property="moneyDetail"/>
  17. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  18. <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
  19. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  20. <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
  21. <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
  22. <result column="rent_shop_type" jdbcType="INTEGER" property="rentShopType"/>
  23. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  24. <result column="fees_id" jdbcType="BIGINT" property="feesId"/>
  25. <result column="is_print" jdbcType="INTEGER" property="isPrint"/>
  26. <result column="is_finish" jdbcType="INTEGER" property="isFinish"/>
  27. </resultMap>
  28. <sql id="allColumns">
  29. `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`receive_date`,`receive_money`,`pay_money`,`set_off_money`,`status`,`type`,
  30. `money_detail`,`create_by`,`create_by_name`,`update_by`,`update_by_name`,`merchant_id`,`rent_shop_type`,`remark`,
  31. `fees_id`,`is_print`,`is_finish`
  32. </sql>
  33. <sql id="dynamicWhereConditions">
  34. where 1=1
  35. <if test=" null != id ">and `id` = #{id}</if>
  36. <if test=" null != tenantId and '' != tenantId">
  37. and `tenant_id` = #{tenantId}
  38. </if>
  39. <if test=" null != parentTenantId and '' != parentTenantId">
  40. and `parent_tenant_id` = #{parentTenantId}
  41. </if>
  42. <if test=" null != status ">and `status` = #{status}</if>
  43. <if test=" null != type ">and `type` = #{type}</if>
  44. <if test=" null != merchantId ">and `merchant_id` = #{merchantId}</if>
  45. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  46. <if test=" null != createTimeBegin ">and `create_time` &gt;= #{createTimeBegin}</if>
  47. <if test=" null != createTimeEnd ">and `create_time` &lt;= #{createTimeEnd}</if>
  48. <if test=" null != feesId ">and `fees_id` = #{feesId}</if>
  49. <if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
  50. <if test=" null != isPrint ">and `is_print` = #{isPrint}</if>
  51. <if test=" null != isFinish ">and `is_finish` = #{isFinish}</if>
  52. <if test=" null != finishStatus ">and `status` in (1,3)</if>
  53. <if test=" null != merchantIdList ">
  54. and merchant_id in
  55. <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")">
  56. #{midItem}
  57. </foreach>
  58. </if>
  59. <if test=" null != feesIdList ">
  60. and fees_id in
  61. <foreach collection="feesIdList" index="index" item="fidItem" open="(" separator="," close=")">
  62. #{fidItem}
  63. </foreach>
  64. </if>
  65. <if test=" null != ids ">
  66. and id in
  67. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  68. #{idItem}
  69. </foreach>
  70. </if>
  71. <if test=" null != sortColumns">order by ${sortColumns}</if>
  72. </sql>
  73. <select id="findList" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="BaseResultMap">
  74. select
  75. <include refid="allColumns"/>
  76. from wx_finance_receive
  77. <include refid="dynamicWhereConditions"/>
  78. </select>
  79. <select id="findCount" parameterType="com.iformall.domain.po.WxFinanceReceive" resultType="Integer">
  80. select count(1)
  81. from wx_finance_receive
  82. <include refid="dynamicWhereConditions"/>
  83. </select>
  84. <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
  85. select
  86. <include refid="allColumns"/>
  87. from wx_finance_receive where id = #{id} and `tenant_id` = #{tenantId}
  88. </select>
  89. <update id = "setIsDel" parameterType="HashMap">
  90. update wx_finance_receive set is_del = #{isDel} where id = #{id} and `tenant_id` = #{tenantId}
  91. </update>
  92. <resultMap id="SumResultMap" type="com.iformall.domain.vo.WxFinanceReceiveSumVo">
  93. <result column="total_receive" jdbcType="VARCHAR" property="totalReceive"/>
  94. <result column="total_setoff" jdbcType="VARCHAR" property="totalSetoff" />
  95. <result column="total_pay" jdbcType="VARCHAR" property="totalPay"/>
  96. </resultMap>
  97. <select id="getReceiveSum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="SumResultMap">
  98. select
  99. sum(CAST(ifnull(receive_money,'0') AS DECIMAL(20,2))) total_receive ,
  100. sum(CAST(ifnull(set_off_money,'0') AS DECIMAL(20,2))) total_setoff,
  101. sum(CAST(ifnull(pay_money,'0') AS DECIMAL(20,2))) total_pay
  102. from wx_finance_receive
  103. <include refid="dynamicWhereConditions"/>
  104. </select>
  105. <resultMap id="PayWaySumResultMap" type="com.iformall.domain.po.WxFinanceReceivePayway">
  106. <result column="pay_way" jdbcType="BIGINT" property="payWay"/>
  107. <result column="receive" jdbcType="VARCHAR" property="receive"/>
  108. </resultMap>
  109. <select id="getReceivePayWaySum" parameterType="com.iformall.domain.po.WxFinanceReceive" resultMap="PayWaySumResultMap">
  110. select pay_way, sum(CAST(ifnull(receive,'0') AS DECIMAL(20,2))) receive
  111. from wx_finance_receive_payway where is_del = 0 and receive_id in (
  112. select id from wx_finance_receive
  113. <include refid="dynamicWhereConditions"/>
  114. )
  115. group by pay_way
  116. </select>
  117. <update id="finish" parameterType="com.iformall.domain.po.WxFinanceReceive">
  118. update wx_finance_receive set is_finish = 1
  119. <include refid="dynamicWhereConditions"/>
  120. </update>
  121. <update id="updatePrint" parameterType="com.iformall.domain.po.WxFinanceReceive">
  122. update wx_finance_receive set is_print = 1 where id = #{id} and tenant_id = #{tenantId}
  123. </update>
  124. </mapper>