<?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.yanzhu.jh.trouble.mapper.SmzSspMarksMapper">
    
    <resultMap type="SmzSspMarks" id="SmzSspMarksResult">
        <result property="id"    column="id"    />
        <result property="marksLocation"    column="marks_location"    />
        <result property="marksTime"    column="marks_time"    />
        <result property="marksPicture"    column="marks_picture"    />
        <result property="marksVideo"    column="marks_video"    />
        <result property="projectType"    column="project_type"    />
        <result property="projectName"    column="project_name"    />
        <result property="processName"    column="process_name"    />
        <result property="positionPart"    column="position_part"    />
        <result property="marksRemark"    column="marks_remark"    />
        <result property="auditorPerson"    column="auditor_person"    />
        <result property="createDate"    column="create_date"    />
        <result property="createUser"    column="create_user"    />
        <result property="projectId"    column="projectId"    />
        <result property="auditorPhone"    column="auditorPhone"    />
        <result property="checkState"    column="checkState"    />
        <result property="idcardnum"    column="idcardnum"    />
        <result property="infoType"    column="infoType"    />
        <result property="smarkUrl"    column="smark_url"    />
        <result property="synchronization"    column="synchronization"    />
        <result property="isDel"    column="is_del"    />
        <result property="surveyorName"    column="surveyorName"    />
        <result property="surveyorId"    column="surveyorId"    />
        <result property="surveyorTime"    column="surveyorTime"    />
        <result property="surveyorContent"    column="surveyorContent"    />
        <result property="updateDate"    column="update_date"    />
    </resultMap>

    <sql id="selectSmzSspMarksVo">
        select id, marks_location, marks_time, marks_picture, marks_video, project_type, project_name, process_name, position_part, marks_remark, auditor_person, create_date, create_user, projectId, auditorPhone, checkState, idcardnum, infoType, smark_url, synchronization, is_del, surveyorName, surveyorId, surveyorTime, surveyorContent, update_date

        from smz_ssp_marks
    </sql>

    <select id="selectSmzSspMarksList" parameterType="SmzSspMarks" resultMap="SmzSspMarksResult">
        <include refid="selectSmzSspMarksVo"/>
        <where>  
            <if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and marks_time between #{params.beginMarksTime} and #{params.endMarksTime}</if>
            <if test="marksLocation != null  and marksLocation != ''"> and marks_location like concat('%', #{marksLocation}, '%')</if>
            <if test="projectType != null  and projectType != ''"> and project_type = #{projectType}</if>
            <if test="auditorPerson != null  and auditorPerson != ''"> and auditor_person = #{auditorPerson}</if>
            <if test="createUser != null  and createUser != ''"> and create_user like concat('%', #{createUser}, '%')</if>
            <if test="projectId != null "> and projectId = #{projectId}</if>
            <if test="auditorPhone != null  and auditorPhone != ''"> and auditorPhone = #{auditorPhone}</if>
            <if test="checkState != null "> and checkState = #{checkState}</if>
            <if test="idcardnum != null  and idcardnum != ''"> and idcardnum = #{idcardnum}</if>
            <if test="infoType != null "> and infoType = #{infoType}</if>
            <if test="smarkUrl != null  and smarkUrl != ''"> and smark_url = #{smarkUrl}</if>
            <if test="synchronization != null "> and synchronization = #{synchronization}</if>
            <if test="isDel != null "> and is_del = #{isDel}</if>
            <if test="surveyorName != null  and surveyorName != ''"> and surveyorName like concat('%', #{surveyorName}, '%')</if>
            <if test="surveyorId != null  and surveyorId != ''"> and surveyorId = #{surveyorId}</if>
            <if test="surveyorTime != null  and surveyorTime != ''"> and surveyorTime = #{surveyorTime}</if>
            <if test="surveyorContent != null  and surveyorContent != ''"> and surveyorContent = #{surveyorContent}</if>
            <if test="updateDate != null "> and update_date = #{updateDate}</if>
        </where>
        order by marks_time desc
    </select>
    
    <select id="selectSmzSspMarksById" parameterType="String" resultMap="SmzSspMarksResult">
        <include refid="selectSmzSspMarksVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSmzSspMarks" parameterType="SmzSspMarks">
        insert into smz_ssp_marks
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="marksLocation != null">marks_location,</if>
            <if test="marksTime != null">marks_time,</if>
            <if test="marksPicture != null">marks_picture,</if>
            <if test="marksVideo != null">marks_video,</if>
            <if test="projectType != null">project_type,</if>
            <if test="projectName != null">project_name,</if>
            <if test="processName != null">process_name,</if>
            <if test="positionPart != null">position_part,</if>
            <if test="marksRemark != null">marks_remark,</if>
            <if test="auditorPerson != null">auditor_person,</if>
            <if test="createDate != null">create_date,</if>
            <if test="createUser != null">create_user,</if>
            <if test="projectId != null">projectId,</if>
            <if test="auditorPhone != null">auditorPhone,</if>
            <if test="checkState != null">checkState,</if>
            <if test="idcardnum != null">idcardnum,</if>
            <if test="infoType != null">infoType,</if>
            <if test="smarkUrl != null">smark_url,</if>
            <if test="synchronization != null">synchronization,</if>
            <if test="isDel != null">is_del,</if>
            <if test="surveyorName != null">surveyorName,</if>
            <if test="surveyorId != null">surveyorId,</if>
            <if test="surveyorTime != null">surveyorTime,</if>
            <if test="surveyorContent != null">surveyorContent,</if>
            <if test="updateDate != null">update_date,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="marksLocation != null">#{marksLocation},</if>
            <if test="marksTime != null">#{marksTime},</if>
            <if test="marksPicture != null">#{marksPicture},</if>
            <if test="marksVideo != null">#{marksVideo},</if>
            <if test="projectType != null">#{projectType},</if>
            <if test="projectName != null">#{projectName},</if>
            <if test="processName != null">#{processName},</if>
            <if test="positionPart != null">#{positionPart},</if>
            <if test="marksRemark != null">#{marksRemark},</if>
            <if test="auditorPerson != null">#{auditorPerson},</if>
            <if test="createDate != null">#{createDate},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="projectId != null">#{projectId},</if>
            <if test="auditorPhone != null">#{auditorPhone},</if>
            <if test="checkState != null">#{checkState},</if>
            <if test="idcardnum != null">#{idcardnum},</if>
            <if test="infoType != null">#{infoType},</if>
            <if test="smarkUrl != null">#{smarkUrl},</if>
            <if test="synchronization != null">#{synchronization},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="surveyorName != null">#{surveyorName},</if>
            <if test="surveyorId != null">#{surveyorId},</if>
            <if test="surveyorTime != null">#{surveyorTime},</if>
            <if test="surveyorContent != null">#{surveyorContent},</if>
            <if test="updateDate != null">#{updateDate},</if>
         </trim>
    </insert>

    <update id="updateSmzSspMarks" parameterType="SmzSspMarks">
        update smz_ssp_marks
        <trim prefix="SET" suffixOverrides=",">
            <if test="marksLocation != null">marks_location = #{marksLocation},</if>
            <if test="marksTime != null">marks_time = #{marksTime},</if>
            <if test="marksPicture != null">marks_picture = #{marksPicture},</if>
            <if test="marksVideo != null">marks_video = #{marksVideo},</if>
            <if test="projectType != null">project_type = #{projectType},</if>
            <if test="projectName != null">project_name = #{projectName},</if>
            <if test="processName != null">process_name = #{processName},</if>
            <if test="positionPart != null">position_part = #{positionPart},</if>
            <if test="marksRemark != null">marks_remark = #{marksRemark},</if>
            <if test="auditorPerson != null">auditor_person = #{auditorPerson},</if>
            <if test="createDate != null">create_date = #{createDate},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="projectId != null">projectId = #{projectId},</if>
            <if test="auditorPhone != null">auditorPhone = #{auditorPhone},</if>
            <if test="checkState != null">checkState = #{checkState},</if>
            <if test="idcardnum != null">idcardnum = #{idcardnum},</if>
            <if test="infoType != null">infoType = #{infoType},</if>
            <if test="smarkUrl != null">smark_url = #{smarkUrl},</if>
            <if test="synchronization != null">synchronization = #{synchronization},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="surveyorName != null">surveyorName = #{surveyorName},</if>
            <if test="surveyorId != null">surveyorId = #{surveyorId},</if>
            <if test="surveyorTime != null">surveyorTime = #{surveyorTime},</if>
            <if test="surveyorContent != null">surveyorContent = #{surveyorContent},</if>
            <if test="updateDate != null">update_date = #{updateDate},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSmzSspMarksById" parameterType="String">
        delete from smz_ssp_marks where id = #{id}
    </delete>

    <delete id="deleteSmzSspMarksByIds" parameterType="String">
        delete from smz_ssp_marks where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>