<?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.tuoheng.admin.mapper.InspectionFileMapper">
    
    <resultMap type="com.tuoheng.admin.entity.InspectionFile" id="InspectionFileResult">
        <result property="id"    column="id"    />
        <result property="tenantId"    column="tenant_id"    />
        <result property="fileCode"    column="file_code"    />
        <result property="inspectionId"    column="inspection_id"    />
        <result property="fileType"    column="file_type"    />
        <result property="fileName"    column="file_name"    />
        <result property="fileThumbnail"    column="file_thumbnail"    />
        <result property="fileOriginal"    column="file_original"    />
        <result property="fileImage"    column="file_image"    />
        <result property="fileSize"    column="file_size"    />
        <result property="latitude"    column="latitude"    />
        <result property="longitude"    column="longitude"    />
        <result property="location"    column="location"    />
        <result property="gaodeLongitude"    column="gaode_longitude"    />
        <result property="gaodeLatitude"    column="gaode_latitude"    />
        <result property="gaodeAddress"    column="gaode_address"    />
        <result property="questionId"    column="question_id"    />
        <result property="source"    column="source"    />
        <result property="questionName"    column="question_name"    />
        <result property="content"    column="content"    />
        <result property="questionDesc"    column="question_desc"    />
        <result property="status"    column="status"    />
        <result property="checkUser"    column="check_user"    />
        <result property="checkTime"    column="check_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="mark"    column="mark"    />
    </resultMap>

    <sql id="selectThInspectionFileVo">
        select id, tenant_id, file_code, inspection_id, file_type, file_name, file_thumbnail, file_original, file_image, file_size, latitude, longitude, location, gaode_longitude, gaode_latitude, gaode_address, question_id, source, question_name, content, question_desc, status, check_user, check_time, create_user, create_time, update_user, update_time, mark from th_inspection_file
    </sql>

    <update id="deleteLogicByMap" parameterType="hashmap">
        update th_inspection_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if>
            <if test="updateTime != null"> update_time = #{updateTime}, </if>
            <if test="mark != null"> mark = #{mark},</if>
        </trim>
        <where>
            <if test="inspectionId != null and inspectionId != ''"> inspection_id = #{inspectionId} </if>
        </where>
    </update>

    <delete id="deleteByInspectionId" parameterType="String">
        delete from th_inspection_file where inspection_id = #{id}
    </delete>

</mapper>