bns-zhgd-service/bonus-modules/bonus-base/src/main/resources/mapper/smartsite/basic/TtPersonnelEntryExitMapper.xml

39 lines
1.8 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.base.basic.mapper.TtPersonnelEntryExitMapper">
<insert id="addTtPersonnelEntryExit">
insert into tt_personnel_entry_exit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personnelId != null and personnelId != ''">personnel_id,</if>
<if test="workType != null">work_type,</if>
<if test="lotId != null and lotId != ''">lot_id,</if>
<if test="entryDate != null">entry_date,</if>
<if test="status != null and status != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="personnelId != null and personnelId != ''">#{personnelId},</if>
<if test="workType != null">#{workType},</if>
<if test="lotId != null and lotId != ''">#{lotId},</if>
<if test="entryDate != null">#{entryDate},</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
<update id="updateTtPersonnelEntryExit">
update tt_personnel_entry_exit
<trim prefix="SET" suffixOverrides=",">
<if test="exitDate != null">exit_date = #{exitDate},</if>
<if test="status != null">status = #{status},</if>
</trim>
where personnel_id = #{personnelId} and status = 0
</update>
<select id="getTtPersonnelEntryExitByUserId"
resultType="com.bonus.base.basic.domain.vo.TtPersonnelEntryExitVo">
select id as id, personnel_id as personnelId, work_type as workType,lot_id as lotId,
entry_date as entryDate, exit_date as exitDate, status as status
from tt_personnel_entry_exit where personnel_id = #{personnelId}
</select>
</mapper>