<?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.RsRlzyZwssqMapper">
    <select id="queryZwssq" resultType="com.zjrs.ggfw.rlzysc.po.ZyssqPO">
        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.*,
        c.aac003 as "xm",
        c.aac004 as "sex",
        b.userid as "yhlsh",
        decode((select count(rs_rlzy_hmdgl_lsh)
        from rs_ggfw_user b, v_rs_rlzy_hmdgl c
        where a.rs_yhlsh = b.userid
        and b.userid = c.rs_rlzy_ts_lsh
        and c.ts_yxbz = '1'),
        0,
        '0',
        '1') ishmd
        from v_rs_rlzy_zyssq a, v_rs_ggfw_user b, v_ac01 c
        where a.rs_yhlsh = b.userid
        and b.ztid = c.ztid
        ) v
        where v.iszx = '0' and v.istoday != 0
    </select>

    <select id="getZwxx" parameterType="Map" resultType="Map" >
        select v.*
        from (select b.gsmc,
        b.rs_yhlsh,
        a.zwmc,
        a.zwlx,
        a.sshy,
        a.zpgz,
        a.whcd,
        a.gzjy,
        a.gzdd,
        a.xz,
        a.ts_cjsj,
        decode((select count(1)
        from v_rs_rlzy_hmdgl c
        where c.rs_rlzy_ts_lsh = b.rs_yhlsh
        and c.ts_yxbz = '1'),
        0,
        '0',
        '1') ishmd,
        (select c.aab019
        from v_tyrz_user_dwjbxx c
        where c.useridcode = b.rs_yhlsh) aab019,
        (select c.aab020
        from v_tyrz_user_dwjbxx c
        where c.useridcode = b.rs_yhlsh) aab020,
        (select c.aab022
        from v_tyrz_user_dwjbxx c
        where c.useridcode = b.rs_yhlsh) aab022,
        b.zpdq,
        (select count(1)
        from v_rs_rlzy_pbsz d
        where d.rs_rlzy_qyxx_lsh = a.rs_rlzy_qyxx_lsh
        and d.rs_yhlsh = #{map.yhlsh}) ispb
        from v_rs_rlzy_zwxx a, v_rs_rlzy_qyxx b
        where a.rs_rlzy_qyxx_lsh = b.rs_rlzy_qyxx_lsh
        and a.sftjnwsh = '1') v
        where v.ispb = '0'
        <if test="map.zpdq != null and map.zpdq != ''">
            and v.zpdq = #{map.zpdq}     <!-- 工作地区-->
        </if>
       
        <if test="map.qwxz != null and map.qwxz != ''">
            and v.xz = #{map.qwxz}    <!-- 期望薪资,暂时取最低薪资-->
        </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>
