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

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