You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

541 lines
28 KiB
XML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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.ssm.manage.mapper.StaffTemporaryMapper">
<resultMap id="BaseResultMap" type="com.ssm.manage.entity.StaffTemporary">
<result property="id" column="id"/>
<result property="scanTime" column="scan_time"/>
<result property="ruzhiTime" column="ruzhi_time"/>
<result property="staffName" column="staff_name"/>
<result property="mobilePhone" column="mobile_phone"/>
<result property="identityType" column="identity_type"/>
<result property="identityCard" column="identity_card"/>
<result property="type" column="type"/>
<result property="sex" column="sex"/>
<result property="storeId" column="store_id"/>
<result property="regionId" column="region_id"/>
<result property="state" column="state"/>
<result property="facesInformation" column="faces_information"/>
<result property="endType" column="end_type"/>
<result property="endId" column="end_id"/>
<result property="endName" column="end_name"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="isBeisen" column="is_beisen"/>
<result property="sendId" column="send_id"/>
<result property="sendName" column="send_name"/>
<result property="sendTime" column="send_time"/>
<result property="email" column="email"/>
<result property="staffNum" column="staff_num"/>
<result property="isZhongkong" column="is_zhongkong"/>
<result property="sendZhongkongId" column="send_zhongkong_id"/>
<result property="sendZhongkongName" column="send_zhongkong_name"/>
<result property="sendZhongkongTime" column="send_zhongkong_time" jdbcType="TIMESTAMP"/>
<result property="isOne" column="is_one"/>
<result property="beisenDimission" column="beisen_dimission"/>
<result property="beisenDimissionDate" column="beisen_dimission_date"/>
<result property="zhongkongDimission" column="zhongkong_dimission"/>
<result property="zhongkongDimissionDate" column="zhongkong_dimission_date" jdbcType="TIMESTAMP"/>
<result property="isUpdate" column="is_update"/>
<result property="zhongkongDeptId" column="zhongkong_dept_id"/>
<result property="zhongkongDeptNum" column="zhongkong_dept_num"/>
<result property="zhongkongDeptName" column="zhongkong_dept_name"/>
<result property="beisenDeptId" column="beisen_dept_id"/>
<result property="beisenDeptNum" column="beisen_dept_num"/>
<result property="beisenDeptName" column="beisen_dept_name"/>
<result property="urgentName" column="urgent_name"/>
<result property="urgentPhone" column="urgent_phone"/>
<result property="urgentRelationship" column="urgent_relationship"/>
<result property="remark" column="remark"/>
<result property="zhongkongDimissionType" column="zhongkong_dimission_type"/>
<result property="zhongkongDimissionReason" column="zhongkong_dimission_reason"/>
</resultMap>
<resultMap id="BaseResultMap1" type="com.ssm.manage.entity.StaffTemporaryAndBlackList">
<result property="id" column="id"/>
<result property="scanTime" column="scan_time"/>
<result property="ruzhiTime" column="ruzhi_time"/>
<result property="staffName" column="staff_name"/>
<result property="mobilePhone" column="mobile_phone"/>
<result property="identityType" column="identity_type"/>
<result property="identityCard" column="identity_card"/>
<result property="type" column="type"/>
<result property="job" column="job"/>
<result property="sex" column="sex"/>
<result property="storeId" column="store_id"/>
<result property="regionId" column="region_id"/>
<result property="state" column="state"/>
<result property="facesInformation" column="faces_information"/>
<result property="endType" column="end_type"/>
<result property="endId" column="end_id"/>
<result property="endName" column="end_name"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="isBeisen" column="is_beisen"/>
<result property="sendId" column="send_id"/>
<result property="sendName" column="send_name"/>
<result property="sendTime" column="send_time"/>
<result property="email" column="email"/>
<result property="staffNum" column="staff_num"/>
<result property="isZhongkong" column="is_zhongkong"/>
<result property="sendZhongkongId" column="send_zhongkong_id"/>
<result property="sendZhongkongName" column="send_zhongkong_name"/>
<result property="sendZhongkongTime" column="send_zhongkong_time" jdbcType="TIMESTAMP"/>
<result property="isOne" column="is_one"/>
<result property="beisenDimission" column="beisen_dimission"/>
<result property="beisenDimissionDate" column="beisen_dimission_date"/>
<result property="zhongkongDimission" column="zhongkong_dimission"/>
<result property="zhongkongDimissionDate" column="zhongkong_dimission_date" jdbcType="TIMESTAMP"/>
<result property="isUpdate" column="is_update"/>
<result property="zhongkongDeptId" column="zhongkong_dept_id"/>
<result property="zhongkongDeptNum" column="zhongkong_dept_num"/>
<result property="zhongkongDeptName" column="zhongkong_dept_name"/>
<result property="beisenDeptId" column="beisen_dept_id"/>
<result property="beisenDeptNum" column="beisen_dept_num"/>
<result property="beisenDeptName" column="beisen_dept_name"/>
<result property="urgentName" column="urgent_name"/>
<result property="urgentPhone" column="urgent_phone"/>
<result property="urgentRelationship" column="urgent_relationship"/>
<result property="remark" column="remark"/>
<result property="zhongkongDimissionType" column="zhongkong_dimission_type"/>
<result property="zhongkongDimissionReason" column="zhongkong_dimission_reason"/>
<result property="blacklistReasons" column="blacklist_reasons"/>
</resultMap>
<resultMap id="BaseResultMap2" type="com.ssm.manage.entity.StaffTemporary">
<result property="id" column="id"/>
<result property="scanTime" column="scan_time"/>
<result property="ruzhiTime" column="ruzhi_time"/>
<result property="staffName" column="staff_name"/>
<result property="mobilePhone" column="mobile_phone"/>
<result property="identityType" column="identity_type"/>
<result property="identityCard" column="identity_card"/>
<result property="type" column="type"/>
<result property="sex" column="sex"/>
<result property="storeId" column="store_id"/>
<result property="regionId" column="region_id"/>
<result property="state" column="state"/>
<result property="endType" column="end_type"/>
<result property="endId" column="end_id"/>
<result property="endName" column="end_name"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="isBeisen" column="is_beisen"/>
<result property="sendId" column="send_id"/>
<result property="sendName" column="send_name"/>
<result property="sendTime" column="send_time"/>
<result property="email" column="email"/>
<result property="staffNum" column="staff_num"/>
<result property="isZhongkong" column="is_zhongkong"/>
<result property="sendZhongkongId" column="send_zhongkong_id"/>
<result property="sendZhongkongName" column="send_zhongkong_name"/>
<result property="sendZhongkongTime" column="send_zhongkong_time" jdbcType="TIMESTAMP"/>
<result property="isOne" column="is_one"/>
<result property="beisenDimission" column="beisen_dimission"/>
<result property="beisenDimissionDate" column="beisen_dimission_date"/>
<result property="zhongkongDimission" column="zhongkong_dimission"/>
<result property="zhongkongDimissionDate" column="zhongkong_dimission_date" jdbcType="TIMESTAMP"/>
<result property="isUpdate" column="is_update"/>
<result property="zhongkongDeptId" column="zhongkong_dept_id"/>
<result property="zhongkongDeptNum" column="zhongkong_dept_num"/>
<result property="zhongkongDeptName" column="zhongkong_dept_name"/>
<result property="beisenDeptId" column="beisen_dept_id"/>
<result property="beisenDeptNum" column="beisen_dept_num"/>
<result property="beisenDeptName" column="beisen_dept_name"/>
<result property="urgentName" column="urgent_name"/>
<result property="urgentPhone" column="urgent_phone"/>
<result property="urgentRelationship" column="urgent_relationship"/>
<result property="remark" column="remark"/>
<result property="zhongkongDimissionType" column="zhongkong_dimission_type"/>
<result property="zhongkongDimissionReason" column="zhongkong_dimission_reason"/>
</resultMap>
<sql id="Base_Column_List">
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
</sql>
<update id="updateIsUpdateByIds">
update staff_temporary set ruzhi_time = #{ruzhiTime},type = #{type} where id in <foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<update id="updateByBeisenDimissionDate">
update staff_temporary set beisen_dimission = 1,beisen_dimission_date = #{beisenDimissionDate} where id = #{id}
</update>
<select id="queryAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from staff_temporary
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="scanTime != null">
and scan_time = #{scanTime}
</if>
<if test="staffName != null and staffName != ''">
and staff_name = #{staffName}
</if>
<if test="mobilePhone != null and mobilePhone != ''">
and mobile_phone = #{mobilePhone}
</if>
<if test="identityType != null">
and identity_type = #{identityType}
</if>
<if test="identityCard != null and identityCard != ''">
and identity_card = #{identityCard}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="regionId != null">
and region_id = #{regionId}
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="facesInformation != null and facesInformation != ''">
and faces_information = #{facesInformation}
</if>
<if test="endType != null">
and end_type = #{endType}
</if>
<if test="endId != null">
and end_id = #{endId}
</if>
<if test="endName != null and endName != ''">
and end_name = #{endName}
</if>
<if test="endTime != null">
and end_time = #{endTime}
</if>
<if test="isBeisen != null">
and is_beisen = #{isBeisen}
</if>
<if test="sendId != null">
and send_id = #{sendId}
</if>
<if test="sendName != null and sendName != ''">
and send_name = #{sendName}
</if>
<if test="sendTime != null">
and send_time = #{sendTime}
</if>
</where>
</select>
<!--<select id="selectByStaffTemporary" resultMap="BaseResultMap">
select staff.* from ( select s1.* from staff_temporary s1
&#45;&#45; LEFT JOIN staff_temporary s2
&#45;&#45; ON s1.identity_card = s2.identity_card&lt;!&ndash; <if test="isZhongkong!=null and isZhongkong!=1">&ndash;&gt;
&#45;&#45; AND s2.ruzhi_time > s1.ruzhi_time
&lt;!&ndash; </if>&ndash;&gt;
WHERE s1.zhongkong_dept_id is not null and s1.is_zhongkong = 1
<if test="deptIds != null and deptIds.size() > 0">
and s1.zhongkong_dept_id in
<foreach collection="deptIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="isZhongkong!=null and isZhongkong==1">
and s1.zhongkong_dimission = 1
&#45;&#45; and s1.ruzhi_time = s2.ruzhi_time
and s1.beisen_dimission = 1
</if>
<if test="isZhongkong!=null and isZhongkong==0">&#45;&#45; and s2.id IS NULL
and (s1.zhongkong_dimission is null or s1.zhongkong_dimission = 0)
and s1.zhongkong_dimission_date is null
</if>
<if test="staffName!=null">
and s1.staff_name like CONCAT('%', #{staffName},'%')
</if>
<if test="mobilePhone!=null">
and s1.mobile_phone = #{mobilePhone}
</if>
) staff left join black_list black on staff.identity_card = black.identity_card where 1=1
<if test="type!=null">
and black.type = #{type}
</if>
<if test="startTime != null and lastTime != null">
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
</if>
</select>-->
<select id="selectByStaffTemporary" resultMap="BaseResultMap">
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
<if test="deptIds != null and deptIds.size() > 0">
AND s1.zhongkong_dept_id in
<foreach collection="deptIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="lastTime == null and isZhongkong != null and isZhongkong == 1">
AND s1.zhongkong_dimission = 1
<!-- OR s1.beisen_dimission = 1 -->
</if>
<if test="lastTime == null and isZhongkong != null and isZhongkong == 0">
AND s1.zhongkong_dimission != 1
<!-- AND (
s1.zhongkong_dimission IS NULL
OR s1.zhongkong_dimission = 0
) -->
<!-- AND s1.zhongkong_dimission_date IS NULL -->
</if>
<if test="staffName!=null">
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
</if>
<if test="mobilePhone!=null">
AND s1.mobile_phone = #{mobilePhone}
</if>
<if test="remark!=null">
AND s1.remark LIKE CONCAT('%', #{remark},'%')
</if>
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
<!-- AND staff.staff_num = black.staff_num -->
<where>
staff.`ruzhi_time` IS NOT NULL
<if test="type != null">
AND black.type = #{type}
</if>
<if test="startTime != null and lastTime != null">
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
</if>
<!-- 筛选 lastTime 之前的所有记录 -->
<if test="startTime == null and lastTime != null">
AND staff.`ruzhi_time` &lt;= #{lastTime}
</if>
<if test="job!=null">
AND staff.type =#{job}
</if>
<if test="lastTime != null and isZhongkong != null and isZhongkong == 1">
AND case when staff.zhongkong_dimission_date is null then staff.end_time else staff.zhongkong_dimission_date end &lt; #{lastTime}
</if>
<if test="lastTime != null and isZhongkong != null and isZhongkong == 0">
AND case when staff.zhongkong_dimission_date is null then staff.end_time else staff.zhongkong_dimission_date end &gt; #{lastTime}
</if>
</where>
ORDER BY staff.`ruzhi_time` DESC
</select>
<select id="countByStaffTemporary" resultType="java.lang.Long">
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
<if test="deptIds != null and deptIds.size() > 0">
AND s1.zhongkong_dept_id in
<foreach collection="deptIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="isZhongkong != null and isZhongkong == 1">
AND s1.zhongkong_dimission = 1
AND s1.beisen_dimission = 1
</if>
<if test="isZhongkong != null and isZhongkong == 0">
AND (
s1.zhongkong_dimission IS NULL
OR s1.zhongkong_dimission = 0
)
AND s1.zhongkong_dimission_date IS NULL
</if>
<if test="staffName!=null">
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
</if>
<if test="mobilePhone!=null">
AND s1.mobile_phone = #{mobilePhone}
</if>
<if test="remark!=null">
AND s1.remark LIKE CONCAT('%', #{remark},'%')
</if>
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
AND staff.staff_num = black.staff_num
<where>
<if test="type != null">
black.type = #{type}
</if>
<if test="startTime != null and lastTime != null">
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
</if>
<!-- 筛选 lastTime 之前的所有记录 -->
<if test="startTime == null and lastTime != null">
AND staff.`ruzhi_time` &lt;= #{lastTime}
</if>
</where>
) AS `staff_temp`
</select>
<select id="selectLastRuzhiByIdentityCard" resultMap="BaseResultMap">
SELECT * FROM `staff_temporary`
WHERE `identity_card` = #{identityCard}
ORDER BY `ruzhi_time` DESC
LIMIT 1
</select>
<select id="selectNotLeaving" resultMap="BaseResultMap">
<!--
隐藏了人脸图像 faces_information 字段加快,响应速度
-->
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`) &lt;= DATE(#{date})
AND (DATE(`end_time`) >= DATE(#{date}) OR `end_time` IS NULL)
<!--
end_time 有可能并不准确end_time 有可能在入职时间之前或者说end_time 在月结中有可能为空
所以还使用了 zhongkong_dimission_date 和 beisen_dimission_date 来作为准确的离职时间来判断
-->
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>
<select id="selectByStoreId" resultType="java.lang.String">
select staff_num
from staff_temporary_number
where store_id=#{storeId}
and identity_card= #{identityCard}
order by staff_num desc
limit 1
</select>
<select id="selectByStaffNum" resultType="com.ssm.manage.entity.StaffTemporary">
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>
<select id="selectByStaffTemporary1" resultMap="BaseResultMap1">
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
<if test="deptIds != null and deptIds.size() > 0">
AND s1.zhongkong_dept_id in
<foreach collection="deptIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="lastTime == null and isZhongkong != null and isZhongkong == 1">
AND s1.zhongkong_dimission = 1
<!-- OR s1.beisen_dimission = 1 -->
</if>
<if test="lastTime == null and isZhongkong != null and isZhongkong == 0">
AND s1.zhongkong_dimission != 1
<!-- AND (
s1.zhongkong_dimission IS NULL
OR s1.zhongkong_dimission = 0
) -->
<!-- AND s1.zhongkong_dimission_date IS NULL -->
</if>
<if test="staffName!=null">
AND s1.staff_name LIKE CONCAT('%', #{staffName},'%')
</if>
<if test="mobilePhone!=null">
AND s1.mobile_phone = #{mobilePhone}
</if>
<if test="remark!=null">
AND s1.remark LIKE CONCAT('%', #{remark},'%')
</if>
) staff
LEFT JOIN black_list black
ON staff.identity_card = black.identity_card
<!-- AND staff.staff_num = black.staff_num -->
<where>
staff.`ruzhi_time` IS NOT NULL
<if test="type != null">
AND black.type = #{type}
</if>
<if test="startTime != null and lastTime != null">
AND staff.`ruzhi_time` BETWEEN #{startTime} AND #{lastTime}
</if>
<!-- 筛选 lastTime 之前的所有记录 -->
<if test="startTime == null and lastTime != null">
AND staff.`ruzhi_time` &lt;= #{lastTime}
</if>
<if test="job!=null">
AND staff.type =#{job}
</if>
<if test="lastTime != null and isZhongkong != null and isZhongkong == 1">
AND DATE(#{lastTime}) > DATE(staff.end_time)
</if>
<if test="lastTime != null and isZhongkong != null and isZhongkong == 0">
AND (DATE(#{lastTime}) &lt;= DATE(staff.end_time) OR staff.end_time is null)
</if>
</where>
ORDER BY staff.`ruzhi_time` DESC
</select>
<select id="selectByRemark" resultType="java.lang.String">
select identity_card from staff_temporary where remark = #{remark};
</select>
<select id="selectByIdentityCardNew" resultMap="BaseResultMap2">
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
</select>
<delete id="delectByIdcards">
delete from staff_temporary where identity_card in
<foreach collection="delectStaffTemporaryIdcard" item="idcard" separator="," open="(" close=")">
#{idcard}
</foreach>
</delete>
<delete id="delectByIdss">
delete from staff_temporary where id in
<foreach collection="delectStaffTemporaryIdlist" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
</mapper>