<?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="jnpf.personnels.mapper.FtbPersonnelsStaffHomePageMapper">
    <!--奖励记录-->
    <select id="getRewardList" resultType="jnpf.model.personnels.vo.roster.FtbHomePageRewardVO">
        SELECT
        a.F_TypeName as typeName,
        a.F_RewardReason as reason,
        a.F_CreatorUserId as operator,
        a.F_CreatorTime as operateTime,
        a.F_Amount as money
        FROM
        ftb_reward_approval a
        LEFT JOIN ftb_reward_user b ON a.F_Id = b.F_ApprovalId
        JOIN ftb_personnels_staff_roster c ON ( a.F_UserId = c.F_UserId OR b.F_UserId = c.F_UserId )
        WHERE
        (a.F_Status = 1 OR a.F_Status =4)
        and a.F_IsRecorded = 1
        and c.F_UserId =  #{id}
    </select>
    <!--乐捐记录-->
    <select id="donationRecords" resultType="jnpf.model.personnels.vo.roster.FtbHomePageRewardVO">
        SELECT
        a.F_TypeName as typeName,
         a.F_RewardReason as reason,
         a.F_CreatorUserId as operator,
         a.F_CreatorTime as operateTime,
         a.F_Amount as money
        FROM
        ftb_punishments_approval a
        LEFT JOIN ftb_punishments_user b ON a.F_Id = b.F_PunishmentsId
        JOIN ftb_personnels_staff_roster c ON ( a.F_UserId = c.F_UserId OR b.F_UserId = c.F_UserId )
        WHERE
        (a.F_Status = 1 OR a.F_Status =4)
        and a.F_IsRecorded = 1
        and c.F_UserId = #{id}
    </select>

</mapper>