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

    <select id="getDwxx" parameterType="String" resultType="HashMap">
        select b.AAB004 as "aab004",
        b.AAB998 as "aab998",
        nvl(c.aab078, b.aab078) as "aab078",
        nvl(c.bze001, b.bze001) as "bze001",
        nvl(c.aab013, b.aab013) as "aab013",
        nvl(c.aab022, b.aab022) as "aab022",
        nvl(c.FDDBRDH, b.BAB015) as "fddbrdh",
        nvl(c.LXR, b.aae004) as "lxr",
        nvl(c.LXRDH, b.aae005) as "lxrdh",
        c.rs_rlzy_ygbadw_lsh as "rsrlzyygbadwlsh",
        c.fddbrdh as "fddbrdh",
        c.lxr as "lxr",
        c.lxrdh as "lxrdh",
        c.zzgrs as "zzgrs",
        c.cbrs as "cbrs",
        c.jydjrs as "jydjrs",
        c.zsgrs as "zsgrs",
        c.zsgcbrs as "zsgcbrs",
        c.zsgjydjrs as "zsgjydjrs",
        c.pqgrs as "pqgrs",
        c.pqgcbrs as "pqgcbrs",
        c.pqgjydjrs as "pqgjydjrs",
        c.lsgrs as "lsgrs",
        c.lsgcbrs as "lsgcbrs",
        c.lsgjydjrs as "lsgjydjrs",
        c.qtgrs as "qtgrs",
        c.qtgcbrs as "qtgcbrs",
        c.qtgjydjrs as "qtgjydjrs",
        c.ts_yxbz as "tsyxbz",
        c.bae001 as "bae001",
        c.bae002 as "bae002",
        c.bae003 as "bae003",
        c.bae004 as "bae004",
        c.bae005 as "bae005",
        c.bae006 as "bae006"
        from rs_ggfw_user a
        left join ab01 b
        on a.ztid = b.ztid
        left join V_RS_RLZY_YGBADW c
        on b.ztid = c.ztid
        where a.userid = #{userid}
    </select>

    <select id="getYgxxlist" parameterType="com.zjrs.ggfw.rlzysc.dto.YgbaYgxxQueryDTO" resultType="com.zjrs.ggfw.rlzysc.po.RsRlzyYgbaygYwPO">
        select v.rs_rlzy_ygbayg_yw_lsh as "rsrlzyygbaygywlsh",
        v.rs_rlzy_ygbadw_lsh    as "rsrlzyygbadwlsh",
        v.xm                    as "xm",
        v.zjlx                  as "zjlx",
        v.zjhm                  as "zjhm",
        f_jbxxgl_getAllAreaName(v.hjfxzqh) as "hjfxzqh",
        v.jzdz                  as "jzdz",
        v.csgw                  as "csgw",
        v.ygfs                  as "ygfs",
        v.rzsj                  as "rzsj",
        v.htdqsj                as "htdqsj",
        v.bz                    as "bz",
        v.lzsj                  as "lzsj",
        v.ryzt                  as "ryzt",
        v.tjzt                  as "tjzt",
        v.shzt                  as "shzt",
        v.shyj                  as "shyj",
        v.ts_yxbz               as "tsyxbz",
        v.bae001                as "bae001",
        v.bae002                as "bae002",
        v.bae003                as "bae003",
        v.bae004                as "bae004",
        v.bae005                as "bae005",
        v.bae006                as "bae006"
        from v_rs_rlzy_ygbayg_yw v
        where v.ts_yxbz='1' and v.rs_rlzy_ygbadw_lsh=#{dto.rsrlzyygbadwlsh}
        <if test="dto.xm != null and dto.xm != ''">
            and v.xm LIKE '%'||#{dto.xm}||'%'
        </if>
        <if test="dto.rzsjStart != null and dto.rzsjStart != ''">
            and v.rzsj <![CDATA[ >= ]]> #{dto.rzsjStart}
        </if>
        <if test="dto.rzsjEnd != null and dto.rzsjEnd != ''">
            and v.rzsj <![CDATA[ <= ]]> #{dto.rzsjEnd}
        </if>

        order by  v.bae005 desc
    </select>

</mapper>
