<?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="cn.iocoder.yudao.module.property.mapper.PropertyKeepMapper">

    <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.property.entity.PropertyKeep">
        <id property="id" column="id" jdbcType="VARCHAR"/>
        <result property="propertyId" column="property_id" jdbcType="VARCHAR"/>
        <result property="keepDate" column="keep_date" jdbcType="DATE"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="fileUrls" column="file_urls" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_SQL">
        select id,
               property_id,
               keep_date,
               remark,
               file_urls,
               tenant_id,
               deleted,
               creator,
               create_time,
               updater,
               update_time
        from company_property_keep
        where deleted = '0'
    </sql>

    <select id="getPropertyKeepPage" resultMap="BaseResultMap">
        <include refid="Base_SQL" />
        AND (property_id = #{map.propertyId})
        <if test="map.keepDateArray != null and map.keepDateArray.length > 0">
            AND (keep_date BETWEEN #{map.keepDateArray[0]} AND #{map.keepDateArray[1]})
        </if>
        order by create_time desc
    </select>
</mapper>