25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

83 lines
4.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.WxRentContractRevenueSalesMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractRevenueSales">
  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="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
  11. <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
  12. <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
  13. <result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/>
  14. <result column="sale_money_valid" jdbcType="VARCHAR" property="saleMoneyValid"/>
  15. <result column="calcute_money" jdbcType="VARCHAR" property="calcuteMoney"/>
  16. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  17. <result column="is_confirm" jdbcType="INTEGER" property="isConfirm"/>
  18. <result column="is_calcute" jdbcType="INTEGER" property="isCalcute"/>
  19. </resultMap>
  20. <sql id="allColumns">
  21. `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`starttime`,`endtime`,
  22. `sale_money`,`sale_money_valid`,`calcute_money`,`remark`,`is_confirm`,`is_calcute`
  23. </sql>
  24. <sql id="dynamicWhereConditions">
  25. where 1=1
  26. <if test=" null != id ">and `id` = #{id}</if>
  27. <if test=" null != tenantId and '' != tenantId">
  28. and `tenant_id` = #{tenantId}
  29. </if>
  30. <if test=" null != parentTenantId and '' != parentTenantId">
  31. and `parent_tenant_id` = #{parentTenantId}
  32. </if>
  33. <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
  34. <if test=" null != starttime ">and `starttime` &gt;= #{starttime}</if>
  35. <if test=" null != starttimeEqual ">and `starttime` = #{starttimeEqual}</if>
  36. <if test=" null != endtime ">and `endtime` &lt;= #{endtime}</if>
  37. <if test=" null != endtimeEqual ">and `endtime` = #{endtimeEqual}</if>
  38. <if test=" null != isConfirm ">and `is_confirm` = #{isConfirm}</if>
  39. <if test=" null != isCalcute ">and `is_calcute` = #{isCalcute}</if>
  40. <if test=" null != ids ">
  41. and id in
  42. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  43. #{idItem}
  44. </foreach>
  45. </if>
  46. <if test=" null != sortColumns">order by ${sortColumns}</if>
  47. </sql>
  48. <select id="findList" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultMap="BaseResultMap">
  49. select
  50. <include refid="allColumns"/>
  51. from wx_rent_contract_revenue_sales
  52. <include refid="dynamicWhereConditions"/>
  53. </select>
  54. <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
  55. select
  56. <include refid="allColumns"/>
  57. from wx_rent_contract_revenue_sales where id = #{id} and `tenant_id` = #{tenantId}
  58. </select>
  59. <select id="findSumSalesMoneyValid" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultType="BigDecimal">
  60. select sum(CAST(ifnull(sale_money_valid,'0') AS DECIMAL(20,2))) receive_pay
  61. from wx_rent_contract_revenue_sales
  62. <include refid="dynamicWhereConditions"/>
  63. </select>
  64. <update id= "updateConfirm" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
  65. update wx_rent_contract_revenue_sales set is_confirm = 1
  66. where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` &gt;= #{starttime} and `endtime` &lt;= #{endtime}
  67. </update>
  68. <update id= "updateCalcute" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
  69. update wx_rent_contract_revenue_sales set is_calcute = 1
  70. where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` &gt;= #{starttime} and `endtime` &lt;= #{endtime}
  71. </update>
  72. </mapper>