<?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.cloud.attendance.dao.AttDayDao">
|
|
|
<!-- 查询 人员 信息 暂不适用 19-03-12 -->
|
<select id="queryPersonByContent" resultType="String" >
|
SELECT id
|
from <include refid="sysuser_database"/>.<include refid="bbperson_database"/>
|
WHERE delFlag != '1'
|
<if test="contentValue != null" >
|
and ( no like concat('%', #{contentValue}, '%') or cardId like concat('%', #{contentValue}, '%') or `name` like concat('%', #{contentValue}, '%') )
|
</if>
|
<if test="identity != null " >
|
and type = #{identity,jdbcType=VARCHAR}
|
</if>
|
<if test="orgId != null" >
|
and orgId = #{orgId,jdbcType =VARCHAR}
|
</if>
|
<if test="gradeValue !=null or classValue != null " >
|
and officeId
|
in (SELECT id
|
FROM <include refid="sysuser_database" />.sys_organization WHERE parentIds like
|
<if test="classValue != null " >
|
concat('%', #{classValue}, '%'))
|
</if>
|
<if test="gradeValue != null and classValue == null" >
|
concat('%', #{gradeValue}, '%'))
|
</if>
|
</if>
|
</select>
|
|
|
<resultMap id="BaseResultMap" type="com.cloud.attendance.model.AttDay">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="orgId" jdbcType="INTEGER" property="orgId" />
|
<result column="employeeId" jdbcType="VARCHAR" property="employeeId" />
|
<result column="employeeName" jdbcType="VARCHAR" property="employeeName" />
|
<result column="signDate" jdbcType="DATE" property="signDate" />
|
<result column="inTime" jdbcType="TIMESTAMP" property="inTime" />
|
<result column="outTime" jdbcType="TIMESTAMP" property="outTime" />
|
<result column="inDeviceId" jdbcType="VARCHAR" property="inDeviceId" />
|
<result column="inDeviceName" jdbcType="VARCHAR" property="inDeviceName" />
|
<result column="outDeviceId" jdbcType="VARCHAR" property="outDeviceId" />
|
<result column="outDeviceName" jdbcType="VARCHAR" property="outDeviceName" />
|
<result column="isNotSign" jdbcType="INTEGER" property="isNotSign" />
|
<result column="isLate" jdbcType="INTEGER" property="isLate" />
|
<result column="isLeaveEarly" jdbcType="INTEGER" property="isLeaveEarly" />
|
<result column="isLeave" jdbcType="INTEGER" property="isLeave" />
|
<result column="isRepair" jdbcType="INTEGER" property="isRepair" />
|
<result column="revJson" jdbcType="CHAR" property="revJson" />
|
<result column="createBy" jdbcType="VARCHAR" property="createBy" />
|
<result column="createDate" jdbcType="TIMESTAMP" property="createDate" />
|
<result column="updateBy" jdbcType="VARCHAR" property="updateBy" />
|
<result column="updateDate" jdbcType="TIMESTAMP" property="updateDate" />
|
<result column="remarks" jdbcType="VARCHAR" property="remarks" />
|
<result column="delFlag" jdbcType="VARCHAR" property="delFlag" />
|
<result column="dayStatus" jdbcType="VARCHAR" property="dayStatus" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
id, orgId, employeeId, employeeName, signDate, inTime, outTime, inDeviceId, inDeviceName,
|
outDeviceId, outDeviceName, isNotSign, isLate, isLeaveEarly, isLeave, isRepair, revJson,
|
createBy, createDate, updateBy, updateDate, remarks, delFlag
|
</sql>
|
|
|
<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from att_day
|
where id = #{id,jdbcType=INTEGER}
|
</select>
|
|
<delete id="deleteById" parameterType="java.lang.Integer">
|
delete from att_day
|
where id = #{id,jdbcType=INTEGER}
|
</delete>
|
|
<insert id="save" parameterType="com.cloud.attendance.model.AttDay">>
|
insert into att_day (orgId, employeeId, employeeName,
|
signDate, inTime, outTime,
|
inDeviceId, inDeviceName, outDeviceId,
|
outDeviceName, isNotSign, isLate,
|
isLeaveEarly, isLeave, isRepair,
|
revJson, createBy, createDate,
|
updateBy, updateDate, remarks,
|
delFlag)
|
values (#{orgId,jdbcType=INTEGER}, #{employeeId,jdbcType=VARCHAR}, #{employeeName,jdbcType=VARCHAR},
|
#{signDate,jdbcType=DATE}, #{inTime,jdbcType=TIMESTAMP}, #{outTime,jdbcType=TIMESTAMP},
|
#{inDeviceId,jdbcType=VARCHAR}, #{inDeviceName,jdbcType=VARCHAR}, #{outDeviceId,jdbcType=VARCHAR},
|
#{outDeviceName,jdbcType=VARCHAR}, #{isNotSign,jdbcType=INTEGER}, #{isLate,jdbcType=INTEGER},
|
#{isLeaveEarly,jdbcType=INTEGER}, #{isLeave,jdbcType=INTEGER}, #{isRepair,jdbcType=INTEGER},
|
#{revJson,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP},
|
#{updateBy,jdbcType=VARCHAR}, #{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
|
#{delFlag,jdbcType=VARCHAR})
|
</insert>
|
<insert id="saveSelective" parameterType="com.cloud.attendance.model.AttDay">
|
insert into att_day
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="orgId != null">
|
orgId,
|
</if>
|
<if test="employeeId != null">
|
employeeId,
|
</if>
|
<if test="employeeName != null">
|
employeeName,
|
</if>
|
<if test="signDate != null">
|
signDate,
|
</if>
|
<if test="inTime != null">
|
inTime,
|
</if>
|
<if test="outTime != null">
|
outTime,
|
</if>
|
<if test="inDeviceId != null">
|
inDeviceId,
|
</if>
|
<if test="inDeviceName != null">
|
inDeviceName,
|
</if>
|
<if test="outDeviceId != null">
|
outDeviceId,
|
</if>
|
<if test="outDeviceName != null">
|
outDeviceName,
|
</if>
|
<if test="isNotSign != null">
|
isNotSign,
|
</if>
|
<if test="isLate != null">
|
isLate,
|
</if>
|
<if test="isLeaveEarly != null">
|
isLeaveEarly,
|
</if>
|
<if test="isLeave != null">
|
isLeave,
|
</if>
|
<if test="isRepair != null">
|
isRepair,
|
</if>
|
<if test="revJson != null">
|
revJson,
|
</if>
|
<if test="createBy != null">
|
createBy,
|
</if>
|
<if test="createDate != null">
|
createDate,
|
</if>
|
<if test="updateBy != null">
|
updateBy,
|
</if>
|
<if test="updateDate != null">
|
updateDate,
|
</if>
|
<if test="remarks != null">
|
remarks,
|
</if>
|
<if test="delFlag != null">
|
delFlag,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="orgId != null">
|
#{orgId,jdbcType=INTEGER},
|
</if>
|
<if test="employeeId != null">
|
#{employeeId,jdbcType=VARCHAR},
|
</if>
|
<if test="employeeName != null">
|
#{employeeName,jdbcType=VARCHAR},
|
</if>
|
<if test="signDate != null">
|
#{signDate,jdbcType=DATE},
|
</if>
|
<if test="inTime != null">
|
#{inTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="outTime != null">
|
#{outTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="inDeviceId != null">
|
#{inDeviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="inDeviceName != null">
|
#{inDeviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="outDeviceId != null">
|
#{outDeviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="outDeviceName != null">
|
#{outDeviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="isNotSign != null">
|
#{isNotSign,jdbcType=INTEGER},
|
</if>
|
<if test="isLate != null">
|
#{isLate,jdbcType=INTEGER},
|
</if>
|
<if test="isLeaveEarly != null">
|
#{isLeaveEarly,jdbcType=INTEGER},
|
</if>
|
<if test="isLeave != null">
|
#{isLeave,jdbcType=INTEGER},
|
</if>
|
<if test="isRepair != null">
|
#{isRepair,jdbcType=INTEGER},
|
</if>
|
<if test="revJson != null">
|
#{revJson,jdbcType=CHAR},
|
</if>
|
<if test="createBy != null">
|
#{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createDate != null">
|
#{createDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
#{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateDate != null">
|
#{updateDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="remarks != null">
|
#{remarks,jdbcType=VARCHAR},
|
</if>
|
<if test="delFlag != null">
|
#{delFlag,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByIdSelective" parameterType="com.cloud.attendance.model.AttDay">
|
update att_day
|
<set>
|
<if test="orgId != null">
|
orgId = #{orgId,jdbcType=INTEGER},
|
</if>
|
<if test="employeeId != null">
|
employeeId = #{employeeId,jdbcType=VARCHAR},
|
</if>
|
<if test="employeeName != null">
|
employeeName = #{employeeName,jdbcType=VARCHAR},
|
</if>
|
<if test="signDate != null">
|
signDate = #{signDate,jdbcType=DATE},
|
</if>
|
<if test="inTime != null">
|
inTime = #{inTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="outTime != null">
|
outTime = #{outTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="inDeviceId != null">
|
inDeviceId = #{inDeviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="inDeviceName != null">
|
inDeviceName = #{inDeviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="outDeviceId != null">
|
outDeviceId = #{outDeviceId,jdbcType=VARCHAR},
|
</if>
|
<if test="outDeviceName != null">
|
outDeviceName = #{outDeviceName,jdbcType=VARCHAR},
|
</if>
|
<if test="isNotSign != null">
|
isNotSign = #{isNotSign,jdbcType=INTEGER},
|
</if>
|
<if test="isLate != null">
|
isLate = #{isLate,jdbcType=INTEGER},
|
</if>
|
<if test="isLeaveEarly != null">
|
isLeaveEarly = #{isLeaveEarly,jdbcType=INTEGER},
|
</if>
|
<if test="isLeave != null">
|
isLeave = #{isLeave,jdbcType=INTEGER},
|
</if>
|
<if test="isRepair != null">
|
isRepair = #{isRepair,jdbcType=INTEGER},
|
</if>
|
<if test="revJson != null">
|
revJson = #{revJson,jdbcType=CHAR},
|
</if>
|
<if test="createBy != null">
|
createBy = #{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createDate != null">
|
createDate = #{createDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateDate != null">
|
updateDate = #{updateDate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="remarks != null">
|
remarks = #{remarks,jdbcType=VARCHAR},
|
</if>
|
<if test="delFlag != null">
|
delFlag = #{delFlag,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
<update id="updateById" parameterType="com.cloud.attendance.model.AttDay">
|
update att_day
|
set orgId = #{orgId,jdbcType=INTEGER},
|
employeeId = #{employeeId,jdbcType=VARCHAR},
|
employeeName = #{employeeName,jdbcType=VARCHAR},
|
signDate = #{signDate,jdbcType=DATE},
|
inTime = #{inTime,jdbcType=TIMESTAMP},
|
outTime = #{outTime,jdbcType=TIMESTAMP},
|
inDeviceId = #{inDeviceId,jdbcType=VARCHAR},
|
inDeviceName = #{inDeviceName,jdbcType=VARCHAR},
|
outDeviceId = #{outDeviceId,jdbcType=VARCHAR},
|
outDeviceName = #{outDeviceName,jdbcType=VARCHAR},
|
isNotSign = #{isNotSign,jdbcType=INTEGER},
|
isLate = #{isLate,jdbcType=INTEGER},
|
isLeaveEarly = #{isLeaveEarly,jdbcType=INTEGER},
|
isLeave = #{isLeave,jdbcType=INTEGER},
|
isRepair = #{isRepair,jdbcType=INTEGER},
|
revJson = #{revJson,jdbcType=CHAR},
|
createBy = #{createBy,jdbcType=VARCHAR},
|
createDate = #{createDate,jdbcType=TIMESTAMP},
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
updateDate = #{updateDate,jdbcType=TIMESTAMP},
|
remarks = #{remarks,jdbcType=VARCHAR},
|
delFlag = #{delFlag,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<!-- 单人每月考情情况-->
|
<resultMap id="BigResultMap" type="com.cloud.attendance.model.AttMouthData" >
|
<result column="perId" property="perId" jdbcType="VARCHAR" />
|
<result column="perName" property="perName" jdbcType="VARCHAR" />
|
<result column="attendValue" property="attendValue" jdbcType="VARCHAR" /> <!--出勤汇总 -->
|
<result column="lateValue" property="lateValue" jdbcType="INTEGER" /> <!-- 迟到汇总-->
|
<result column="leaveEarlyValue" property="leaveEarlyValue" jdbcType="INTEGER"/> <!-- 早退汇总-->
|
<result column="isLeave" property="isLeave" jdbcType="INTEGER"/> <!-- 请假汇总-->
|
<collection property="totalList" ofType="com.cloud.attendance.model.DayStatus" javaType="ArrayList">
|
<result column="dayDate" property="dayDate" jdbcType="DATE" />
|
<result column="detail" property="detail" jdbcType="VARCHAR" />
|
</collection>
|
</resultMap>
|
<sql id="sysuser_database" >
|
sys_user2
|
</sql>
|
<sql id="bbperson_database" >
|
bb_person_base
|
</sql>
|
<!-- 查询单人当月的考勤信息 -->
|
<select id="selectAttDayByUserAndMouth" resultMap="BaseResultMap" >
|
SELECT id,employeeId,employeeName,signDate,inDeviceName,inTime,outDeviceName,outTime,
|
isNotSign,isLate,isLeaveEarly,isLeave,isRepair,
|
(case when(isLate = '1' and isLeaveEarly = '1' ) then '迟到/早退'
|
when(isLate = '1') then '迟到'
|
when(isLeaveEarly = '1' ) then '早退'
|
when(isLeave = '1' ) then '请假'
|
when(isRepair = '1') then '补签'
|
when(isNotSign = '0') then '正常'
|
else '缺勤' end ) dayStatus
|
FROM att_day
|
WHERE date_format(signDate,'%Y-%m')=#{mouthDate,jdbcType=VARCHAR} and employeeId = #{id,jdbcType=INTEGER} and signDate < NOW()
|
ORDER BY signDate ASC
|
</select>
|
|
<!-- 查询 流水记录页面符合要求的人员以便查询es 数据-->
|
<select id="queryPersonById" resultMap="BaseResultMap" >
|
SELECT a.id,a.orgId,a.employeeId,a.employeeName,a.inTime,a.outTime,a.inDeviceName,a.outDeviceName
|
FROM att_day a
|
WHERE date_format(a.inTime,'%Y-%m-%d %H:%i:%s') BETWEEN #{beginTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
|
and a.employeeId=#{id,jdbcType=INTEGER}
|
</select>
|
<!-- 老师或学生 考情情况 se.`name` name,se.gender gender,se.orgId orgId -->
|
<select id="selectAttDayByMouth" resultMap="BigResultMap" >
|
select e.employeeId perId,e.isLeave isLeave,e.isLeaveEarly leaveEarlyValue,e.isLate lateValue,
|
e.isNotSign attendValue,ad.signDate dayDate,
|
(case when(ad.isLate = '1' and ad.isLeaveEarly = '1' ) then '迟到早退'
|
when(ad.isLate = '1') then '迟到'
|
when(ad.isLeaveEarly = '1' ) then '早退'
|
when(ad.isLeave = '1' ) then '请假'
|
when(ad.isRepair = '1') then '补签'
|
when(ad.isNotSign = '0') then '√'
|
else '缺勤' end ) detail
|
from(
|
SELECT ad0.employeeId employeeId,sum(ad0.isLeave) isLeave,sum(ad0.isLeaveEarly) isLeaveEarly,sum(ad0.isLate) isLate ,
|
SUM(case ad0.isNotSign when 0 then 1 else 0 end ) isNotSign
|
FROM att_day ad0
|
WHERE date_format(ad0.signDate,'%Y-%m')=#{mouthDate,jdbcType=VARCHAR} and ad0.delFlag = 0
|
and ad0.employeeId in
|
<foreach collection="personIds" separator="," open="(" close=")" item="userId" index="index" >
|
#{userId,jdbcType=VARCHAR}
|
</foreach>
|
GROUP BY ad0.employeeId
|
)e INNER JOIN att_day ad
|
on e.employeeId = ad.employeeId and date_format(ad.signDate,'%Y-%m')=#{mouthDate,jdbcType=VARCHAR} and ad.delFlag = 0
|
and ad.signDate < NOW()
|
ORDER BY e.employeeId asc,ad.signDate asc
|
</select>
|
|
<!-- 查询 人员 信息 暂不适用 19-03-12 -->
|
<select id="getPersonInfoById" resultType="Map">
|
select id ,name,type,photos,cardId
|
from
|
<include refid="sysuser_database"/>.<include refid="bbperson_database"/> where id = #{perId,jdbcType=VARCHAR}
|
</select>
|
|
<!-- 暂停用-->
|
<insert id="insertEmployData" parameterType="String" >
|
insert into att_day (orgId, employeeId,
|
employeeName,signDate, createBy,
|
createDate)
|
select orgId,id,name,DATE_ADD(date_format(NOW(),'%y-%m-%d'),INTERVAL 1 DAY),#{createBy,jdbcType=VARCHAR},NOW()
|
from <include refid="sysuser_database"/>.<include refid="bbperson_database"/> where delFlag = 0
|
and not exists (select ad.employeeId,
|
ad.employeeName , ad.signDate from att_day ad
|
where ad.signDate = date_format(NOW(),'%y-%m-%d') and ad.employeeId = e2.id )
|
</insert>
|
|
<!-- 启动 添加今日 人员 空数据 暂停用 wp 19-03-12 -->
|
<insert id="startInsertEmployData" parameterType="String" >
|
insert into att_day ( orgId, employeeId,
|
employeeName,signDate, createBy,
|
createDate)
|
select e2.orgId,e2.id,e2.name,
|
<if test="signDate == null" >
|
date_format(NOW(),'%y-%m-%d')
|
</if>
|
<if test="signDate != null" >
|
date_format(#{signDate},'%y-%m-%d')
|
</if>
|
,#{createBy,jdbcType=VARCHAR},NOW()
|
from <include refid="sysuser_database"/>.<include refid="bbperson_database"/> e2 where e2.delFlag = 0
|
and not exists (select ad.employeeId,
|
ad.employeeName , ad.signDate
|
from att_day ad
|
where
|
<if test="signDate == null" >
|
ad.signDate = date_format(NOW(),'%y-%m-%d')
|
</if>
|
<if test="signDate != null" >
|
ad.signDate = date_format(#{signDate},'%y-%m-%d')
|
</if> )
|
</insert>
|
|
<!-- 查询人员考勤当天人员id集合 wp 19-03-12 -->
|
<select id="selectPersonByDate" resultType="String" >
|
select employeeId
|
from att_day
|
where
|
<if test="signDate == null" >
|
signDate = date_format(NOW(),'%y-%m-%d')
|
</if>
|
<if test="signDate != null" >
|
signDate = date_format(#{signDate},'%y-%m-%d')
|
</if>
|
</select>
|
|
<!-- 定时 每天 添加 es 人员 的空数据 只用作考勤测试 废弃 -->
|
<insert id="insertEsPerson" parameterType="com.cloud.attendance.model.PersonForEs" >
|
insert into <include refid="sysuser_database"/>.<include refid="bbperson_database"/> ( id,orgId, officeId,
|
name, gender, type,photos,createBy,
|
createTime, updateBy, updateTime)
|
values
|
( #{pid,jdbcType=INTEGER},#{orgId,jdbcType=INTEGER}, #{officeId,jdbcType=INTEGER},
|
#{name,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
#{photos,jdbcType=VARCHAR},#{createBy,jdbcType=VARCHAR},
|
<if test="createTime==null" >
|
NOW()
|
</if>
|
<if test="createTime!=null" >
|
#{createTime,jdbcType=TIMESTAMP}
|
</if>
|
, #{createBy,jdbcType=VARCHAR}, NOW()
|
) /*where
|
not exists (select ad.employeeId,
|
ad.employeeName,ad.signDate
|
from att_day ad
|
where ad.signDate = date_format(NOW(),'%y-%m-%d') )*/
|
</insert>
|
|
|
<!-- 定时 每天 添加参数传递 的空数据 启动也可以动-->
|
<!-- BbEmployee 字段 orgId userId userName -->
|
<insert id="insertMoreData" parameterType="java.util.List" >
|
insert into att_day ( orgId, employeeId,
|
employeeName, signDate, createBy,
|
createDate, updateBy, updateDate)
|
values
|
<foreach collection="attDays" index="index" item="item" open="(" separator="),(" close=")">
|
#{item.orgId,jdbcType=INTEGER}, #{item.id,jdbcType=INTEGER},
|
#{item.userName,jdbcType=VARCHAR},
|
<if test=" signDate == null" >
|
date_format(NOW(),'%y-%m-%d'),
|
</if>
|
<if test=" signDate != null" >
|
date_format(#{signDate},'%y-%m-%d'),
|
</if>
|
#{item.createBy,jdbcType=VARCHAR},
|
<if test="createTime==null" >
|
NOW(),
|
</if>
|
<if test="createTime!=null" >
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
#{item.updateBy,jdbcType=VARCHAR},
|
<if test="updateTime==null" >
|
NOW()
|
</if>
|
<if test="updateTime!=null" >
|
#{updateTime,jdbcType=TIMESTAMP}
|
</if>
|
</foreach>
|
</insert>
|
<!-- 定时 每天每5分钟 更新所有人 的考勤数据-->
|
<update id="updateByMorePerId" parameterType="java.util.List">
|
<foreach collection="list" item="attDay" separator=";">
|
update att_day
|
set
|
inTime = #{attDay.inTime,jdbcType=TIMESTAMP},
|
outTime = #{attDay.outTime,jdbcType=TIMESTAMP},
|
inDeviceId = #{attDay.inDeviceId,jdbcType=VARCHAR},
|
inDeviceName = #{attDay.inDeviceName,jdbcType=VARCHAR},
|
outDeviceId = #{attDay.outDeviceId,jdbcType=VARCHAR},
|
outDeviceName = #{attDay.outDeviceName,jdbcType=VARCHAR},
|
<if test="attDay.isNotSign != null" >
|
isNotSign = #{attDay.isNotSign,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.isLate != null" >
|
isLate = #{attDay.isLate,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.isLeaveEarly != null" >
|
isLeaveEarly = #{attDay.isLeaveEarly,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.isLeave != null" >
|
isLeave = #{attDay.isLeave,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.isRepair != null" >
|
isRepair = #{attDay.isRepair,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.revJson != null" >
|
revJson = #{attDay.revJson,jdbcType=VARCHAR},
|
</if>
|
<if test="attDay.updateBy!=null" >
|
updateBy = #{attDay.updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="attDay.updateTime==null" >
|
updateDate = NOW(),
|
</if>
|
<if test="attDay.updateTime!=null" >
|
updateDate = #{attDay.updateTime,jdbcType=TIMESTAMP},
|
</if>
|
remarks = #{attDay.remarks,jdbcType=VARCHAR},
|
<if test="attDay.delFlag==null" >
|
delFlag = 0
|
</if>
|
<if test="attDay.delFlag!=null" >
|
delFlag = #{attDay.delFlag,jdbcType=INTEGER}
|
</if>
|
where employeeId = #{attDay.employeeId ,jdbcType=VARCHAR} and signDate = date_format( #{attDay.signDate,jdbcType=VARCHAR},'%y-%m-%d')
|
</foreach>
|
</update>
|
|
<!-- 启动 更新所有人 之前所有的考勤数据-->
|
<update id="updateByMoreSourcePerId" parameterType="java.util.List">
|
<foreach collection="list" item="attDay" separator=";">
|
update att_day
|
set inTime =
|
CASE WHEN inTime is NULL THEN #{attDay.inTime,jdbcType=TIMESTAMP}
|
WHEN inTime > #{attDay.inTime,jdbcType=TIMESTAMP} THEN #{attDay.inTime,jdbcType=TIMESTAMP}
|
ELSE inTime END ,
|
outTime = CASE WHEN outTime is NULL THEN #{attDay.outTime,jdbcType=TIMESTAMP}
|
WHEN outTime < #{attDay.outTime,jdbcType=TIMESTAMP} THEN #{attDay.outTime,jdbcType=TIMESTAMP}
|
ELSE outTime END ,
|
inDeviceId =
|
CASE WHEN inTime is NULL THEN #{attDay.inDeviceId,jdbcType=VARCHAR}
|
WHEN inTime > #{attDay.inTime,jdbcType=TIMESTAMP} THEN #{attDay.inDeviceId,jdbcType=VARCHAR}
|
ELSE inDeviceId END,
|
inDeviceName =
|
CASE WHEN inTime is NULL THEN #{attDay.inDeviceName,jdbcType=VARCHAR}
|
WHEN inTime > #{attDay.inTime,jdbcType=TIMESTAMP} THEN #{attDay.inDeviceName,jdbcType=VARCHAR}
|
ELSE inDeviceName END,
|
outDeviceId =
|
CASE WHEN outTime is NULL THEN #{attDay.outDeviceId,jdbcType=VARCHAR}
|
WHEN outTime < #{attDay.outTime,jdbcType=TIMESTAMP} THEN #{attDay.outDeviceId,jdbcType=VARCHAR}
|
ELSE outDeviceId END,
|
outDeviceName =
|
CASE WHEN outTime is NULL THEN #{attDay.outDeviceName,jdbcType=VARCHAR}
|
WHEN outTime < #{attDay.outTime,jdbcType=TIMESTAMP} THEN #{attDay.outDeviceName,jdbcType=VARCHAR}
|
ELSE outDeviceName END,
|
<if test="attDay.isNotSign != null" >
|
isNotSign =
|
CASE WHEN isNotSign is NULL THEN #{attDay.isNotSign,jdbcType=INTEGER}
|
WHEN isNotSign = 0 THEN 0
|
ELSE #{attDay.isNotSign,jdbcType=INTEGER} END,
|
</if>
|
<if test="attDay.isLate != null" >
|
isLate =
|
CASE WHEN isLate is NULL THEN #{attDay.isLate,jdbcType=INTEGER}
|
WHEN isLate = 0 THEN 0
|
ELSE #{attDay.isLate,jdbcType=INTEGER} END,
|
</if>
|
<if test="attDay.isLeaveEarly != null" >
|
isLeaveEarly =
|
CASE WHEN isLeaveEarly is NULL THEN #{attDay.isLeaveEarly,jdbcType=INTEGER}
|
WHEN isLeaveEarly = 0 THEN 0
|
ELSE #{attDay.isLeaveEarly,jdbcType=INTEGER} END,
|
</if>
|
<if test="attDay.isLeave != null" >
|
isLeave = #{attDay.isLeave,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.isRepair != null" >
|
isRepair = #{attDay.isRepair,jdbcType=INTEGER},
|
</if>
|
<if test="attDay.revJson != null" >
|
revJson = #{attDay.revJson,jdbcType=VARCHAR},
|
</if>
|
<if test="attDay.updateBy!=null" >
|
updateBy = #{attDay.updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="attDay.updateTime==null" >
|
updateDate = NOW(),
|
</if>
|
<if test="attDay.updateTime!=null" >
|
updateDate = #{attDay.updateTime,jdbcType=TIMESTAMP},
|
</if>
|
remarks = #{attDay.remarks,jdbcType=VARCHAR},
|
<if test="attDay.delFlag==null" >
|
delFlag = 0
|
</if>
|
<if test="attDay.delFlag!=null" >
|
delFlag = #{attDay.delFlag,jdbcType=INTEGER}
|
</if>
|
where employeeId = #{attDay.employeeId ,jdbcType=VARCHAR} and signDate = date_format( #{attDay.signDate,jdbcType=VARCHAR},'%y-%m-%d')
|
</foreach>
|
</update>
|
|
</mapper>
|