944 lines
45 KiB
XML
944 lines
45 KiB
XML
<?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.bonus.gzrn.rnbmw.person.dao.FaceContrastDao">
|
|
|
|
<select id="getWorkAttendanceList" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT a.* FROM (
|
|
SELECT b.* FROM (
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
IF(bwah.EXIT_TIME is NULL, 1,0) as isJob,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and bwah.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
<if test="params.subId !=null and params.subId !=''">
|
|
and bwah.SUB_ID=#{params.subId}
|
|
</if>
|
|
<if test="params.workerName !=null and params.workerName !=''">
|
|
and bw.name like concat ('%',#{params.workerName},'%')
|
|
</if>
|
|
UNION
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
IF(bwah.EXIT_TIME is NULL, 1,0) as isJob,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
left join fc_face_contrast ffc on ffc.ID_NUMBER = bwah.ID_NUMBER AND bwah.PROJECT_ID = ffc.PRO_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
and ffc.CURRENT_DAY BETWEEN #{params.startTime} AND #{params.endTime}
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and ffc.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
<if test="params.subId !=null and params.subId !=''">
|
|
and bwah.SUB_ID=#{params.subId}
|
|
</if>
|
|
<if test="params.workerName !=null and params.workerName !=''">
|
|
and bw.name like concat ('%',#{params.workerName},'%')
|
|
</if>
|
|
)b
|
|
<where>
|
|
<if test="params.isJob !=null and params.isJob!='' ">
|
|
and b.isJob = #{params.isJob}
|
|
</if>
|
|
</where>
|
|
ORDER BY b.EIN_TIME DESC
|
|
)a
|
|
GROUP BY a.idNumber,a.proId
|
|
limit #{offset}, #{limit}
|
|
|
|
</select>
|
|
|
|
<select id="getWorkAttendanceCount" resultType="java.lang.Integer">
|
|
select count(1) as num
|
|
from
|
|
(
|
|
SELECT a.* FROM (
|
|
SELECT b.* FROM (
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
IF(bwah.EXIT_TIME is NULL, 1,0) as isJob,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and bwah.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
<if test="params.subId !=null and params.subId !=''">
|
|
and bwah.SUB_ID=#{params.subId}
|
|
</if>
|
|
<if test="params.workerName !=null and params.workerName !=''">
|
|
and bw.name like concat ('%',#{params.workerName},'%')
|
|
</if>
|
|
UNION
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
IF(bwah.EXIT_TIME is NULL, 1,0) as isJob,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
left join fc_face_contrast ffc on ffc.ID_NUMBER = bwah.ID_NUMBER AND bwah.PROJECT_ID = ffc.PRO_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
and ffc.CURRENT_DAY BETWEEN #{params.startTime} AND #{params.endTime}
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and ffc.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
<if test="params.subId !=null and params.subId !=''">
|
|
and bwah.SUB_ID=#{params.subId}
|
|
</if>
|
|
<if test="params.workerName !=null and params.workerName !=''">
|
|
and bw.name like concat ('%',#{params.workerName},'%')
|
|
</if>
|
|
)b
|
|
<where>
|
|
<if test="params.isJob !=null and params.isJob!='' ">
|
|
and b.isJob = #{params.isJob}
|
|
</if>
|
|
</where>
|
|
ORDER BY b.EIN_TIME DESC
|
|
)a
|
|
GROUP BY a.idNumber,a. proId
|
|
) res
|
|
|
|
|
|
</select>
|
|
|
|
<select id="getWorkerAttendanceInfo" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT a.* FROM (
|
|
SELECT b.* FROM (
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and bwah.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
UNION
|
|
SELECT DISTINCT
|
|
if(bwah.`NAME` is null,'',bwah.`NAME`) as name,bwah.ID_NUMBER as idNumber,
|
|
sdd.`name` as postName,pc.org_name as orgName,bp.name as proName,bp.status,
|
|
bs.SUB_NAME as subName,bst.`NAME` as teamName,pc.id as orgId,bwah.PROJECT_ID as proId,bwah.EIN_TIME
|
|
FROM bm_worker_attend_history bwah
|
|
left join bm_worker bw on bw.id_number = bwah.id_number
|
|
LEFT JOIN sys_dic_detail sdd ON sdd.id=bwah.POST_ID
|
|
LEFT JOIN bm_subcontractor bs ON bs.id=bwah.SUB_ID
|
|
LEFT JOIN bm_sub_team bst ON bst.id=bwah.TEAM_ID
|
|
left join fc_face_contrast ffc on ffc.ID_NUMBER = bwah.ID_NUMBER AND bwah.PROJECT_ID = ffc.PRO_ID
|
|
LEFT JOIN bm_project bp ON bp.id=bwah.PROJECT_ID
|
|
LEFT JOIN pm_company pc ON pc.id=bp.company_id
|
|
WHERE bwah.IS_ACTIVE='1' and bw.IS_ACTIVE='1'
|
|
and ffc.CURRENT_DAY BETWEEN #{params.startTime} AND #{params.endTime}
|
|
<![CDATA[
|
|
and IF(bwah.EXIT_TIME IS NOT NULL AND bwah.EXIT_TIME != '',(LEFT(bwah.EIN_TIME,10) <= #{params.endTime} and LEFT(bwah.EIN_TIME,10) >= #{params.startTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) <= #{params.endTime}
|
|
or LEFT(bwah.EIN_TIME,10) <= #{params.startTime} and LEFT(bwah.EXIT_TIME,10) >=#{params.startTime} and LEFT(bwah.EXIT_TIME,10) >= #{params.endTime}),LEFT(bwah.EIN_TIME,10) <= #{params.endTime})
|
|
]]>
|
|
<if test="params.companyId!=null and params.companyId!='' ">
|
|
and pc.ID =#{params.companyId}
|
|
</if>
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and pc.ID =#{params.companyIds}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
and bp.ID=#{params.proId}
|
|
</if>
|
|
<if test="params.name !=null and params.name !=''">
|
|
and bwah.name like concat ('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and ffc.ID_NUMBER=#{params.idNumber}
|
|
</if>
|
|
<if test="params.teamName !=null and params.teamName !=''">
|
|
and bst.name like concat ('%',#{params.teamName},'%')
|
|
</if>
|
|
<if test="params.orgName !=null and params.orgName !=''">
|
|
and pc.org_name=#{params.orgName}
|
|
</if>
|
|
<if test="params.proName !=null and params.proName !=''">
|
|
and bp.name=#{params.proName}
|
|
</if>
|
|
<if test="params.subName !=null and params.subName !=''">
|
|
and bs.sub_name=#{params.subName}
|
|
</if>
|
|
<if test="params.status !=null and params.status !=''">
|
|
and bp.status=#{params.status}
|
|
</if>
|
|
)b
|
|
ORDER BY b.EIN_TIME DESC
|
|
)a
|
|
GROUP BY a.idNumber,a. proId
|
|
</select>
|
|
|
|
|
|
<select id="exportWorkerAttendance" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT ffc.ID_NUMBER as idNumber,ffc.CURRENT_DAY as currentDay,bp.ID as proId
|
|
FROM fc_face_contrast ffc
|
|
LEFT JOIN bm_project bp ON bp.id=ffc.PRO_ID
|
|
LEFT JOIN bm_worker_record bwr ON bwr.ID_NUMBER=ffc.ID_NUMBER
|
|
LEFT JOIN bm_worker bw ON bw.ID_NUMBER= bwr.ID_NUMBER
|
|
WHERE ffc.is_active='1' AND ffc.AUDIT_STATUS='1' AND bwr.IS_ACTIVE='1' AND bwr.examine_status='1'
|
|
AND ffc.CURRENT_DAY BETWEEN #{startTime} AND #{endTime}
|
|
<if test="name !=null and name !=''">
|
|
AND bw.name=#{name}
|
|
</if>
|
|
<if test="companyId !=null and companyId !=''">
|
|
AND bp.company_Id=#{companyId}
|
|
</if>
|
|
<if test="proId !=null and proId !=''">
|
|
AND ffc.PRO_ID=#{proId}
|
|
</if>
|
|
<if test="idNumber !=null and idNumber !=''">
|
|
AND ffc.ID_NUMBER=#{idNumber}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 获取人员考勤某日详情 -->
|
|
<select id="findImg" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT *
|
|
FROM (SELECT su.USERNAME as name, ffc.PHOTO_PATH as photoPath, ffc.ADD_TIME as addTime,
|
|
ffc.CURRENT_DAY as currentDay, ffc.upload_time as uploadTime
|
|
FROM fc_face_contrast ffc
|
|
LEFT JOIN sys_user su ON su.id=ffc.USER_ID
|
|
WHERE ffc.is_active = '1'
|
|
and ffc.CURRENT_DAY BETWEEN #{startTime} AND #{endTime}
|
|
AND ffc.PRO_ID = #{proId}
|
|
and ffc.ID_NUMBER = #{idNumber}
|
|
order BY ffc.ADD_TIME desc limit 10000
|
|
) a
|
|
GROUP BY a.currentDay
|
|
</select>
|
|
|
|
|
|
<!-- 获取单个人员考勤信息集合 -->
|
|
<select id="getWorkerAttendanceOne" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT a.* FROM (
|
|
SELECT
|
|
ffc.id,
|
|
ffc.USER_ID as userId,
|
|
ffc.ID_NUMBER as idNumber,
|
|
ffc.PRO_ID as proId,
|
|
ffc.name,
|
|
bp.name as proName,
|
|
ffc.CURRENT_DAY as currentDay,
|
|
if(ffc.IS_SUCCESS =0,'未打卡','已打卡') as success,
|
|
ffc.WORK_HOURS as workHours,
|
|
ffc.OVER_HOURS as overHours,
|
|
CASE ffc.AUDIT_STATUS WHEN '0' THEN '待审核' WHEN '1' THEN '有效' WHEN '2' THEN'无效' END as auditStatus,
|
|
u.USERNAME as AUDITOR,
|
|
ffc.AUDITOR as auditorId,
|
|
ffc.AUDIT_TIME as auditTime,
|
|
ffc.AUDIT_REMARK as auditRemark,
|
|
ffc.lon,
|
|
ffc.lat,
|
|
ffc.ADD_TIME as addTime
|
|
FROM fc_face_contrast ffc
|
|
LEFT JOIN bm_project bp ON bp.id=ffc.PRO_ID
|
|
LEFT JOIN sys_user u ON u.id=ffc.AUDITOR
|
|
WHERE ffc.is_active='1'
|
|
AND ffc.CURRENT_DAY = #{params.currentDay}
|
|
AND ffc.PRO_ID=#{params.proId}
|
|
and ffc.ID_NUMBER=#{params.idNumber} AND ffc.AUDIT_STATUS = '1'
|
|
GROUP BY ffc.ADD_TIME desc
|
|
ORDER BY ffc.ADD_TIME DESC
|
|
)a
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<!-- 获取人员考勤某日详情 -->
|
|
<select id="getWorkerAttendanceCurrentDay" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT a.* FROM (
|
|
SELECT ffc.CURRENT_DAY as currentDay,
|
|
CASE ffc.AUDIT_STATUS WHEN '0' THEN '待审核' WHEN '1' THEN '有效' WHEN '2' THEN '无效' END as auditStatus
|
|
FROM fc_face_contrast ffc
|
|
WHERE ffc.is_active = '1'
|
|
AND ffc.CURRENT_DAY BETWEEN #{startTime} AND #{endTime}
|
|
AND ffc.PRO_ID = #{proId}
|
|
and ffc.ID_NUMBER = #{idNumber}
|
|
GROUP BY ffc.ADD_TIME desc
|
|
)a
|
|
GROUP BY a.currentDay desc
|
|
</select>
|
|
|
|
<!-- 获取人员考勤某日详情 -->
|
|
<select id="getNameByIdNumber" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT ffc.NAME as name
|
|
FROM fc_face_contrast ffc
|
|
WHERE ffc.ID_NUMBER = #{idNumber} limit 1
|
|
</select>
|
|
<select id="getWorkDay" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select *
|
|
from fc_face_contrast
|
|
where CURRENT_DAY = #{currentDay}
|
|
and ID_NUMBER = #{idNumber}
|
|
and PRO_ID = #{proId} AND AUDIT_STATUS = 1
|
|
order by ADD_TIME desc limit 1
|
|
</select>
|
|
<select id="getProName" resultType="java.lang.String">
|
|
select name as proName
|
|
from bm_project
|
|
where ID = #{proId}
|
|
</select>
|
|
<select id="getWorkData" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select bwr.ID_NUMBER,
|
|
ffc.WORK_HOURS as kqCounts,
|
|
ffc.OVER_HOURS as jbCounts,
|
|
bwr.PROJECT_ID as proId
|
|
from bm_worker_record bwr
|
|
LEFT JOIN fc_face_contrast ffc ON ffc.ID_NUMBER = bwr.ID_NUMBER
|
|
where ffc.PRO_ID = #{proId}
|
|
and bwr.ID_NUMBER = #{idNumber}
|
|
and ffc.CURRENT_DAY = #{time}
|
|
and bwr.IS_ACTIVE = '1'
|
|
AND bwr.examine_status = '1'
|
|
AND ffc.AUDIT_STATUS = '1'
|
|
AND ffc.is_active = '1'
|
|
order by ffc.ADD_TIME desc limit 1
|
|
</select>
|
|
<select id="getProNum" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select count(1) as num
|
|
from (
|
|
select DISTINCT PRO_ID
|
|
from fc_face_contrast
|
|
where ID_NUMBER =
|
|
#{idNumber}
|
|
and CURRENT_DAY
|
|
BETWEEN
|
|
#{sTime}
|
|
AND
|
|
#{eTime}
|
|
) res
|
|
</select>
|
|
<select id="getEinAndExit" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select EIN_TIME as einTime,EXIT_TIME as exitTime from bm_worker_attend_history
|
|
where ID_NUMBER = #{idNumber} and PROJECT_ID = #{proId}
|
|
order by EIN_TIME desc -- limit 1
|
|
</select>
|
|
<!-- 查询当天最新的未审核的考勤 -->
|
|
<select id="getWorkerAttendanceOne2" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT a.* FROM (
|
|
SELECT ffc.id,ffc.USER_ID as userId, ffc.ID_NUMBER as idNumber, ffc.PRO_ID as proId,
|
|
ffc.name,bp.name as proName,ffc.CURRENT_DAY as currentDay,
|
|
if(ffc.IS_SUCCESS =0,'未打卡','已打卡') as success,
|
|
ffc.WORK_HOURS as workHours,ffc.OVER_HOURS as overHours,
|
|
CASE ffc.AUDIT_STATUS WHEN '0' THEN '待审核' WHEN '1' THEN '有效' WHEN '2' THEN'无效' END as auditStatus,
|
|
u.USERNAME as AUDITOR,ffc.AUDIT_TIME as auditTime,ffc.AUDIT_REMARK as auditRemark,ffc.lon,ffc.lat,ffc.ADD_TIME as addTime
|
|
FROM fc_face_contrast ffc
|
|
LEFT JOIN bm_project bp ON bp.id=ffc.PRO_ID
|
|
LEFT JOIN sys_user u ON u.id=ffc.AUDITOR
|
|
WHERE ffc.is_active='1' AND ffc.CURRENT_DAY = #{bean.currentDay}
|
|
AND ffc.PRO_ID=#{bean.proId}
|
|
and ffc.ID_NUMBER=#{bean.idNumber}
|
|
GROUP BY ffc.ADD_TIME desc
|
|
ORDER BY ffc.ADD_TIME DESC
|
|
)a
|
|
LIMIT 1
|
|
</select>
|
|
<!-- 根据身份证ID、工程查询出入场日期 -->
|
|
<select id="getTimeById" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT
|
|
left(bwah.EIN_TIME,10) AS einTime,
|
|
left(bwah.EXIT_TIME,10) AS exitTime,
|
|
bwah.ID_NUMBER AS idNumber
|
|
FROM
|
|
bm_worker_attend_history bwah
|
|
WHERE bwah.PROJECT_ID = #{proId}
|
|
AND bwah.ID_NUMBER = #{idNumber}
|
|
ORDER BY bwah.EIN_TIME asc
|
|
</select>
|
|
<!-- 根据身份证ID查询有考勤记录的日期 -->
|
|
<select id="getCurrentDayByIdNum" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT
|
|
ffc.CURRENT_DAY currentDay
|
|
FROM
|
|
fc_face_contrast ffc
|
|
WHERE
|
|
ffc.ID_NUMBER = #{idNumber}
|
|
<if test="einTime !=null and einTime !=''">
|
|
AND ffc.CURRENT_DAY >= #{einTime}
|
|
</if>
|
|
<if test="exitTime !=null and exitTime !=''">
|
|
<![CDATA[
|
|
AND ffc.CURRENT_DAY <= #{exitTime}
|
|
]]>
|
|
</if>
|
|
GROUP BY ffc.CURRENT_DAY
|
|
ORDER BY ffc.CURRENT_DAY
|
|
</select>
|
|
<select id="getWorkDay2" parameterType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select AUDIT_STATUS as auditStatus
|
|
from fc_face_contrast
|
|
where CURRENT_DAY = #{currentDay}
|
|
and ID_NUMBER = #{idNumber}
|
|
and PRO_ID = #{proId}
|
|
order by ADD_TIME desc limit 1
|
|
</select>
|
|
<select id="getEinAndExitDate" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
select SUBSTR(EIN_TIME,1,10) as einTime,SUBSTR(EXIT_TIME,1,10) as exitTime from bm_worker_attend_history
|
|
where ID_NUMBER = #{idNumber} and PROJECT_ID = #{proId}
|
|
order by EIN_TIME asc
|
|
</select>
|
|
|
|
<select id="getOrderTimeWorkData" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT
|
|
bwr.ID_NUMBER,
|
|
sum( ffc.WORK_HOURS ) AS kqCounts,
|
|
sum( ffc.OVER_HOURS ) AS jbCounts
|
|
FROM
|
|
bm_worker_record bwr
|
|
INNER JOIN (
|
|
SELECT ID_NUMBER, CURRENT_DAY, PRO_ID, WORK_HOURS, OVER_HOURS
|
|
FROM fc_face_contrast
|
|
WHERE AUDIT_STATUS = '1'
|
|
AND is_active = '1'
|
|
and PRO_ID = #{proId}
|
|
AND CURRENT_DAY BETWEEN #{einTime} AND #{exitTime}
|
|
GROUP BY ID_NUMBER, CURRENT_DAY
|
|
) ffc ON ffc.ID_NUMBER = bwr.ID_NUMBER
|
|
WHERE
|
|
bwr.ID_NUMBER = #{idNumber}
|
|
AND bwr.IS_ACTIVE = '1'
|
|
AND bwr.examine_status = '1'
|
|
GROUP BY
|
|
ffc.ID_NUMBER
|
|
</select>
|
|
|
|
<select id="getWorkNumberCount" resultType="java.lang.Integer">
|
|
select count(1) from (
|
|
SELECT
|
|
bp.id,
|
|
bp.name as proName,
|
|
count(ffc.id) as workNum,
|
|
CURRENT_DAY
|
|
FROM
|
|
bm_project bp
|
|
LEFT JOIN fc_face_contrast ffc ON bp.ID = ffc.PRO_ID and ffc.IS_ACTIVE = '1'
|
|
where bp.is_active = '1' and CURRENT_DAY BETWEEN #{params.startTime} and #{params.endTime}
|
|
<if test="params.status !=null and params.status !=''">
|
|
AND bp.status = #{params.status}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
AND bp.id = #{params.proId}
|
|
</if>
|
|
GROUP BY CURRENT_DAY
|
|
) a
|
|
|
|
</select>
|
|
|
|
<select id="getWorkNumberList" resultType="com.bonus.gzrn.rnbmw.person.entity.WorkNumberBean">
|
|
SELECT *,count(idNumber) as workNum from (
|
|
SELECT
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
bp.id as proId,
|
|
bp.name as proName,
|
|
</if>
|
|
<if test="params.proId ==null || params.proId ==''">
|
|
'0' as proId,
|
|
'全部工程' as proName,
|
|
</if>
|
|
#{params.allNum} as entranceNum,
|
|
ffc.ID_NUMBER as idNumber,
|
|
CURRENT_DAY as `time`
|
|
FROM
|
|
bm_project bp
|
|
LEFT JOIN fc_face_contrast ffc ON bp.ID = ffc.PRO_ID and ffc.IS_ACTIVE = '1'
|
|
where bp.is_active = '1' and CURRENT_DAY BETWEEN #{params.startTime} and #{params.endTime}
|
|
<if test="params.status !=null and params.status !=''">
|
|
AND bp.status = #{params.status}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
AND bp.id = #{params.proId}
|
|
</if>
|
|
GROUP BY ffc.CURRENT_DAY,ffc.ID_NUMBER
|
|
)aa
|
|
GROUP BY aa.`time`
|
|
limit #{offset}, #{limit}
|
|
</select>
|
|
|
|
<select id="getAllWorkList" resultType="java.lang.Integer">
|
|
SELECT
|
|
count( 1 )
|
|
FROM
|
|
bm_worker_record bwr
|
|
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bwr.ID_NUMBER and bw.is_active = '1'
|
|
LEFT JOIN bm_project bp ON bp.ID = bwr.PROJECT_ID and bp.is_active = '1'
|
|
WHERE bwr.IS_ACTIVE = '1'
|
|
AND bwr.ein_status = '1'
|
|
and bw.name is not null
|
|
<if test="params.status !=null and params.status !=''">
|
|
AND bp.status = #{params.status}
|
|
</if>
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
AND bp.id = #{params.proId}
|
|
</if>
|
|
</select>
|
|
<select id="getWorkNumberListByCurrentDayCount" resultType="java.lang.Integer">
|
|
select count(1) from(
|
|
SELECT
|
|
bw.ID_NUMBER as idNumber
|
|
FROM
|
|
bm_worker_record bwr
|
|
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bwr.ID_NUMBER and bw.is_active = '1'
|
|
LEFT JOIN bm_project bp on bwr.PROJECT_ID = bp.id and bp.IS_ACTIVE = '1'
|
|
LEFT JOIN sys_dic_detail sdd on sdd.id = bwr.POST_ID and sdd.dic_type = '3' and sdd.is_active = '1'
|
|
LEFT JOIN bm_subcontractor bs on bwr.SUB_ID = bs.ID and bs.is_active = '1'
|
|
LEFT JOIN bm_sub_team bst on bst.id = bwr.TEAM_ID and bst.is_active = '1'
|
|
LEFT JOIN fc_face_contrast ffc ON bwr.ID_NUMBER = ffc.ID_NUMBER and ffc.IS_ACTIVE = '1'
|
|
<if test="params.startTime !=null and params.startTime !=''">
|
|
AND ffc.CURRENT_DAY = #{params.startTime}
|
|
</if>
|
|
where bwr.ein_status = '1' and bwr.IS_ACTIVE = '1' and bw.name is not null
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
AND bp.id = #{params.proId}
|
|
</if>
|
|
<if test="params.keyWord !=null and params.keyWord !=''">
|
|
AND
|
|
(
|
|
instr(bw.name,#{params.keyWord}) > 0
|
|
or instr(bs.SUB_NAME,#{params.keyWord}) > 0
|
|
or instr(bst.`NAME`,#{params.keyWord}) > 0
|
|
)
|
|
</if>
|
|
GROUP BY bw.ID_NUMBER
|
|
)a
|
|
</select>
|
|
<select id="getWorkNumberListByCurrentDayList"
|
|
resultType="com.bonus.gzrn.rnbmw.person.entity.WorkNumberBean">
|
|
SELECT
|
|
bw.name,
|
|
bw.ID_NUMBER as idNumber,
|
|
bw.phone,
|
|
sdd.`name` as postName,
|
|
bp.`NAME` as proName,
|
|
bs.SUB_NAME as subName,
|
|
bst.`NAME` as teamName,
|
|
IF(ffc.ID_NUMBER is null,'未考勤','已考勤') as att
|
|
FROM
|
|
bm_worker_record bwr
|
|
LEFT JOIN bm_worker bw ON bw.ID_NUMBER = bwr.ID_NUMBER and bw.is_active = '1'
|
|
LEFT JOIN bm_project bp on bwr.PROJECT_ID = bp.id and bp.IS_ACTIVE = '1'
|
|
LEFT JOIN sys_dic_detail sdd on sdd.id = bwr.POST_ID and sdd.dic_type = '3' and sdd.is_active = '1'
|
|
LEFT JOIN bm_subcontractor bs on bwr.SUB_ID = bs.ID and bs.is_active = '1'
|
|
LEFT JOIN bm_sub_team bst on bst.id = bwr.TEAM_ID and bst.is_active = '1'
|
|
LEFT JOIN fc_face_contrast ffc ON bwr.ID_NUMBER = ffc.ID_NUMBER and ffc.IS_ACTIVE = '1'
|
|
<if test="params.startTime !=null and params.startTime !=''">
|
|
AND ffc.CURRENT_DAY = #{params.startTime}
|
|
</if>
|
|
where bwr.ein_status = '1' and bwr.IS_ACTIVE = '1' and bw.name is not null
|
|
<if test="params.proId !=null and params.proId !=''">
|
|
AND bp.id = #{params.proId}
|
|
</if>
|
|
<if test="params.keyWord !=null and params.keyWord !=''">
|
|
AND
|
|
(
|
|
instr(bw.name,#{params.keyWord}) > 0
|
|
or instr(bs.SUB_NAME,#{params.keyWord}) > 0
|
|
or instr(bst.`NAME`,#{params.keyWord}) > 0
|
|
)
|
|
</if>
|
|
GROUP BY bw.ID_NUMBER
|
|
limit #{offset}, #{limit}
|
|
</select>
|
|
<select id="getEinRecordWorker" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT
|
|
bwah.ID_NUMBER AS idNumber,
|
|
bwah.EIN_TIME
|
|
FROM
|
|
(select * from bm_worker_attend_history WHERE is_active = '1'
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and bwah.org_id = #{params.companyIds}
|
|
</if>
|
|
<if test="params.proId != null and params.proId !=''">
|
|
and bwah.project_id = #{params.proId}
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and bwah.ID_NUMBER = #{params.idNumber}
|
|
</if>
|
|
) bwah
|
|
INNER JOIN bm_worker bw ON bw.id_number = bwah.id_number and bw.is_active ='1'
|
|
LEFT JOIN bm_sub_team bst ON bst.id = bwah.TEAM_ID
|
|
WHERE
|
|
bwah.IS_ACTIVE = '1'
|
|
AND bw.IS_ACTIVE = '1'
|
|
GROUP BY
|
|
bwah.id_Number
|
|
</select>
|
|
<select id="getEinExitHistoryByIdNumber" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
SELECT
|
|
bwah.ID_NUMBER as idNumber,
|
|
bwah.EIN_TIME,
|
|
bwah.exit_time
|
|
FROM bm_worker_attend_history bwah
|
|
WHERE bwah.IS_ACTIVE='1'
|
|
and bwah.id_Number = #{idNumber}
|
|
<if test="params.companyIds!=null and params.companyIds!='' ">
|
|
and bwah.org_id = #{params.companyIds}
|
|
</if>
|
|
<if test="params.proId != null and params.proId !=''">
|
|
and bwah.project_id = #{params.proId}
|
|
</if>
|
|
<if test="params.idNumber !=null and params.idNumber !=''">
|
|
and bwah.ID_NUMBER = #{params.idNumber}
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="insertWorkerAttendance">
|
|
insert
|
|
into
|
|
fc_face_contrast
|
|
(
|
|
ID_NUMBER,
|
|
PRO_ID,
|
|
CURRENT_DAY,
|
|
ADD_TIME,
|
|
IS_SUCCESS,
|
|
AUDITOR,
|
|
AUDIT_STATUS,
|
|
AUDIT_TIME,
|
|
WORK_HOURS,
|
|
OVER_HOURS,
|
|
lon,
|
|
lat,
|
|
is_push,
|
|
is_active)
|
|
values(
|
|
#{idNumber},
|
|
#{proId},
|
|
#{currentDay},
|
|
#{addTime},
|
|
#{success},
|
|
#{auditor},
|
|
#{auditStatus},
|
|
#{auditTime},
|
|
#{workHours},
|
|
#{overHours},
|
|
#{lon},
|
|
#{lat},
|
|
'0',
|
|
'1'
|
|
);
|
|
</insert>
|
|
|
|
<update id="updateWorkerAttendance">
|
|
update fc_face_contrast
|
|
set ADD_TIME = #{addTime},
|
|
IS_SUCCESS = #{success},
|
|
AUDITOR = #{auditor},
|
|
AUDIT_STATUS = #{auditStatus},
|
|
AUDIT_TIME = #{auditTime},
|
|
WORK_HOURS = #{workHours},
|
|
OVER_HOURS = #{overHours}
|
|
where ID = #{id} and is_active = 1;
|
|
</update>
|
|
|
|
<insert id="insertWorkerAttendanceHistory">
|
|
insert
|
|
into
|
|
fc_face_contrast_update_history
|
|
(
|
|
id,
|
|
ID_NUMBER,
|
|
PRO_ID,
|
|
CURRENT_DAY,
|
|
ADD_TIME,
|
|
IS_SUCCESS,
|
|
AUDITOR,
|
|
AUDIT_STATUS,
|
|
AUDIT_TIME,
|
|
AUDIT_REMARK,
|
|
WORK_HOURS,
|
|
OVER_HOURS,
|
|
lon,
|
|
lat,
|
|
is_push,
|
|
is_active,
|
|
ORIGINAL_ID)
|
|
values(
|
|
#{id},
|
|
#{idNumber},
|
|
#{proId},
|
|
#{currentDay},
|
|
#{addTime},
|
|
#{success},
|
|
#{auditor},
|
|
#{auditStatus},
|
|
#{auditTime},
|
|
#{auditRemark},
|
|
#{workHours},
|
|
#{overHours},
|
|
#{lon},
|
|
#{lat},
|
|
'0',
|
|
'1',
|
|
#{originalRecordId}
|
|
);
|
|
</insert>
|
|
|
|
<sql id="getWorkerAttendanceUpdateHistoryID">
|
|
select
|
|
ffcuh.id,
|
|
bw.NAME,
|
|
bp.name as proName,
|
|
ffcuh.CURRENT_DAY as currentDay,
|
|
if(ffcuh.IS_SUCCESS = 0,
|
|
'未打卡',
|
|
'已打卡') as success,
|
|
ffcuh.WORK_HOURS as workHours,
|
|
ffcuh.OVER_HOURS as overHours,
|
|
case
|
|
ffcuh.AUDIT_STATUS when '0' then '待审核'
|
|
when '1' then '有效'
|
|
when '2' then '无效'
|
|
end as auditStatus,
|
|
u.USERNAME as AUDITOR,
|
|
ffcuh.AUDIT_TIME as auditTime,
|
|
ffcuh.AUDIT_REMARK as auditRemark,
|
|
ffcuh.lon,
|
|
ffcuh.lat,
|
|
ffcuh.ADD_TIME as addTime,
|
|
ffcuh.ORIGINAL_ID as originalRecordId
|
|
from
|
|
fc_face_contrast_update_history ffcuh
|
|
left join bm_project bp on
|
|
bp.id = ffcuh.PRO_ID
|
|
left join sys_user u on
|
|
u.id = ffcuh.AUDITOR
|
|
left join bm_worker bw on
|
|
ffcuh.ID_NUMBER = bw.ID_NUMBER
|
|
where
|
|
ffcuh.is_active = '1'
|
|
<if test="params.currentDayStart != null and params.currentDayStart != ''">
|
|
and ffcuh.CURRENT_DAY >= #{params.currentDayStart}
|
|
</if>
|
|
<if test="params.currentDayEnd != null and params.currentDayEnd != ''">
|
|
and ffcuh.CURRENT_DAY <= #{params.currentDayEnd}
|
|
</if>
|
|
<if test="params.proId != null and params.proId != ''">
|
|
and ffcuh.PRO_ID = #{params.proId}
|
|
</if>
|
|
<if test="params.auditorName != null and params.auditorName != ''">
|
|
and U.USERNAME like concat('%', #{params.auditorName}, '%')
|
|
</if>
|
|
<if test="params.originalRecordId != null and params.originalRecordId != ''">
|
|
and ffcuh.id = #{params.originalRecordId}
|
|
</if>
|
|
<if test="params.originalRecordId == null or params.originalRecordId == ''">
|
|
and ffcuh.ORIGINAL_ID is not null
|
|
</if>
|
|
order by ffcuh.AUDIT_TIME DESC
|
|
</sql>
|
|
|
|
<select id="getWorkerAttendanceUpdateHistoryCount" resultType="java.lang.Integer">
|
|
select count(*) from (<include refid="getWorkerAttendanceUpdateHistoryID"/>) AS C
|
|
|
|
</select>
|
|
|
|
<select id="getWorkerAttendanceUpdateHistory" resultType="com.bonus.gzrn.rnbmw.person.entity.FaceContrastBean">
|
|
<include refid="getWorkerAttendanceUpdateHistoryID"/>
|
|
limit #{offset}, #{limit}
|
|
</select>
|
|
</mapper> |