huminmin
9 小时以前 3e2fc5361f545d7e2660924b55ea5b702992fca4
src/main/resources/mapper/staff/StaffJoinLeaveRecordMapper.xml
@@ -1,16 +1,25 @@
<?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.ruoyi.staff.mapper.StaffJoinLeaveRecordMapper">
    <select id="staffJoinLeaveRecordListPage" resultType="com.ruoyi.staff.pojo.StaffJoinLeaveRecord">
    <select id="staffJoinLeaveRecordListPage" resultType="com.ruoyi.staff.dto.StaffJoinLeaveRecordDto">
        SELECT
        *
        staff_join_leave_record.*,
        sp.post_name as postName
        FROM staff_join_leave_record
        LEFT JOIN
        sys_post sp ON sp.post_id = staff_join_leave_record.sys_post_id
        where
        staff_state = #{staffJoinLeaveRecord.staffState}
        <if test="staffJoinLeaveRecord.staffName != null and staffJoinLeaveRecord.staffName != '' ">
            AND staff_name LIKE CONCAT('%',#{staffJoinLeaveRecord.staffName},'%')
        </if>
        <if test="staffJoinLeaveRecord.entryDateStart != null and staffJoinLeaveRecord.entryDateStart != '' ">
            and contract_start_time like concat('%',#{staffJoinLeaveRecord.entryDateStart},'%')
        </if>
        <if test="staffJoinLeaveRecord.entryDateEnd != null and staffJoinLeaveRecord.entryDateEnd != '' ">
            and contract_end_time like concat('%',#{staffJoinLeaveRecord.entryDateEnd},'%')
        </if>
        order by create_time desc
    </select>
    <select id="staffJoinLeaveRecordList" resultType="com.ruoyi.staff.pojo.StaffJoinLeaveRecord">
        SELECT
@@ -22,4 +31,13 @@
            AND staff_name LIKE CONCAT('%',#{staffJoinLeaveRecord.staffName},'%')
        </if>
    </select>
    <select id="staffOnJobList" resultType="com.ruoyi.staff.pojo.StaffJoinLeaveRecord">
        select *
        from (select *,
                     ROW_NUMBER() over (PARTITION BY staff_no ORDER BY create_time DESC ) as rn
              from staff_join_leave_record
              where staff_state = 1) t
        where rn = 1
    </select>
</mapper>