<typeAlias alias="businessScopeItem" type="com.sdfrdj.vo.BusinessScopeItem"/>
<typeAlias alias="businessScopeSubItem" type="com.sdfrdj.vo.BusinessScopeSubItem"/>
    <resultMap class="businessScopeItem" id="allItemResultMap">
<result property="item_id" column="ITEM_ID"/>
<result property="item" column="ITEM"/>
<result property="unit_id" column="UNIT_ID"/>
<result property="seq" column="SEQ"/>
<result property="createdate" column="CREATEDATE"/>
<result property="isdel" column="ISDEL"/>
<result property="businessScopeSubItemList" column="item_id" select="getBusinessScopeSubItemByItemId"/>
</resultMap> <resultMap class="businessScopeSubItem" id="subItemResultMap">
<result property="subitem_id" column="SUBITEM_ID"/>
<result property="item_id" column="ITEM_ID"/>
<result property="subitem" column="SUBITEM"/>
<result property="content" column="CONTENT"/>
<result property="rules" column="RULES"/>
<result property="limitdate" column="LIMITDATE"/>
<result property="createdate" column="CREATEDATE"/>
<result property="isdel" column="ISDEL"/>
</resultMap>
<!-- 查询所有业务范围事项子事项-->
<select id="selectAllBusinessScopeList" resultMap="allItemResultMap" parameterClass="businessScopeItem">
SELECT
ITEM_ID,
ITEM,
UNIT_ID,
SEQ,
TO_CHAR(CREATEDATE,'yyyy-MM-dd') CREATEDATE,
ISDEL
FROM T_BUSINESS_SCOPE_ITEM
WHERE 1=1
<isNotEmpty prepend="and" property="unit_id">
UNIT_ID=#unit_id#
</isNotEmpty>
<isNotEmpty prepend="and" property="item">
ITEM like '%$item$%'
</isNotEmpty>
<isNotEmpty prepend="and" property="isdel">
ISDEL=#isdel#
</isNotEmpty>
ORDER BY ITEM_ID
</select> <!-- 根据事项查询所有子事项-->
<select id="getBusinessScopeSubItemByItemId" parameterClass="java.lang.String" resultMap="subItemResultMap">
SELECT
SUBITEM_ID,
ITEM_ID,
SUBITEM,
CONTENT,
RULES,
LIMITDATE,
TO_CHAR(CREATEDATE,'yyyy-MM-dd') CREATEDATE,
ISDEL
FROM T_BUSINESS_SCOPE_SUBITEM
WHERE ITEM_ID=#item_id# AND ISDEL='0'
ORDER BY SUBITEM_ID
</select>
05-19 09:09