<?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.dbgl.entity.GzqdMapper">

    <select id="getGzqdglList" resultType="HashMap" parameterType="com.zjrs.zwnw.dbgl.dto.DbrwglGzqdglQueryDTO">
        select a.rs_dbgl_gzqd_lsh as "rsdbglgzqdlsh",
        a.gzqd as "gzqd",
        a.gzjz as "gzjz",
        a.czwt as "czwt",
        a.xgbgz as "xgbgz",
        decode(a.wcjd,null,'',a.wcjd||'%') as "wcjd",
        a.sdpj as "sdpj",
        a.zlpj as "zlpj",
        f_common_getSSgUser(a.zrr) as "zrr",
        f_common_getSSgUserOrg(a.zrbm) as "zrbm",
        a.shzt as "shzt",
        a.shr as "shr",
        a.shjg as "shjg",
        a.shsj as "shsj",
        a.bae003 as "bae003",
        a.bae005 as "bae005"
        from V_RS_DBGL_GZQD a
        where a.ts_yxbz = '1'

        <if test="dto.gzqd != null and dto.gzqd != ''">
            and a.gzqd LIKE '%'||#{dto.gzqd}||'%'
        </if>
        order by a.bae003 desc

    </select>
    <select id="getDbrwListByGzqdid" resultType="HashMap" parameterType="com.zjrs.zwnw.dbgl.dto.DbrwglCommQueryDTO">
        select distinct a.rs_dbgl_dbrw_lsh as "rsdbgldbrwlsh",
        a.dbbh             as "dbbh",
        a.rwlyfl           as "rwlyfl",
        a.rwly             as "rwly",
        a.rwzt as "rwzt"
        from V_RS_DBGL_DBRW_YX   a,
        V_RS_DBGL_DBXM_YX   b,
        V_RS_DBGL_GZQD_YX   c,
        V_RS_DBGL_DBXM_GZQD d
        where a.RS_DBGL_DBRW_LSH = b.RS_DBGL_DBRW_LSH
        and b.RS_DBGL_DBXM_LSH = d.RS_DBGL_DBXM_LSH
        and c.RS_DBGL_GZQD_LSH = d.RS_DBGL_GZQD_LSH
        and c.RS_DBGL_GZQD_LSH = #{dto.ids}
        order by a.dbbh desc
    </select>
</mapper>
