<?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.sxgl.entity.SxpzxxMapper">

    <select id="getSxpzxxById" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxXsDTO">
        select a.rs_sx_config_lsh, a.sxbm, a.jbbm, a.ssbm, a.sxmc, a.sxlx, a.sxlb, a.ywzt, a.bllx,
        a.fdbjsx, a.fdbjsxdw, a.blsx, a.cnbjsxdw, a.dxccs, a.sfzcwlkd,
        a.slqd, a.sltj, a.sdyj, a.ywclyq, a.dsfxtblwz, a.dsfxtblsm, a.ssbmmc, a.sfzcxcx,a.sxbb,a.bjlx,a.sltjxcx,a.bz,a.kz,a.fgld,a.glsx
        from RS_SX_CONFIG a
        where a.rs_sx_config_lsh = #{ id }
    </select>

    <select id="getSxglclListBySxbm" parameterType="com.zjrs.zwnw.sxgl.dto.SxglclQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxglclListDTO">
        select a.sdszid, a.ywlbid ,a.zllbid, a.sfgdbz, a.sfbsbz, c.sfzcdzzz dzzzbz, a.orderno, a.yjfs, a.fyjfs,
        a.clsm, a.clxs, b.sxbm, c.zlmc, a.sydx, a.sysx
        from  sdszzcxx a,RS_SX_CONFIG b, SDZLSX c
        where a.ywlbid = b.sxbm and a.zllbid=c.zllbid and b.sxbm = #{ dto.sxbm }
        order by a.orderno asc, a.sdszid desc
    </select>

    <select id="getSxglclListById" parameterType="com.zjrs.zwnw.sxgl.dto.SxglclQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxglclListDTO">
        select a.sdszid,a.ywlbid ,a.zllbid, a.sfgdbz, a.sfbsbz, c.sfzcdzzz dzzzbz, a.orderno, a.yjfs, a.fyjfs,
        a.clsm, a.clxs, b.sxbm,c.zlmc, a.sydx, a.sysx
        from  sdszzcxx a,RS_SX_CONFIG b, SDZLSX c
        where a.rs_sx_config_lsh = b.rs_sx_config_lsh and a.zllbid=c.zllbid and b.rs_sx_config_lsh = #{ dto.rsSxConfigLsh }
        order by a.orderno asc, a.sdszid desc
    </select>

    <!-- 未关联材料列表-->
    <select id="getSxWglclListBySxbm" parameterType="com.zjrs.zwnw.sxgl.dto.SxWglclQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SdzlsxListDTO">
        select zllbid,zllbdm,zlmc,cllb,sfzcdzzz,ts_czsj,(select user_name from s_sg_user where id=ts_czr) ts_czr,ssbmmc
        from SDZLSX a where a.zllbid not in(select zllbid from sdszzcxx where YWLBID = #{ dto.sxbm })
            and ssbmmc = #{ dto.ssbmmc }
        <if test="dto.cllb != null and dto.cllb != ''">
            and cllb = #{dto.cllb}
        </if>
        order by ts_czsj DESC, zllbid DESC
    </select>

    <select id="getSxWglclListById" parameterType="com.zjrs.zwnw.sxgl.dto.SxWglclQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SdzlsxListDTO">
        select zllbid,zllbdm,zlmc,cllb,sfzcdzzz,ts_czsj,(select user_name from s_sg_user where id=ts_czr) ts_czr,ssbmmc
        from SDZLSX a where a.zllbid not in(select zllbid from sdszzcxx where rs_sx_config_lsh = #{ dto.rsSxConfigLsh })
            and ssbmmc = #{ dto.ssbmmc }
        <if test="dto.cllb != null and dto.cllb != ''">
            and cllb = #{dto.cllb}
        </if>
        <if test="dto.zlmc != null and dto.zlmc != ''">
            and zlmc like '%${ dto.zlmc }%'
        </if>
        order by ts_czsj DESC, zllbid DESC
    </select>

    <select id="getLchjList" resultType="com.zjrs.zwnw.sxgl.dto.LchjListDTO">
        select a.sxmc lcmc,
            b.action_def_name hjmc,
            f_sxgl_getNextActioneName(b.process_def_id, b.next_action_def_id) xyhj,
            b.sortno,
            b.process_def_id processdefid,
            b.action_def_id actiondefid
        from rs_sx_config a, wf_action_def b
        where trim(a.process_def_name) = trim(b.process_def_name)
            and a.sxbm = #{ sxbm }
        order by b.sortno asc
    </select>

    <select id="queryExportSxlList" parameterType="com.zjrs.zwnw.sxgl.dto.SxExportQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxExportListDTO">
        SELECT row_number() over (order by ts_czsj DESC,sxbm DESC ) xh,
            jbbm,ssbm,sxmc,fdbjsx,blsx,sltj,sdyj,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_SXLX' and aaa102 = sxlx) sxlx,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_DXCCS' and aaa102 = dxccs) dxccs,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_SXDW' and aaa102 = fdbjsxdw) fdbjsxdw,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_DT' and aaa102 = cnbjsxdw) cnbjsxdw,
            (select aaa103 from aa10 where aaa100 = 'APP001' and aaa102 = sfzcwlkd) sfzcwlkd,
            (select aaa103 from aa10 where aaa100 = 'SX_SXLB' and aaa102 = sxlb) sxlb,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_YWZT' and aaa102 = ywzt) ywzt,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_SSBMMC' and aaa102 = ssbmmc) ssbmmc,
            (select aaa103 from aa10 where aaa100 = 'RS_SX_BJLX' and aaa102 = bjlx) bjlx,
            sxbb
        FROM rs_sx_config
        WHERE yxbz = '1'
        <if test="dto.sxbm != null and dto.sxbm != ''">
            and sxbm like '%${ dto.sxbm }%'
        </if>
        <if test="dto.sxmc != null and dto.sxmc != ''">
            and sxmc like '%${ dto.sxmc }%'
        </if>
        ORDER BY ts_czsj DESC, sxbm DESC
    </select>

    <select id="getSxglcXxBySxbm" parameterType="com.zjrs.zwnw.sxgl.dto.SxglclXxQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxglclListDTO">
        select a.sdszid,a.ywlbid ,a.zllbid, a.sfgdbz, a.sfbsbz, c.sfzcdzzz dzzzbz, a.orderno, a.yjfs, a.fyjfs,
        a.clsm, a.clxs, b.sxbm, c.zlmc, a.sydx, a.sysx
        from sdszzcxx a,RS_SX_CONFIG b, SDZLSX c
        where a.ywlbid = b.sxbm and a.zllbid=c.zllbid
        and b.sxbm = #{ dto.sxbm } and a.sdszid = #{ dto.sdszid}
    </select>

    <select id="getSxglcXxBySxId" parameterType="com.zjrs.zwnw.sxgl.dto.SxglclXxQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxglclListDTO">
        select a.sdszid,a.ywlbid ,a.zllbid, a.sfgdbz, a.sfbsbz, c.sfzcdzzz dzzzbz, a.orderno, a.yjfs, a.fyjfs,
        a.clsm, a.clxs, b.sxbm, c.zlmc, a.sydx,a.sysx
        from sdszzcxx a,RS_SX_CONFIG b, SDZLSX c
        where a.rs_sx_config_lsh = b.rs_sx_config_lsh and a.zllbid=c.zllbid
        and b.rs_sx_config_lsh = #{ dto.rsSxConfigLsh } and a.sdszid = #{ dto.sdszid}
    </select>

    <select id="countLcBySxbm" resultType="java.lang.Integer">
        select count(1)
        from rs_sx_config a, wf_action_def b
        where a.process_def_name = b.process_def_name
        and a.sxbm = #{ sxbm }
    </select>

    <select id="getMaxSxbm" resultType="java.lang.String">
        select max(SXBM) from rs_sx_config where SXBM like '${ sxbm }%'
    </select>

    <select id="checkProcessInstance" resultType="java.lang.Integer">
        select count(1)
        from wf_process_instance a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
    </select>
    <select id="checkLcTemp" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
    </select>
    <select id="checkZslc" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
    </select>
    <select id="getSxlcpzList" resultType="com.zjrs.zwnw.sxgl.dto.LchjListDTO">
        select lcmc,
            processdefid,
            ACTIONDEFID,
            hjmc,
            SORTNO,
            substr(listagg(xyhj, ';') within
                group(order by lcmc,processdefid, ACTIONDEFID, hjmc, SORTNO),
                0,
                100) xyhj
            from (select b.sxmc lcmc,
                a.process_def_id processdefid,
                a.ACTION_DEF_ID actiondefid,
                a.ACTION_DEF_NAME hjmc,
                (select t.action_def_name
                from wf_action_def_temp t
                where t.process_def_name = a.process_def_name
                and t.action_def_id = a.next_action_def_id
                and rownum = 1) xyhj,
                a.SORTNO
                from wf_action_def_temp a, rs_sx_config b
                where a.process_def_name = b.process_def_name
                and b.rs_sx_config_lsh = #{ rsSxConfigLsh })
        group by lcmc,processdefid, ACTIONDEFID, hjmc, SORTNO
        order by to_number(SORTNO)
    </select>

    <select id="getWfActionDefBySxid" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select a.PROCESS_DEF_ID processdefid, a.PROCESS_DEF_NAME processdefname,
        a.ACTION_DEF_ID actiondefid, a.NEXT_ACTION_DEF_ID nextactiondefid,
        a.ACTION_DEF_NAME actiondefname, a.SORTNO
        from wf_action_def a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        order by to_number(a.SORTNO)
    </select>

    <select id="getSxpzxxLcpzById" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLcpzDTO">
        select a.rs_sx_config_lsh  rsSxConfigLsh,a.PROCESS_DEF_NAME processdefname, a.ssbm, a.sxmc, a.sxlx, a.sxlb,
         a.ssbmmc,a.sxbm
        from RS_SX_CONFIG a
        where a.rs_sx_config_lsh = #{ id }
    </select>

    <select id="checkHjTaskSendSms" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def2task
        where ACTION_DEF_ID = #{ dto.actiondefid }
        and NEXT_ACTION_DEF_ID = #{ dto.nextactiondefid }
        and TASK = 'appcommSmsService.saveSms'
    </select>

    <select id="checkLcExistKyls" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp a
        where a.ts_yxbz='1'
        and a.sfht='0'
        and a.action_def_id like '%_kystl'
        and a.process_def_id = #{ processdefid }
    </select>
    <select id="getLchjxxByLcid" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select a.PROCESS_DEF_ID processdefid, a.PROCESS_DEF_NAME processdefname
        from wf_action_def_temp a
        where a.ts_yxbz='1'
        and a.process_def_id = #{ processdefid }
        and rownum ='1'
    </select>
    <select id="getHjID" resultType="java.lang.String">
        select SYS_GUID() from dual
    </select>
    <select id="getLcpzSetList" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLcpzSetListDTO">
        select * from (select a.PROCESS_DEF_ID processdefid,
            a.PROCESS_DEF_NAME processdefname,
            a.ACTION_DEF_ID actiondefid,
            a.ACTION_DEF_NAME actiondefname,
            a.SORTNO,
            '0' isPrehj,
            '0' isHthj,
            '0' isHthjFdx,
            '0' isNexthj,
            '0' isNexthjFdx
            from wf_action_def_temp a
            where a.PROCESS_DEF_ID = #{ processdefid }
            and a.sfht = '0')
        group by processdefid,processdefname,actiondefid,actiondefname,
            SORTNO,isPrehj,isHthj,isHthjFdx,isNexthj,isNexthjFdx
        order by to_number(SORTNO)
    </select>
    <select id="lcpzSetCheckHj" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp
        where ACTION_DEF_ID = #{ dto.actiondefid }
        and NEXT_ACTION_DEF_ID = #{ dto.nextactiondefid }
        and SFHT = #{ dto.sfht}
    </select>
    <select id="lcpzSetCheckSendSms" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp
        where ACTION_DEF_ID = #{ dto.actiondefid }
        and NEXT_ACTION_DEF_ID = #{ dto.nextactiondefid }
        and SFHT = #{ dto.sfht}
    </select>
    <select id="getBlankHjMoreThanOne" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" >
        select PROCESS_DEF_ID, ACTION_DEF_ID, sfht
            from wf_action_def_temp t
            group by PROCESS_DEF_ID, ACTION_DEF_ID, sfht
        having count(*) > 1 and PROCESS_DEF_ID = #{ processdefid } 
    </select>
    <select id="checkNextHjIsBlank" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp
        where ACTION_DEF_ID = #{ dto.actiondefid }
            and PROCESS_DEF_ID = #{ dto.processdefid }
            and NEXT_ACTION_DEF_ID is null
    </select>

    <select id="getLchjxxByHjid" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select a.PROCESS_DEF_ID   processdefid,
        a.PROCESS_DEF_NAME processdefname,
        a.action_def_id    actiondefid,
        a.action_def_name  actiondefname,
        a.sortno
        from wf_action_def_temp a
        where a.action_def_id = #{ actiondefid }
        and rownum ='1'
    </select>
    <select id="checkSortno" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp
        where PROCESS_DEF_ID = #{ dto.processdefid }
        and SORTNO = #{ dto.sortno }
        <if test="dto.actiondefid != null and dto.actiondefid != ''">
            and ACTION_DEF_ID not in #{dto.actiondefid}
        </if>
    </select>
    <select id="checkSortnoMoreThanOne" resultType="java.lang.Integer">
        select count(1) from (
            select distinct a.ACTION_DEF_ID,a.SORTNO
                from wf_action_def_temp a, rs_sx_config b
                where a.process_def_name = b.process_def_name
                    and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
                    )
        group by SORTNO having count(1)>1
    </select>
    <select id="checkAllHjHaveNext" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select a.action_def_name  actiondefname
            from wf_action_def_temp a, rs_sx_config b
            where a.process_def_name = b.process_def_name
                and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
                and a.next_action_def_id is null
                and a.action_def_id not like'%_std'
                and a.action_def_id not like'%_bsj'
    </select>
    <select id="getWfactiondeftempList" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select *
            from (select a.PROCESS_DEF_ID   processdefid,
                    a.PROCESS_DEF_NAME processdefname,
                    a.ACTION_DEF_ID    actiondefid,
                    a.ACTION_DEF_NAME  actiondefname,
                    a.SORTNO
                from wf_action_def_temp a, rs_sx_config b
                where a.process_def_name = b.process_def_name
                    and b.rs_sx_config_lsh =#{ rsSxConfigLsh }
                    )
        group by processdefid,
            processdefname,
            actiondefid,
            actiondefname,
            SORTNO
        order by to_number(SORTNO)
    </select>
    <select id="isWfactiondeftempHaveKysl" resultType="java.lang.Integer">
        select count(1)
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
            and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
            and a.action_def_id like '%_kysl'
    </select>
    <select id="checkRightById" resultType="java.lang.Integer">
        select count(1)
        from fw_right a
        where a.RIGHTID = #{ rightid }
    </select>
    <select id="checkRightByActiondefid" resultType="java.lang.Integer">
        select count(1)
        from fw_right a
        where a.ACTION_DEF_ID = #{ actiondefid }
    </select>
    <select id="getMaxRightid" resultType="java.lang.String">
        select max(rightid) from fw_right where rightid like '${ rightid }%'
    </select>
    <select id="getWfactiondeftempByActiondefid" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select
            action_def_id actiondefid,
            action_def_name  actiondefname,
            next_action_def_id nextactiondefid,
            sortno,
            sfht,
            sffsdx
            from wf_action_def_temp
        where ACTION_DEF_ID=#{actiondefid}
        order by sfht
    </select>

    <select id="getWfactiondeftempByNextactiondefid" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select
            action_def_id actiondefid,
            next_action_def_id nextactiondefid
        from wf_action_def_temp
        where next_action_def_id=#{nextactiondefid}
    </select>
    <select id="getWfactiondeftempFdx" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select
            action_def_id actiondefid,
            next_action_def_id nextactiondefid
        from wf_action_def_temp
        where PROCESS_DEF_ID = #{ processdefid }
    </select>

    <select id="getNoAvailRights" resultType="com.zjrs.zwnw.sxgl.po.FwrightPO">
        select c.action_def_id actionDefId,c.rightid
        from fw_right c
        where c.action_def_id like'${ processdefid }_%'
        and not exists(select 1 from wf_action_def a where a.action_def_id=c.action_def_id)
    </select>
    <select id="checkZslcHaveKysl" resultType="java.lang.Integer">
        select count(1)
        from fw_right a
        where a.action_def_id = #{actiondefid}
    </select>
    <select id="getHjmcDict" resultType="com.zjrs.zwnw.sxgl.dto.HjmcDictDTO">
        select rownum code, detail
        from (select distinct (ACTION_DEF_NAME) as detail
        from wf_action_def
        order by ACTION_DEF_NAME)
        where detail in ('办结', '窗口受理', '退单', '科员受理')
    </select>
    <select id="getWfactiondefHj" resultType="java.lang.String">
        select a.ACTION_DEF_ID
        from wf_action_def a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        order by a.ACTION_DEF_ID
    </select>
    <select id="getWfactiondeftermHj" resultType="java.lang.String">
        select a.ACTION_DEF_ID
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        and a.sfht = '0'
        group by a.ACTION_DEF_ID
        order by a.ACTION_DEF_ID
    </select>

    <select id="getLctNodes" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLcpzLctListDTO">
        select ACTION_DEF_ID id, ACTION_DEF_NAME name
        from wf_action_def_temp
        where  PROCESS_DEF_ID = #{ processdefid }
        group by ACTION_DEF_ID, ACTION_DEF_NAME
    </select>
    <select id="getLctEdges" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLcpzLctListDTO">
        select ACTION_DEF_ID source, NEXT_ACTION_DEF_ID target
        from wf_action_def_temp
        where NEXT_ACTION_DEF_ID is not null
        and PROCESS_DEF_ID = #{ processdefid }
    </select>
    <select id="getRssxconfigIdByProcessdefid" resultType="java.lang.String">
        select b.RS_SX_CONFIG_LSH id
        from wf_action_def a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and a.PROCESS_DEF_ID = #{ processdefid }
        and rownum = 1
    </select>
    <select id="getAdminOperid" resultType="java.lang.String">
        select operid
        from fw_operator
        where  LOGINID not in ('admin')
            and SGUSERID = #{ userid }
            and rownum = 1
    </select>

    <delete id="delFwoperator2right" parameterType="map">
        delete from fw_operator2right
            where  OPERID = #{map.operid}
                and RIGHTID in
                    (select c.rightid
                        from fw_right c
                         where c.action_def_id like'${ map.processdefid }_%'
                            and exists
                            (select 1
                            from wf_action_def a
                            where a.action_def_id = c.action_def_id))
    </delete>

    <select id="getRightsByProcessdefid" resultType="com.zjrs.zwnw.sxgl.po.FwrightPO">
        select c.action_def_id actionDefId,c.rightid
            from fw_right c
            where c.action_def_id like'${ processdefid }_%'
            and  exists(select 1 from wf_action_def a where a.action_def_id=c.action_def_id)
    </select>
    <insert id="insertFwoperator2right" parameterType="com.zjrs.zwnw.sxgl.po.Fwoperator2rightPO">
        insert into fw_operator2right(ID, OPERID, RIGHTID, AUTHTYPE, AAE100, VALIDFROM, BAE002)
        values(seq_fw_operator2right.nextval,#{ po.operid },#{ po.rightid },'22','14',to_char(sysdate,'yyyymmddhh24miss'),#{ po.operid })
    </insert>

    <select id="getSxpzxxFjybList" parameterType="com.zjrs.zwnw.sxgl.dto.SxpzxxFjybQueryDTO" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxFjybListDTO">
        select RS_SX_CONFIG_FILE_LSH,
        RS_SX_CONFIG_LSH,
        WJMC,
        TYCC_LSH,
        (select user_name from s_sg_user where id=BAE002) cjr,
        BAE003                cjsj
        from RS_SX_CONFIG_FILE
        where RS_SX_CONFIG_LSH = #{ dto.rsSxConfigLsh }
        order by BAE003 desc
    </select>
    <select id="checkAllHjHavePre" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxLchjDTO">
        select a.action_def_name actiondefname
        from wf_action_def_temp a
        where a.ACTION_DEF_ID in
        (select a.ACTION_DEF_ID
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        and sfht = '0'
        and SORTNO not in ('13', '78', '99')
        MINUS
        select NEXT_ACTION_DEF_ID
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        and a.NEXT_ACTION_DEF_ID in
        (select a.ACTION_DEF_ID
        from wf_action_def_temp a, rs_sx_config b
        where a.process_def_name = b.process_def_name
        and b.rs_sx_config_lsh = #{ rsSxConfigLsh }
        and SORTNO not in ('13', '78', '99')))
    </select>
    <select id="getSxpzxxBySxbm" resultType="com.zjrs.zwnw.sxgl.dto.SxpzxxXsDTO">
        select a.sxbm, a.sxmc,a.glsx
        from RS_SX_CONFIG a
        where a.sxbm = #{ sxbm }
    </select>

</mapper>
