<?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.zjrs.ggfw.rlzysc.entity.RsRlzyRcssqMapper">

    <!-- 从人才搜索器表里查询当天需要发送站内信息的人才搜索器,
    人才搜索器被拉入黑名单的不给使用
    -->

    <select id="getRcssqDsq" resultType="com.zjrs.ggfw.rlzysc.po.RsRlzyRcssqPO">
        select v.*
        from (select mod((trunc(sysdate) -
        trunc(to_date(a.dsqzxsj, 'yyyy-mm-dd hh24:mi:ss'))),
        to_number(a.fszq)) iszx,
        (trunc(sysdate) -
        trunc(to_date(a.dsqzxsj, 'yyyy-mm-dd hh24:mi:ss'))) istoday,
        a.*,
        b.qyxx_shzt qyxxshzt,
        decode((select count(rs_rlzy_hmdgl_lsh)
        from v_rs_rlzy_hmdgl c
        where b.rs_yhlsh = c.rs_rlzy_ts_lsh
        and c.ts_yxbz = '1'),
        0,
        '0',
        '1') ishmd,
        (select aaa103 from  v_ggfw_dict where aaa100 = 'RS_RLZY_EJZYFL' and aaa102= a.gzlb) as gzlbname,
        (select b.aab004
        from v_tyrz_user_dwjbxx b, v_rs_rlzy_qyxx c
        where b.useridcode = c.rs_yhlsh
        and c.rs_rlzy_qyxx_lsh = a.rs_rlzy_qyxx_lsh) gsmc,
        (select rs_yhlsh
        from v_rs_rlzy_qyxx
        where rs_rlzy_qyxx_lsh = a.rs_rlzy_qyxx_lsh) rsyhlsh
        from v_rs_rlzy_rcssq a, v_rs_rlzy_qyxx b
        where a.ts_yxbz = '1'
        and a.rs_rlzy_qyxx_lsh = b.rs_rlzy_qyxx_lsh
        and a.sfzndy = '1'
        ) v
        where v.iszx = 0 and v.istoday != 0
    </select>

    <select id="getWqgkJlxx" parameterType="Map" resultType="Map">
        select v.aac003 as "aac003", v.jlmc as "jlmc"
        from v_rs_rlzy_jlxx_dsq_random v
        where v.fbzt = '1'
        and (v.pbqylsh is null
        <if test="map.rsrlzyqyxxlsh != null and map.rsrlzyqyxxlsh != ''">
            or v.pbqylsh != #{map.rsrlzyqyxxlsh}
        </if>
        )
        <if test="map.gzdd != null and map.gzdd != ''">
            and v.gzdd = #{map.gzdd}
        </if>
        <if test="map.qwzw != null and map.qwzw != ''">
            and v.qwzw = #{map.qwzw}
        </if>
        <if test="map.aac009 != null and map.aac009 != ''">
            and v.aac009 = #{map.aac009}
        </if>
        <if test="map.fbrq != null and map.fbrq != ''">
            and to_char(to_date(ts_cjsj,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd') >= #{map.fbrq}
        </if>
        <if test="map.fszws != null and map.fszws != ''">
            and rownum <![CDATA[ <= ]]> to_number(#{map.fszws})
        </if>

    </select>

</mapper>
