<?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.citygis.web.mapper.TabSystemSpaceMapper">

    <select id="getSpace" resultType="com.citygis.web.domain.TabSystemSpace"
            parameterType="com.citygis.web.domain.TabSystemSpace">
        select "FILEPATH","IP","DESCRIPTION","FILE_SPACE","USABLE_SPACE","FILE_TOTAL_SPACE",MAX(CREATE_TIME)
        from "LIU_TONG_YI"."TAB_SYSTEM_SPACE"
        <where>
            <if test="filepath != null">
                FILEPATH like concat('%',#{filepath},'%')
            </if>
        </where>
        GROUP BY "FILEPATH","IP","DESCRIPTION","FILE_SPACE","USABLE_SPACE","FILE_TOTAL_SPACE"
    </select>

    <select id="getSpaceDetailByFilepath" resultType="com.citygis.web.domain.TabSystemSpace"
            parameterType="com.citygis.web.domain.TabSystemSpace">
        select "FILEPATH","IP","DESCRIPTION","FILE_SPACE","USABLE_SPACE","FILE_TOTAL_SPACE",MAX(CREATE_TIME)
        from "LIU_TONG_YI"."TAB_SYSTEM_SPACE"
        <where>
            <if test="filepath != null">
                FILEPATH like concat('%',#{filepath},'%')
            </if>
            <if test="startTime != null">
                and CREATE_TIME >= #{startTime}
                and CREATE_TIME &lt;= #{endTime}
            </if>
        </where>
        GROUP BY "FILEPATH","IP","DESCRIPTION","FILE_SPACE","USABLE_SPACE","FILE_TOTAL_SPACE"
    </select>

    <select id="getLinkTitle" resultType="com.citygis.web.domain.TabLinkTitle"
            parameterType="com.citygis.web.domain.TabSystemSpace">select MAX(CAST(SUBSTRING(FILE_SPACE, 1,
        LENGTH(FILE_SPACE) - 2) AS INT)) big,
        AVG(CAST(SUBSTRING(FILE_SPACE, 1, LENGTH(FILE_SPACE) - 2) AS INT)) average,
        MIN(CAST(SUBSTRING(FILE_SPACE, 1, LENGTH(FILE_SPACE) - 2) AS INT)) small
        from "LIU_TONG_YI"."TAB_SYSTEM_SPACE" WHERE FILEPATH = #{filepath}
    </select>

</mapper>
