<?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.cultivate.mapper.FtbCultivatePromotionPostApplyMapper">

<!--获取培养推广岗位申请的分页信息-->
  <select id="getListInfo" resultType="jnpf.model.cultivate.vo.apply.FtbCultivatePromotionPostApplyVO">
    SELECT
    F_Id as id,
    F_UserName userName,
    F_UserId userId,
    F_PromotionReason promotionReason,
    F_State state,
    F_Source source,
    F_PostId postId,
    F_PostName postName,
    F_PostRankId postRankId,
    F_PostRankName postRankName,
    F_PostPromotionId postPromotionId,
    F_PostPromotionName postPromotionName,
    F_PostRankPromotionId postRankPromotionId,
    F_PostRankPromotionName postRankPromotionName,
    F_CreatorTime   creatorTime,
    F_LastModifyTime lastModifyTime,
    F_OrgCurrentId orgCurrentId,
    F_OrgCurrentName orgCurrentName,
    F_OrgId orgId,
    F_OrgName orgName
    FROM
    ftb_cultivate_promotion_post_apply
    <where>
      <if test="dto.keyWords!= null">
        (
        F_UserName LIKE CONCAT('%',#{dto.keyWords},'%') OR
        F_PostRankName LIKE CONCAT('%',#{dto.keyWords},'%') OR
        F_PostName LIKE CONCAT('%',#{dto.keyWords},'%')
        )
      </if>
      <if test="dto.flag == 1 ">
        AND F_CreatorUserId = #{dto.userId}
      </if>
      <if test="dto.flag == 2 ">
        AND F_ReviewUserId = #{dto.userId}
        ORDER BY F_State asc,F_CreatorTime DESC
      </if>
    </where>
  </select>
</mapper>