gongchunyi
4 天以前 e8d08ebdd187f99f793cd839038dd5c392cdfbd8
src/main/resources/mapper/compensationperformance/CompensationPerformanceMapper.xml
@@ -3,14 +3,23 @@
<mapper namespace="com.ruoyi.compensationperformance.mapper.CompensationPerformanceMapper">
    <select id="listPage" resultType="com.ruoyi.compensationperformance.pojo.CompensationPerformance">
        select * from compensation_performance
        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="req.name != null and req.name != ''">
                and `name` like concat('%',#{req.name},'%')
            <if test="staffName != null and staffName != ''">
                AND soj.staff_name LIKE CONCAT('%', #{staffName}, '%')
            </if>
            <if test="req.payDateStr != null and req.payDateStr != ''">
                and pay_date like concat('%',#{req.payDateStr},'%')
            <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>
</mapper>