PunchRecordMapper.xml 14.1 KB
Newer Older
yuquan.zhu 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
<?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.kqgl.PunchRecordMapper" >
  <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqgl.PunchRecord" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="dktime" property="dktime" jdbcType="BIGINT" />
    <result column="lon" property="lon" jdbcType="DOUBLE" />
    <result column="lat" property="lat" jdbcType="DOUBLE" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="results" property="results" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="sort" property="sort" jdbcType="INTEGER" />
    <result column="card_type" property="cardType" jdbcType="INTEGER" />
    <result column="macname" property="macname" jdbcType="VARCHAR" />
    <result column="mac" property="mac" jdbcType="VARCHAR" />
    <result column="qyid" property="qyid" jdbcType="INTEGER" />
    <result column="attdate" property="attdate" jdbcType="VARCHAR" />
    <result column="attime" property="attime" jdbcType="BIGINT" />
    <result column="dkmxid" property="dkmxid" jdbcType="INTEGER" />
    <result column="bcid" property="bcid" jdbcType="INTEGER" />
    <result column="remarks" property="remarks" jdbcType="VARCHAR" />
    <result column="punchmode" property="punchmode" jdbcType="INTEGER" />
    <result column="punchequipment" property="punchequipment" jdbcType="VARCHAR" />
lal committed
26
    <result column="commentary" property="commentary" />
yuquan.zhu committed
27 28 29 30 31 32 33 34 35
    
    <result column="username" property="username" jdbcType="VARCHAR" />
    <result column="dept" property="dept" jdbcType="VARCHAR" />
    <result column="post" property="post" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, dktime, lon, lat, address, results, user_id, type, status, sort, card_type, macname, 
    mac, qyid, attdate, attime, dkmxid,bcid,remarks,punchmode,punchequipment
  </sql>
lal committed
36
  
lal committed
37 38 39 40 41 42 43
  <select id="organizationalStructure" resultMap="BaseResultMap">
  	select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
				 where m.id = #{id}
  </select>
  
lal committed
44 45 46 47 48 49
  <select id="QueryOriginalRecord" resultMap="BaseResultMap">
  		select dkjl.*,
  		bmgw.dept,
			 bmgw.post,
			info.`name` username 
		from kqgl_asso_dkjl dkjl
lal committed
50
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{param.qyid}
lal committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		where dkjl.qyid = #{param.qyid}
		<if test="param.start != ''" >
			and dkjl.attime &gt;= #{param.start}
		</if>
		<if test="param.end != ''" >
			and dkjl.attime &lt;= #{param.end}
		</if>
		<if test="param.text != null and param.text != ''" >
			and (info.`name` like CONCAT('%',#{param.text},'%') or info.emp_num = #{param.text})
		</if>
lal committed
65
		ORDER BY dkjl.id DESC
lal committed
66 67
  </select>
  
ilal committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
  <select id="exportQueryOriginalRecord" resultMap="BaseResultMap">
  		select dkjl.*,
  		bmgw.dept,
			 bmgw.post,
			info.`name` username 
		from kqgl_asso_dkjl dkjl
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{param.qyid}
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		where dkjl.qyid = #{param.qyid}
		<if test="param.start != ''" >
			and dkjl.attime &gt;= #{param.start}
		</if>
		<if test="param.end != ''" >
			and dkjl.attime &lt;= #{param.end}
		</if>
		<if test="param.text != null and param.text != ''" >
			and (info.`name` like CONCAT('%',#{param.text},'%') or info.emp_num = #{param.text})
		</if>
		ORDER BY dkjl.id DESC
  </select>
  
lal committed
92
  
yuquan.zhu committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from kqgl_asso_dkjl
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from kqgl_asso_dkjl
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.timer.api.bean.kqgl.PunchRecord" useGeneratedKeys="true" keyProperty="id">
    insert into kqgl_asso_dkjl (dktime, lon, 
      lat, address, results, 
      user_id, type, status, 
      sort, card_type, macname, 
      mac, qyid, attdate, 
      attime, dkmxid,bcid,remarks,punchmode,punchequipment)
    values ( #{dktime,jdbcType=BIGINT}, #{lon,jdbcType=DOUBLE}, 
      #{lat,jdbcType=DOUBLE}, #{address,jdbcType=VARCHAR}, #{results,jdbcType=INTEGER}, 
      #{userId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
      #{sort,jdbcType=INTEGER}, #{cardType,jdbcType=INTEGER}, #{macname,jdbcType=VARCHAR}, 
      #{mac,jdbcType=VARCHAR}, #{qyid,jdbcType=INTEGER}, #{attdate,jdbcType=VARCHAR}, 
      #{attime,jdbcType=BIGINT}, #{dkmxid,jdbcType=INTEGER},#{bcid,jdbcType=INTEGER},#{remarks,jdbcType=VARCHAR},#{punchmode,jdbcType=INTEGER},#{punchequipment,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.timer.api.bean.kqgl.PunchRecord" useGeneratedKeys="true" keyProperty="id">
    insert into kqgl_asso_dkjl
    <trim prefix="(" suffix=")" suffixOverrides="," >
      
      <if test="dktime != null" >
        dktime,
      </if>
      <if test="lon != null" >
        lon,
      </if>
      <if test="lat != null" >
        lat,
      </if>
      <if test="address != null" >
        address,
      </if>
      <if test="results != null" >
        results,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="sort != null" >
        sort,
      </if>
      <if test="cardType != null" >
        card_type,
      </if>
      <if test="macname != null" >
        macname,
      </if>
      <if test="mac != null" >
        mac,
      </if>
      <if test="qyid != null" >
        qyid,
      </if>
      <if test="attdate != null" >
        attdate,
      </if>
      <if test="attime != null" >
        attime,
      </if>
      <if test="dkmxid != null" >
        dkmxid,
      </if>
      <if test="bcid != null" >
        bcid,
      </if>
      <if test="remarks != null" >
        remarks,
      </if>
      <if test="punchmode != null" >
        punchmode,
      </if>
      <if test="punchequipment != null" >
        punchequipment,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      
      <if test="dktime != null" >
        #{dktime,jdbcType=BIGINT},
      </if>
      <if test="lon != null" >
        #{lon,jdbcType=DOUBLE},
      </if>
      <if test="lat != null" >
        #{lat,jdbcType=DOUBLE},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="results != null" >
        #{results,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="type != null" >
        #{type,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        #{status,jdbcType=INTEGER},
      </if>
      <if test="sort != null" >
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="cardType != null" >
        #{cardType,jdbcType=INTEGER},
      </if>
      <if test="macname != null" >
        #{macname,jdbcType=VARCHAR},
      </if>
      <if test="mac != null" >
        #{mac,jdbcType=VARCHAR},
      </if>
      <if test="qyid != null" >
        #{qyid,jdbcType=INTEGER},
      </if>
      <if test="attdate != null" >
        #{attdate,jdbcType=VARCHAR},
      </if>
      <if test="attime != null" >
        #{attime,jdbcType=BIGINT},
      </if>
      <if test="dkmxid != null" >
        #{dkmxid,jdbcType=INTEGER},
      </if>
      <if test="bcid != null" >
        #{bcid,jdbcType=INTEGER},
      </if>
      <if test="remarks != null" >
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="punchmode != null" >
        #{punchmode,jdbcType=INTEGER},
      </if>
      <if test="punchequipment != null" >
        #{punchequipment,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqgl.PunchRecord" >
    update kqgl_asso_dkjl
    <set >
      <if test="dktime != null" >
        dktime = #{dktime,jdbcType=BIGINT},
      </if>
      <if test="lon != null" >
        lon = #{lon,jdbcType=DOUBLE},
      </if>
      <if test="lat != null" >
        lat = #{lat,jdbcType=DOUBLE},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="results != null" >
        results = #{results,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="sort != null" >
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="cardType != null" >
        card_type = #{cardType,jdbcType=INTEGER},
      </if>
      <if test="macname != null" >
        macname = #{macname,jdbcType=VARCHAR},
      </if>
      <if test="mac != null" >
        mac = #{mac,jdbcType=VARCHAR},
      </if>
      <if test="qyid != null" >
        qyid = #{qyid,jdbcType=INTEGER},
      </if>
      <if test="attdate != null" >
        attdate = #{attdate,jdbcType=VARCHAR},
      </if>
      <if test="attime != null" >
        attime = #{attime,jdbcType=BIGINT},
      </if>
      <if test="dkmxid != null" >
        dkmxid = #{dkmxid,jdbcType=INTEGER},
      </if>
      <if test="bcid != null" >
        bcid = #{bcid,jdbcType=INTEGER},
      </if>
      <if test="remarks != null" >
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="punchmode != null" >
        punchmode = #{punchmode,jdbcType=INTEGER},
      </if>
      <if test="punchequipment != null" >
        punchequipment = #{punchequipment,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.kqgl.PunchRecord" >
    update kqgl_asso_dkjl
    set dktime = #{dktime,jdbcType=BIGINT},
      lon = #{lon,jdbcType=DOUBLE},
      lat = #{lat,jdbcType=DOUBLE},
      address = #{address,jdbcType=VARCHAR},
      results = #{results,jdbcType=INTEGER},
      user_id = #{userId,jdbcType=INTEGER},
      type = #{type,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      sort = #{sort,jdbcType=INTEGER},
      card_type = #{cardType,jdbcType=INTEGER},
      macname = #{macname,jdbcType=VARCHAR},
      mac = #{mac,jdbcType=VARCHAR},
      qyid = #{qyid,jdbcType=INTEGER},
      attdate = #{attdate,jdbcType=VARCHAR},
      attime = #{attime,jdbcType=BIGINT},
      dkmxid = #{dkmxid,jdbcType=INTEGER},
      bcid = #{bcid,jdbcType=INTEGER},
      remarks = #{remarks,jdbcType=VARCHAR},
      punchmode = #{punchmode,jdbcType=INTEGER},
      punchequipment = #{punchequipment,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="selectOriginalAttendanceRecord" resultMap="BaseResultMap">
  		select dkjl.*,
  			bmgw.dept,
			 bmgw.post,
			info.`name` username 
		from kqgl_asso_dkjl dkjl
lal committed
343
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER}
yuquan.zhu committed
344 345 346 347 348 349 350 351 352 353 354 355 356 357
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		where dkjl.qyid = #{qyid,jdbcType=INTEGER}
		ORDER BY dkjl.id ASC
  </select>
  
  <select id="selFuzzyOriginalAttendance" resultMap="BaseResultMap">
  		select dkjl.*,
  		bmgw.dept,
			 bmgw.post,
			info.`name` username 
		from kqgl_asso_dkjl dkjl
lal committed
358
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER}
yuquan.zhu committed
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		where dkjl.qyid = #{qyid,jdbcType=INTEGER}
		<if test="start != ''" >
			and dkjl.attime &gt;= #{start,jdbcType=VARCHAR}
		</if>
		<if test="end != ''" >
			and dkjl.attime &lt;= #{end,jdbcType=VARCHAR}
		</if>
		<if test="text != ''" >
			and (info.`name` like CONCAT('%',#{text,jdbcType=VARCHAR},'%') or info.emp_num = #{text,jdbcType=VARCHAR})
		</if>
		ORDER BY dkjl.id ASC
  </select>
  
  <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>
  
  <select id="selectPunchResults" 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.sort = #{sort,jdbcType=INTEGER}
  </select>
  
  <select id="ViewAttendanceDetails" resultMap="BaseResultMap">
  		select * from kqgl_asso_dkjl dkjl
		where dkjl.user_id = #{userId,jdbcType=INTEGER}
		and dkjl.attime &gt;= #{start}
		and dkjl.attime &lt;= #{end}
		and dkjl.`status` != 0
  </select>
  
  <select id="MaintenancePunchCard" 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}
		limit 1
  </select>
  
  <select id="getMaintenancePunchCardList" 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}
413 414
		and dkjl.`status` > 0
		and dkjl.sort > 0
ilal committed
415
		and dkjl.qyid = #{qyid}
416 417
		and dkjl.dkmxid > 0
		and dkjl.id > 0
yuquan.zhu committed
418 419 420 421 422 423
		ORDER BY dkjl.id ASC
  </select>
  
  
  
</mapper>