<?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.timer.api.dao.kqmk.KqglAssoDkjlMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoDkjl" >
                <id column="id" property="id" />
                <result column="dktime" property="dktime" />
                <result column="lon" property="lon" />
                <result column="lat" property="lat" />
                <result column="address" property="address" />
                <result column="results" property="results" />
                <result column="user_id" property="userId" />
                <result column="type" property="type" />
                <result column="status" property="status" />
                <result column="sort" property="sort" />
                <result column="card_type" property="cardType" />
                <result column="mac" property="mac" />
                <result column="macname" property="macname" />
                <result column="qyid" property="qyid" />
                <result column="attdate" property="attdate" />
                <result column="attime" property="attime" />
                <result column="dkmxid" property="dkmxid" />
                <result column="bcid" property="bcid" />
                <result column="remarks" property="remarks" />
                <result column="punchmode" property="punchmode" />
                <result column="punchequipment" property="punchequipment" />
                <result column="commentary" property="commentary" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                dktime,
                lon,
                lat,
                address,
                results,
                user_id,
                type,
                status,
                sort,
                card_type,
                mac,
                macname,
                qyid,
                attdate,
                attime,
                dkmxid,
                bcid,
                remarks,
                punchmode,
                punchequipment,
                commentary
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id KqglAssoDkjl_id,
                dktime KqglAssoDkjl_dktime,
                lon KqglAssoDkjl_lon,
                lat KqglAssoDkjl_lat,
                address KqglAssoDkjl_address,
                results KqglAssoDkjl_results,
                user_id KqglAssoDkjl_user_id,
                type KqglAssoDkjl_type,
                status KqglAssoDkjl_status,
                sort KqglAssoDkjl_sort,
                card_type KqglAssoDkjl_card_type,
                mac KqglAssoDkjl_mac,
                macname KqglAssoDkjl_macname,
                qyid KqglAssoDkjl_qyid,
                attdate KqglAssoDkjl_attdate,
                attime KqglAssoDkjl_attime,
                dkmxid KqglAssoDkjl_dkmxid,
                bcid KqglAssoDkjl_bcid,
                remarks KqglAssoDkjl_remarks,
                punchmode KqglAssoDkjl_punchmode,
                punchequipment KqglAssoDkjl_punchequipment,
                commentary KqglAssoDkjl_explain
    </sql>

	<select id="getDetailedRecordClock" resultMap="BaseResultMap">
  		select * from kqgl_asso_dkjl dkjl
		where dkjl.attime &gt;= #{start}
		and dkjl.attime &lt;= #{end}
		and dkjl.user_id = #{userId,jdbcType=INTEGER}
		and dkjl.status != 0
  	</select>
	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkjl">
        INSERT INTO kqgl_asso_dkjl
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != dktime'>
                        dktime,
                        </if>
                        <if test ='null != lon'>
                        lon,
                        </if>
                        <if test ='null != lat'>
                        lat,
                        </if>
                        <if test ='null != address'>
                        address,
                        </if>
                        <if test ='null != results'>
                        results,
                        </if>
                        <if test ='null != userId'>
                        user_id,
                        </if>
                        <if test ='null != type'>
                        type,
                        </if>
                        <if test ='null != status'>
                        status,
                        </if>
                        <if test ='null != sort'>
                        sort,
                        </if>
                        <if test ='null != cardType'>
                        card_type,
                        </if>
                        <if test ='null != mac'>
                        mac,
                        </if>
                        <if test ='null != macname'>
                        macname,
                        </if>
                        <if test ='null != qyid'>
                        qyid,
                        </if>
                        <if test ='null != attdate'>
                        attdate,
                        </if>
                        <if test ='null != attime'>
                        attime,
                        </if>
                        <if test ='null != dkmxid'>
                        dkmxid,
                        </if>
                        <if test ='null != bcid'>
                        bcid,
                        </if>
                        <if test ='null != remarks'>
                        remarks,
                        </if>
                        <if test ='null != punchmode'>
                        punchmode,
                        </if>
                        <if test ='null != punchequipment'>
                        punchequipment,
                        </if>
                        <if test ='null != commentary'>
                        commentary
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != dktime'>
                        #{dktime},
                        </if>
                        <if test ='null != lon'>
                        #{lon},
                        </if>
                        <if test ='null != lat'>
                        #{lat},
                        </if>
                        <if test ='null != address'>
                        #{address},
                        </if>
                        <if test ='null != results'>
                        #{results},
                        </if>
                        <if test ='null != userId'>
                        #{userId},
                        </if>
                        <if test ='null != type'>
                        #{type},
                        </if>
                        <if test ='null != status'>
                        #{status},
                        </if>
                        <if test ='null != sort'>
                        #{sort},
                        </if>
                        <if test ='null != cardType'>
                        #{cardType},
                        </if>
                        <if test ='null != mac'>
                        #{mac},
                        </if>
                        <if test ='null != macname'>
                        #{macname},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid},
                        </if>
                        <if test ='null != attdate'>
                        #{attdate},
                        </if>
                        <if test ='null != attime'>
                        #{attime},
                        </if>
                        <if test ='null != dkmxid'>
                        #{dkmxid},
                        </if>
                        <if test ='null != bcid'>
                        #{bcid},
                        </if>
                        <if test ='null != remarks'>
                        #{remarks},
                        </if>
                        <if test ='null != punchmode'>
                        #{punchmode},
                        </if>
                        <if test ='null != punchequipment'>
                        #{punchequipment},
                        </if>
                        <if test ='null != commentary'>
                        #{commentary}
                        </if>
        </trim>
    </insert>

    <delete id="delete" >
        DELETE FROM kqgl_asso_dkjl
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoDkjl">
        UPDATE kqgl_asso_dkjl
        <set>
                    <if test ='null != dktime'>dktime = #{dktime},</if>
                    <if test ='null != lon'>lon = #{lon},</if>
                    <if test ='null != lat'>lat = #{lat},</if>
                    <if test ='null != address'>address = #{address},</if>
                    <if test ='null != results'>results = #{results},</if>
                    <if test ='null != userId'>user_id = #{userId},</if>
                    <if test ='null != type'>type = #{type},</if>
                    <if test ='null != status'>status = #{status},</if>
                    <if test ='null != sort'>sort = #{sort},</if>
                    <if test ='null != cardType'>card_type = #{cardType},</if>
                    <if test ='null != mac'>mac = #{mac},</if>
                    <if test ='null != macname'>macname = #{macname},</if>
                    <if test ='null != qyid'>qyid = #{qyid},</if>
                    <if test ='null != attdate'>attdate = #{attdate},</if>
                    <if test ='null != attime'>attime = #{attime},</if>
                    <if test ='null != dkmxid'>dkmxid = #{dkmxid},</if>
                    <if test ='null != bcid'>bcid = #{bcid},</if>
                    <if test ='null != remarks'>remarks = #{remarks},</if>
                    <if test ='null != punchmode'>punchmode = #{punchmode},</if>
                    <if test ='null != punchequipment'>punchequipment = #{punchequipment},</if>
                    <if test ='null != commentary'>commentary = #{commentary}</if>
        </set>
        WHERE id = #{id}
    </update>


    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM kqgl_asso_dkjl
        WHERE id = #{id}
    </select>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM kqgl_asso_dkjl
        LIMIT #{offset}, #{pageSize}
    </select>

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM kqgl_asso_dkjl
    </select>

	 -->

</mapper>