gongchunyi
9 小时以前 47b42159fbe69fb2b4dbc13c75dd45abd00a55ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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.compensationperformance.mapper.CompensationPerformanceMapper">
 
    <select id="listPage" resultType="com.ruoyi.compensationperformance.pojo.CompensationPerformance">
        SELECT
        cp.*,
        soj.staff_name AS staffName,
        sp.post_name AS postName,
        sd.dept_name AS deptName
        FROM compensation_performance cp
        LEFT JOIN staff_on_job soj ON soj.id = cp.staff_id
        LEFT JOIN sys_post sp ON sp.post_id = soj.sys_post_id
        LEFT JOIN sys_dept sd ON sd.dept_id = soj.sys_dept_id
        <where>
            <if test="staffName != null and staffName != ''">
                AND soj.staff_name LIKE CONCAT('%', #{staffName}, '%')
            </if>
            <if test="payDateStr != null and payDateStr != ''">
                AND DATE_FORMAT(cp.pay_date, '%Y-%m') = #{payDateStr}
            </if>
        </where>
        ORDER BY cp.pay_date DESC, cp.id DESC
    </select>
 
    <select id="exportList" resultType="com.ruoyi.compensationperformance.pojo.CompensationPerformance">
        SELECT cp.*,
               soj.staff_name AS staffName,
               sp.post_name   AS postName,
               sd.dept_name   AS deptName
        FROM compensation_performance cp
                 LEFT JOIN staff_on_job soj ON soj.id = cp.staff_id
                 LEFT JOIN sys_post sp ON sp.post_id = soj.sys_post_id
                 LEFT JOIN sys_dept sd ON sd.dept_id = soj.sys_dept_id
        ORDER BY cp.pay_date DESC, cp.id DESC
    </select>
</mapper>