|
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.iformall.mapper.WxRentContractRevenueSalesMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRentContractRevenueSales">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
- <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
- <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
- <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
- <result column="sale_money" jdbcType="VARCHAR" property="saleMoney"/>
- <result column="sale_money_valid" jdbcType="VARCHAR" property="saleMoneyValid"/>
- <result column="calcute_money" jdbcType="VARCHAR" property="calcuteMoney"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="is_confirm" jdbcType="INTEGER" property="isConfirm"/>
- <result column="is_calcute" jdbcType="INTEGER" property="isCalcute"/>
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`rent_contract_id`,`property_contract_id`,`starttime`,`endtime`,
- `sale_money`,`sale_money_valid`,`calcute_money`,`remark`,`is_confirm`,`is_calcute`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1=1
- <if test=" null != id ">and `id` = #{id}</if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
- <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
- <if test=" null != starttime ">and `starttime` >= #{starttime}</if>
- <if test=" null != starttimeEqual ">and `starttime` = #{starttimeEqual}</if>
- <if test=" null != endtime ">and `endtime` <= #{endtime}</if>
- <if test=" null != endtimeEqual ">and `endtime` = #{endtimeEqual}</if>
- <if test=" null != isConfirm ">and `is_confirm` = #{isConfirm}</if>
- <if test=" null != isCalcute ">and `is_calcute` = #{isCalcute}</if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_rent_contract_revenue_sales
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_rent_contract_revenue_sales where id = #{id} and `tenant_id` = #{tenantId}
- </select>
-
- <select id="findSumSalesMoneyValid" parameterType="com.iformall.domain.po.WxRentContractRevenueSales" resultType="BigDecimal">
- select sum(CAST(ifnull(sale_money_valid,'0') AS DECIMAL(20,2))) receive_pay
- from wx_rent_contract_revenue_sales
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <update id= "updateConfirm" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
- update wx_rent_contract_revenue_sales set is_confirm = 1
- where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` >= #{starttime} and `endtime` <= #{endtime}
- </update>
-
- <update id= "updateCalcute" parameterType="com.iformall.domain.po.WxRentContractRevenueSales">
- update wx_rent_contract_revenue_sales set is_calcute = 1
- where `tenant_id` = #{tenantId} and `rent_contract_id` = #{rentContractId} and `starttime` >= #{starttime} and `endtime` <= #{endtime}
- </update>
-
- </mapper>
|