<?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.zwnw.rlzysc.entity.GxygMapper">

    <select id="getGxygList" parameterType="com.zjrs.zwnw.rlzysc.dto.GxygQueryDTO"
            resultType="Map">
        SELECT a.rs_rlzy_gxyg_lsh "rsrlzygxyglsh", b.gsmc "qymc",
        a.qyygqk "qyygqk", a.gxrs "gxrs", a.gxyy "gxyy",
        a.gxkssj "gxkssj", a.gxjssj "gxjssj"
        ,a.lxr "lxr", a.lxdh "lxdh", nvl(a.shzt, '0') "shzt", a.fbzt "fbzt",
        a.shyj "shyj", (CASE WHEN a.shzt IS NULL THEN '0' ELSE '1' END ) "tjzt",
        a.ts_yxbz "tsyxbz",
        (select user_name from v_rs_sy_org_area where user_id = a.ts_shr) "shr",
        a.ts_shsj "shsj", a.zxzt "zxzt"
        FROM v_rs_rlzy_gxyg a, v_rs_rlzy_qyxx b
        WHERE a.rs_rlzy_qyxx_lsh = b.rs_rlzy_qyxx_lsh
        <if test="dto.qyygqk != null and dto.qyygqk != ''">
            and a.qyygqk = #{dto.qyygqk}
        </if>
        <if test="dto.gxkssjc != null and dto.gxkssjc != ''">
            and gxkssj <![CDATA[ >= ]]> #{dto.gxkssjc}
        </if>

        and gxjssj <![CDATA[ >= ]]> to_char(sysdate, 'yyyy-MM-dd')
        order by gxkssj desc
    </select>

    <select id="getGxygStatus" resultType="Map">
        SELECT AAA005 CODE FROM AA01 WHERE AAA001 = 'RS_RLZY_GXYGZT'
    </select>

    <select id="updateGxygStatus" parameterType="String" >
        UPDATE aa01 SET aaa005 = #{status} WHERE aaa001 = 'RS_RLZY_GXYGZT'
    </select>

</mapper>
