<?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.ezhizao.project.tool.file.mapper.FileMapper">

    <resultMap type="cn.ezhizao.project.tool.file.domain.File" id="FileResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="File" resultMap="FileResult">
        SELECT * FROM biz_file
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0 AND
            <if test="name != null  and name != ''"> AND name like concat('%', #{name}, '%')</if>
            <if test="status != null "> AND status = #{status}</if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_file
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <if test="masterTableId != null and masterTableName != null and masterTableName != '' ">
                master_table_id = #{masterTableId} AND master_table_name = #{masterTableName} AND
            </if>
            <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
