KqglAssoDkjlMapper.xml 3.24 KB
Newer Older
ilal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?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" />
lal committed
28
                <result column="commentary" property="commentary" />
ilal committed
29 30
    </resultMap>
    
ilal committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    <resultMap id="HolidayInquiryDtoMap" type="cn.timer.api.dto.xcgl.HolidayInquiryDto" >
            <result column="num" property="num" />
            <result column="balance" property="balance" />
    </resultMap>
	
	<select id="TimesBeingLateLeavingEarly" resultMap="HolidayInquiryDtoMap">
		select COUNT(*) as num
			from kqgl_asso_dkjl dkjl 
		where dkjl.qyid = #{qyid}
		and dkjl.sort != 0
		and dkjl.user_id = #{userid}
		<if test="mark == 1" >
			and dkjl.`status` in (3,10,13)
		</if>
		<if test="mark == 2" >
			and dkjl.`status` in (4,11,14)
		</if>
		and SUBSTR(dkjl.attdate,1,5) = #{attdate}
	</select>
	
	<select id="MinutesLateLeaveEarly" resultMap="HolidayInquiryDtoMap">
		select IFNULL(SUM(dkjl.results),0) as balance
			from kqgl_asso_dkjl dkjl 
		where dkjl.qyid = #{qyid}
		and dkjl.sort != 0
		and dkjl.user_id = #{userid}
		<if test="mark == 1" >
			and dkjl.`status` in (3,10,13)
		</if>
		<if test="mark == 2" >
			and dkjl.`status` in (4,11,14)
		</if>
		and SUBSTR(dkjl.attdate,1,5) = #{attdate}
	</select>
	
    
    <select id="LateleaveEarly" resultMap="BaseResultMap">
    	select dkjl.*
			from kqgl_asso_dkjl dkjl 
		where dkjl.qyid = #{qyid}
		and dkjl.sort != 0
		and dkjl.user_id = #{userid}
		and dkjl.`status` in (3,4,10,11,13,14)
		and SUBSTR(dkjl.attdate,1,5) = #{attdate}
    </select>
ilal committed
76

lal committed
77 78 79 80 81
	<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}
ilal committed
82
		and dkjl.status not in (0,2) 
ilal committed
83
		and dkjl.attdate = #{attdate}
ilal committed
84
		and dkjl.qyid = #{qyid}
lal committed
85
  	</select>
ilal committed
86 87

</mapper>