<select id="getFunctionByPage" resultMap="FunctionRlt">
SELECT
K.FUNCTION_NAME,K.FUNCTION_NO,K.URL,K.PARAM_CLASS,
FROM PUB_FUNCTION K
<choose>
<when test="model.parentFuncName!= null and model.parentFuncName!= ''">
,PUB_FUNCTION PF WHERE K.PARENT_FUNCTION_ID=PF.FUNCTION_ID
AND PF.FUNCTION_NAME LIKE '%'||#{model.parentFuncName}||'%'
<if test="model.functionName != null and model.functionName != ''">
AND K.FUNCTION_NAME LIKE '%'||#{model.functionName}||'%'
</if>
<if test="model.functionType != null and model.functionType != ''">
AND K.FUNCTION_TYPE = #{model.functionType}
</if>
<if test="model.isMobile != null and model.isMobile != ''">
AND K.IS_MOBILE = #{model.isMobile}
</if>
</when>
<!-- 根据父功能点获取子功能列表 -->
<when test="model.functionId != null and model.functionId != ''">
<where>
<choose>
<when test="model.functionId==000000L">
AND K.PARENT_FUNCTION_ID is null
</when>
<otherwise>
AND K.PARENT_FUNCTION_ID=#{model.functionId}
</otherwise>
</choose>
</where>
</when>
<otherwise>
<where>
<if test="model.functionName != null and model.functionName != ''">
AND K.FUNCTION_NAME LIKE
'%'||#{model.functionName}||'%'
</if>
<if test="model.functionType != null and model.functionType != ''">
AND K.FUNCTION_TYPE = #{model.functionType}
</if>
<if test="model.isMobile != null and model.isMobile != ''">
AND K.IS_MOBILE = #{model.isMobile}
</if>
</where>
</otherwise>
</choose>
<choose>
<when test="sort != null and sort != '' and dir != null and dir != ''">
ORDER BY ${sort} ${dir}
</when>
<otherwise>
ORDER BY K.PARENT_FUNCTION_ID,K.FUNCTION_SEQ ASC
</otherwise>
</choose>
</select>