id
, scan_time, staff_name, mobile_phone, identity_type, identity_card, type, sex, store_id, region_id,
state, faces_information, end_type, end_id, end_name, end_time, is_beisen, send_id, send_name, send_time
,email,staff_num,is_zhongkong,send_zhongkong_id,send_zhongkong_name,send_zhongkong_time,beisen_dimission,
beisen_dimission_date,zhongkong_dimission,zhongkong_dimission_date,is_update,zhongkong_dept_id,zhongkong_dept_num,
zhongkong_dept_name,beisen_dept_id,beisen_dept_num,beisen_dept_name,urgent_name,urgent_phone,urgent_relationship,remark
update staff_temporary set ruzhi_time = #{ruzhiTime},type = #{type} where id in
#{id}
update staff_temporary set beisen_dimission = 1,beisen_dimission_date = #{beisenDimissionDate} where id = #{id}
select
from staff_temporary
and id = #{id}
and scan_time = #{scanTime}
and staff_name = #{staffName}
and mobile_phone = #{mobilePhone}
and identity_type = #{identityType}
and identity_card = #{identityCard}
and type = #{type}
and sex = #{sex}
and store_id = #{storeId}
and region_id = #{regionId}
and state = #{state}
and faces_information = #{facesInformation}
and end_type = #{endType}
and end_id = #{endId}
and end_name = #{endName}
and end_time = #{endTime}
and is_beisen = #{isBeisen}
and send_id = #{sendId}
and send_name = #{sendName}
and send_time = #{sendTime}
SELECT DISTINCT staff.* as blackType FROM (
SELECT id,scan_time,is_one,staff_num,staff_name,email,mobile_phone,identity_type,identity_card,type,sex,store_id,
region_id,state,end_type,end_id,end_name,end_time,is_beisen,send_id,send_name,send_time,is_zhongkong,send_zhongkong_id,
send_zhongkong_name,send_zhongkong_time,beisen_dimission,zhongkong_dimission,beisen_dimission_date,zhongkong_dimission_date,
is_update,ruzhi_time,zhongkong_dept_id,zhongkong_dept_num,zhongkong_dept_name,beisen_dept_id,beisen_dept_num,beisen_dept_name,
urgent_name,urgent_phone,urgent_relationship,remark,zhongkong_dimission_type,zhongkong_dimission_reason FROM `staff_temporary` s1
WHERE s1.zhongkong_dept_id IS NOT NULL
AND s1.is_zhongkong = 1
AND s1.zhongkong_dept_id in
#{item}
AND s1.zhongkong_dimission = 1
AND s1.zhongkong_dimission != 1
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
AND s1.mobile_phone = #{mobilePhone}
AND s1.remark LIKE CONCAT('%', #{remark},'%')
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
staff.`ruzhi_time` IS NOT NULL
AND black.type = #{type}
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
AND staff.`ruzhi_time` <= #{lastTime}
AND staff.type =#{job}
AND case when staff.zhongkong_dimission_date is null then staff.end_time else staff.zhongkong_dimission_date end < #{lastTime}
AND case when staff.zhongkong_dimission_date is null then staff.end_time else staff.zhongkong_dimission_date end > #{lastTime}
ORDER BY staff.`ruzhi_time` DESC
SELECT COUNT(0)
FROM (
SELECT DISTINCT staff.* FROM (
SELECT s1.* FROM `staff_temporary` s1
WHERE s1.zhongkong_dept_id IS NOT NULL
AND s1.is_zhongkong = 1
AND s1.zhongkong_dept_id in
#{item}
AND s1.zhongkong_dimission = 1
AND s1.beisen_dimission = 1
AND (
s1.zhongkong_dimission IS NULL
OR s1.zhongkong_dimission = 0
)
AND s1.zhongkong_dimission_date IS NULL
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
AND s1.mobile_phone = #{mobilePhone}
AND s1.remark LIKE CONCAT('%', #{remark},'%')
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
AND staff.staff_num = black.staff_num
black.type = #{type}
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
AND staff.`ruzhi_time` <= #{lastTime}
) AS `staff_temp`
SELECT * FROM `staff_temporary`
WHERE `identity_card` = #{identityCard}
ORDER BY `ruzhi_time` DESC
LIMIT 1
SELECT id, scan_time, staff_name, mobile_phone, identity_type, identity_card, type, sex, store_id, region_id,
state, end_type, end_id, end_name, end_time, is_beisen, send_id, send_name, send_time,
email, staff_num, is_zhongkong, send_zhongkong_id, send_zhongkong_name, send_zhongkong_time, beisen_dimission,
beisen_dimission_date, zhongkong_dimission, zhongkong_dimission_date, is_update, zhongkong_dept_id, zhongkong_dept_num,
zhongkong_dept_name, beisen_dept_id, beisen_dept_num, beisen_dept_name, urgent_name, urgent_phone, urgent_relationship, remark
FROM `staff_temporary`
WHERE (`is_zhongkong` = 1 OR `is_beisen` = 1)
AND DATE(`ruzhi_time`) <= DATE(#{date})
AND (DATE(`end_time`) >= DATE(#{date}) OR `end_time` IS NULL)
AND (DATE(`zhongkong_dimission_date`) >= DATE(#{date}) OR `zhongkong_dimission_date` IS NULL)
AND (DATE(`beisen_dimission_date`) >= DATE(#{date}) OR `beisen_dimission_date` IS NULL)
select staff_num
from staff_temporary_number
where store_id=#{storeId}
and identity_card= #{identityCard}
order by staff_num desc
limit 1
select zhongkong_dept_id as zhongkongDeptId,zhongkong_dept_name as zhongkongDeptName
from staff_temporary where staff_num = #{staffNum} ORDER BY send_zhongkong_time DESC limit 1
SELECT DISTINCT staff.id,staff.scan_time,staff.is_one,staff.type as job,staff.staff_num,staff.staff_name,staff.email,staff.mobile_phone,
staff.identity_type,staff.identity_card,staff.sex,staff.store_id,staff.region_id,staff.state,staff.end_type,staff.end_id,
staff.end_name,staff.end_time,staff.is_beisen,staff.send_id,staff.send_name,staff.send_time,staff.is_zhongkong,
staff.send_zhongkong_id,staff.send_zhongkong_name,staff.send_zhongkong_time,staff.beisen_dimission,
staff.zhongkong_dimission,staff.beisen_dimission_date,staff.zhongkong_dimission_date,staff.is_update,staff.ruzhi_time,
staff.zhongkong_dept_id,staff.zhongkong_dept_num,staff.zhongkong_dept_name,staff.beisen_dept_id,staff.beisen_dept_num,
staff.beisen_dept_name,staff.urgent_name,staff.urgent_phone,staff.urgent_relationship,staff.remark,
staff.zhongkong_dimission_type,staff.zhongkong_dimission_reason,black.type ,black.blacklist_reasons FROM (
SELECT id, scan_time, is_one, staff_num, staff_name, email,type, mobile_phone, identity_type, s1.identity_card, sex, store_id,
region_id, state, end_type, end_id, end_name, end_time, is_beisen, send_id, send_name, send_time, is_zhongkong,
send_zhongkong_id, send_zhongkong_name, send_zhongkong_time, beisen_dimission, zhongkong_dimission,
beisen_dimission_date, zhongkong_dimission_date, is_update, ruzhi_time, zhongkong_dept_id, zhongkong_dept_num,
zhongkong_dept_name, beisen_dept_id, beisen_dept_num, beisen_dept_name, urgent_name, urgent_phone, urgent_relationship,
remark, zhongkong_dimission_type, zhongkong_dimission_reason
FROM `staff_temporary` s1
WHERE s1.zhongkong_dept_id IS NOT NULL
AND s1.is_zhongkong = 1
AND s1.zhongkong_dept_id in
#{item}
AND s1.zhongkong_dimission = 1
AND s1.zhongkong_dimission != 1
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
AND s1.mobile_phone = #{mobilePhone}
AND s1.remark LIKE CONCAT('%', #{remark},'%')
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
staff.`ruzhi_time` IS NOT NULL
AND black.type = #{type}
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
AND staff.`ruzhi_time` <= #{lastTime}
AND staff.type =#{job}
AND DATE(#{lastTime}) > DATE(staff.end_time)
AND (DATE(#{lastTime}) <= DATE(staff.end_time) OR staff.end_time is null)
ORDER BY staff.`ruzhi_time` DESC
select s1.id,s1.scan_time,s1.is_one,s1.staff_num,s1.staff_name,s1.email,s1.mobile_phone,s1.identity_type,s1.identity_card,s1.type,s1.sex,
s1.store_id,s1.region_id,s1.state,s1.end_type,s1.end_id,s1.end_name,s1.end_time,s1.is_beisen,s1.send_id,s1.send_name,
s1.send_time,s1.is_zhongkong,s1.send_zhongkong_id,s1.send_zhongkong_name,s1.send_zhongkong_time,s1.beisen_dimission,
s1.zhongkong_dimission,s1.beisen_dimission_date,s1.zhongkong_dimission_date,s1.is_update,s1.ruzhi_time,s1.zhongkong_dept_id,
s1.zhongkong_dept_num,s1.zhongkong_dept_name,s1.beisen_dept_id,s1.beisen_dept_num,s1.beisen_dept_name,s1.urgent_name,
s1.urgent_phone,s1.urgent_relationship,s1.remark,s1.zhongkong_dimission_type,s1.zhongkong_dimission_reason from staff_temporary s1
inner join (
select identity_card,max(ruzhi_time) max_time from staff_temporary group by identity_card
)s2
on s1.identity_card = s2.identity_card and s1.ruzhi_time = s2.max_time
where s1.identity_card = #{identityCard}
ORDER BY scan_time desc LIMIT 1
delete from staff_temporary where identity_card in
#{idcard}
delete from staff_temporary where id in
#{id}