<?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.fastbee.oss.mapper.OssDetailMapper">

    <resultMap type="com.fastbee.oss.domain.OssDetail" id="OssDetailResult">
        <result property="id"    column="id"    />
        <result property="tenantId"    column="tenant_id"    />
        <result property="tenantName"    column="tenant_name"    />
        <result property="fileName"    column="file_name"    />
        <result property="originalName"    column="original_name"    />
        <result property="fileSuffix"    column="file_suffix"    />
        <result property="url"    column="url"    />
        <result property="service"    column="service"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectOssDetailVo">
        select id, tenant_id, tenant_name, file_name, original_name, file_suffix, url, service, del_flag, create_by, create_time, update_by, update_time, remark from oss_detail
    </sql>

    <select id="selectOssDetailList" parameterType="com.fastbee.oss.domain.OssDetail" resultMap="OssDetailResult">
        <include refid="selectOssDetailVo"/>
        <where>
            <if test="tenantId != null "> and tenant_id = #{tenantId}</if>
            <if test="tenantName != null  and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="originalName != null  and originalName != ''"> and original_name like concat('%', #{originalName}, '%')</if>
            <if test="fileSuffix != null  and fileSuffix != ''"> and file_suffix = #{fileSuffix}</if>
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="service != null  and service != ''"> and service = #{service}</if>
        </where>
    </select>

</mapper>
