<?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.VRsRlzyJxgwMapper">

    <select id="getList" parameterType="com.zjrs.zwnw.rlzysc.dto.JxgwQueryDTO" resultType="com.zjrs.zwnw.rlzysc.dto.JxgwDTO">
        select v.rs_rlzy_jxgw_lsh as "rsrlzyjxgwlsh",
        v.dwmc as "dwmc",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_DWXZ',v.dwxz) as "dwxzvalue",
        v.dwxz as "dwxz",
        F_DICT_GET_AAA103('JBXX_ZJ_XZQH',v.gzddxzqh) as "gzddxzqhvalue",
        v.gzddxzqh as "gzddxzqh",
        v.xxgzdz as "xxgzdz",
        v.lxr as "lxr",
        v.lxjh as "lxjh",
        v.gzyx as "gzyx",
        v.jxgw as "jxgw",
        v.sfyq as "sfyq",
        v.jxqx as "jxqx",
        v.jxbz as "jxbz",
        v.jxrs as "jxrs",
        v.jxyq as "jxyq",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_BMFS',v.bmfs) as "bmfsvalue",
        v.bmfs as "bmfs",
        v.bmjzrq as "bmjzrq",
        v.lyyx as "lyyx",
        v.lyfl as "lyfl",
        F_DICT_GET_AAA103('RS_RLZY_FBZT',v.fbzt) as "fbztvalue",
        v.fbzt as "fbzt",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.fbr) as "fbr",
        v.fbjg as "fbjg",
        (select max(org_name)
        from v_rs_sy_org_area
        where org_id = v.fbjg) as "fbjgvalue",
        v.fbsj as "fbsj",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_BMZT',v.bmzt) as "bmztvalue",
        v.bmzt as "bmzt",
        v.ts_yxbz as "tsyxbz",
        (f_dict_get_aaa103('JBXX_ZJ_XZQH',v.bae001)) as "bae001",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.bae002) as "bae002",
        v.bae003 as "bae003",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.bae004) as "bae004",
        v.bae005 as "bae005",
        (select max(org_name)
        from v_rs_sy_org_area
        where org_id = v.bae006) as "bae006"
        from v_rs_rlzy_jxgw v
        where v.ts_yxbz='1'
        <if test="dto.dwmc != null and dto.dwmc != ''">
            and v.dwmc like '%'||#{ dto.dwmc }||'%'
        </if>
        <if test="dto.gzddxzqh != null and dto.gzddxzqh != ''">
            and v.gzddxzqh = #{dto.gzddxzqh}
        </if>
        <if test="dto.dwxz != null and dto.dwxz != ''">
            and v.dwxz = #{dto.dwxz}
        </if>
        <if test="dto.bmjzrqStart != null and dto.bmjzrqStart != ''">
            and v.bmjzrq <![CDATA[ >= ]]> #{dto.bmjzrqStart}
        </if>
        <if test="dto.ssdq != null and dto.ssdq != ''">
            and v.BAE001 = #{dto.ssdq}
        </if>

        order by  v.bae003 desc
    </select>

    <select id="getDetail" parameterType="com.zjrs.zwnw.rlzysc.dto.JxgwCommDTO" resultType="com.zjrs.zwnw.rlzysc.po.VRsRlzyJxgwPO">
        select v.rs_rlzy_jxgw_lsh as "rsrlzyjxgwlsh",
        v.dwmc as "dwmc",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_DWXZ',v.dwxz) as "dwxzvalue",
        v.dwxz as "dwxz",
        F_DICT_GET_AAA103('JBXX_ZJ_XZQH',v.gzddxzqh) as "gzddxzqhvalue",
        v.gzddxzqh as "gzddxzqh",
        v.xxgzdz as "xxgzdz",
        v.lxr as "lxr",
        v.lxjh as "lxjh",
        v.gzyx as "gzyx",
        v.jxgw as "jxgw",
        v.sfyq as "sfyq",
        v.jxqx as "jxqx",
        v.jxbz as "jxbz",
        v.jxrs as "jxrs",
        v.jxyq as "jxyq",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_BMFS',v.bmfs) as "bmfsvalue",
        v.bmfs as "bmfs",
        v.bmjzrq as "bmjzrq",
        v.lyyx as "lyyx",
        v.lyfl as "lyfl",
        F_DICT_GET_AAA103('RS_RLZY_FBZT',v.fbzt) as "fbztvalue",
        v.fbzt as "fbzt",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.fbr) as "fbr",
        v.fbjg as "fbjg",
        (select max(org_name)
        from v_rs_sy_org_area
        where org_id = v.fbjg) as "fbjgvalue",
        v.fbsj as "fbsj",
        F_DICT_GET_AAA103('RS_RLZY_JXGW_BMZT',v.bmzt) as "bmztvalue",
        v.bmzt as "bmzt",
        v.ts_yxbz as "tsyxbz",
        (select max(org_name)
        from v_rs_sy_org_area
        where org_id = v.bae001) as "bae001",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.bae002) as "bae002",
        v.bae003 as "bae003",
        (select user_name
        from v_rs_sy_org_area
        where user_id = v.bae004) as "bae004",
        v.bae005 as "bae005",
        (select max(org_name)
        from v_rs_sy_org_area
        where org_id = v.bae006) as "bae006"
        from v_rs_rlzy_jxgw v
        where v.rs_rlzy_jxgw_lsh=#{dto.id}

    </select>


</mapper>
