<?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.boman.web.core.mapper.AttendanceSetMapper">
    
    <resultMap type="AttendanceSet" id="AttendanceSetResult">
        <result property="id"    column="id"    />
        <result property="attendanceAdd"    column="attendance_add"    />
        <result property="lgt"    column="lgt"    />
        <result property="lat"    column="lat"    />
        <result property="limitRange"    column="limit_range"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
    </resultMap>

    <sql id="selectAttendanceSetVo">
        select id, attendance_add, lgt, lat, limit_range, create_by, create_time, update_by, update_time, is_del from attendance_set
    </sql>

    <select id="selectAttendanceSetList" parameterType="AttendanceSet" resultMap="AttendanceSetResult">
        <include refid="selectAttendanceSetVo"/>
        <where>
            is_del = 'N'
            <if test="attendanceAdd != null  and attendanceAdd != ''"> and attendance_add = #{attendanceAdd}</if>
            <if test="lgt != null  and lgt != ''"> and lgt = #{lgt}</if>
            <if test="lat != null  and lat != ''"> and lat = #{lat}</if>
            <if test="limitRange != null  and limitRange != ''"> and limit_range = #{limitRange}</if>
        </where>
    </select>
    
    <select id="selectAttendanceSetById" parameterType="Long" resultMap="AttendanceSetResult">
        <include refid="selectAttendanceSetVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAttendanceSet" parameterType="AttendanceSet">
        insert into attendance_set
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="attendanceAdd != null">attendance_add,</if>
            <if test="lgt != null">lgt,</if>
            <if test="lat != null">lat,</if>
            <if test="limitRange != null">limit_range,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDel != null">is_del,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="attendanceAdd != null">#{attendanceAdd},</if>
            <if test="lgt != null">#{lgt},</if>
            <if test="lat != null">#{lat},</if>
            <if test="limitRange != null">#{limit_range},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDel != null">#{isDel},</if>
         </trim>
    </insert>

    <update id="updateAttendanceSet" parameterType="AttendanceSet">
        update attendance_set
        <trim prefix="SET" suffixOverrides=",">
            <if test="attendanceAdd != null">attendance_add = #{attendanceAdd},</if>
            <if test="lgt != null">lgt = #{lgt},</if>
            <if test="lat != null">lat = #{lat},</if>
            <if test="limitRange != null">limit_range = #{limitRange},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAttendanceSetById" parameterType="Long">
        delete from attendance_set where id = #{id}
    </delete>

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