<?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.com.ctop.shiwan.modules.mapper.ShiwanFileUploadMapper">

    <select id="selectEntity" resultType="cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload">
        SELECT
        *
        FROM ctop_shiwan_file_upload
        WHERE
        file_status = 1
        <if test="fileName != null and fileName != '' ">
            and file_name = #{fileName}
        </if>
        <if test="fileType != null and fileType != '' ">
            and file_type = #{fileType}
        </if>
        <if test="accountId != null and accountId != '' ">
            and account_id = #{accountId}
        </if>
        <if test="userId != null and userId != '' ">
            and user_id = #{userId}
        </if>
        <if test="parentId != null and parentId != '' ">
            and parent_id = #{parentId}
        </if>
        <if test="signature != null and signature != '' ">
            and signature = #{signature}
        </if>
        LIMIT 1
    </select>
    <select id="selectListByParentId" resultType="cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload">
        SELECT
        *
        FROM ctop_shiwan_file_upload
        WHERE file_status = 1
        AND parent_id=#{id}
    </select>

    <delete id="deleteByParentId" parameterType="java.lang.Long">
        delete from ctop_shiwan_file_upload
    where parent_id = #{parentId}
    </delete>

</mapper>