<?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.goldenwater.slaj.sins.mapper.ObjSinsMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.ObjSins" id="ObjSinsResult">
        <result property="guid" column="guid"/>
        <result property="sinsDeplName" column="sins_depl_name"/>
        <result property="sinsStartTime" column="sins_start_time"/>
        <result property="sinsCompTime" column="sins_comp_time"/>
        <result property="sinsRange" column="sins_range"/>
        <result property="sinsLareId" column="sins_lare_id"/>
        <result property="sinsNotTime" column="sins_not_time"/>
        <result property="pGuid" column="p_guid"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
        <result property="notIssuGuid" column="not_issu_guid"/>
        <result property="scheModel" column="sche_model"/>
        <result property="ifSendDown" column="if_send_down"/>
    </resultMap>

    <sql id="selectObjSinsVo">
        select guid, sins_depl_name, sins_start_time, sins_comp_time, sins_range, sins_lare_id, sins_not_time, p_guid, note, coll_time, upd_time, rec_pers, not_issu_guid, sche_model, if_send_down from obj_sins
    </sql>

    <select id="selectObjSinsByGuid" parameterType="String" resultMap="ObjSinsResult">
        <include refid="selectObjSinsVo"/> where guid = #{guid}
    </select>

    <select id="selectObjSinsList" parameterType="com.goldenwater.slaj.sins.domain.ObjSins" resultMap="ObjSinsResult">
        <include refid="selectObjSinsVo"/>
        <where>
            <if test="sinsDeplName != null and sinsDeplName != ''">
                and sins_depl_name like '%' || #{sinsDeplName} || '%'
            </if>
            <if test="scheModel != null and scheModel != ''">
                and sche_model = #{scheModel}
            </if>
            <if test="ifSendDown != null and ifSendDown != ''">
                and if_send_down = #{ifSendDown}
            </if>
        </where>
    </select>

    <insert id="insertObjSins" parameterType="com.goldenwater.slaj.sins.domain.ObjSins">
        insert into obj_sins (guid, sins_depl_name, sins_start_time, sins_comp_time, sins_range, sins_lare_id, sins_not_time, p_guid, note, coll_time, upd_time, rec_pers, not_issu_guid, sche_model, if_send_down)
        values (#{guid}, #{sinsDeplName}, #{sinsStartTime}, #{sinsCompTime}, #{sinsRange}, #{sinsLareId}, #{sinsNotTime}, #{pGuid}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{notIssuGuid}, #{scheModel}, #{ifSendDown})
    </insert>

    <update id="updateObjSins" parameterType="com.goldenwater.slaj.sins.domain.ObjSins">
        update obj_sins
        <set>
            <if test="sinsDeplName != null and sinsDeplName != ''">sins_depl_name = #{sinsDeplName},</if>
            <if test="sinsStartTime != null">sins_start_time = #{sinsStartTime},</if>
            <if test="sinsCompTime != null">sins_comp_time = #{sinsCompTime},</if>
            <if test="sinsRange != null and sinsRange != ''">sins_range = #{sinsRange},</if>
            <if test="sinsLareId != null and sinsLareId != ''">sins_lare_id = #{sinsLareId},</if>
            <if test="sinsNotTime != null">sins_not_time = #{sinsNotTime},</if>
            <if test="pGuid != null and pGuid != ''">p_guid = #{pGuid},</if>
            <if test="note != null and note != ''">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null and recPers != ''">rec_pers = #{recPers},</if>
            <if test="notIssuGuid != null and notIssuGuid != ''">not_issu_guid = #{notIssuGuid},</if>
            <if test="scheModel != null and scheModel != ''">sche_model = #{scheModel},</if>
            <if test="ifSendDown != null and ifSendDown != ''">if_send_down = #{ifSendDown},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteObjSinsByGuid" parameterType="String">
        delete from obj_sins where guid = #{guid}
    </delete>

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