SELECT
ars.resource_id,
ars.resource_name,
ars.resource_url,
ars.resource_desc,
ars.resource_parent_id,
ars.resource_sort,
ars.resource_type,
ars.resource_product_id,
ars.create_date,
ars.update_date,
ars.resource_icon
FROM
auth_user_role aur,
auth_role_resource arr,
auth_resource ars
WHERE
<if test="userId != null">
aur.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userId != null">
AND aur.user_type = #{userType,jdbcType=INTEGER}
</if>
AND aur.role_id = arr.role_id
AND arr.resource_id = ars.resource_id
ORDER BY
ars.resource_id ASC
ars.resource_id,
ars.resource_name,
ars.resource_url,
ars.resource_desc,
ars.resource_parent_id,
ars.resource_sort,
ars.resource_type,
ars.resource_product_id,
ars.create_date,
ars.update_date,
ars.resource_icon
FROM
auth_user_role aur,
auth_role_resource arr,
auth_resource ars
WHERE
<if test="userId != null">
aur.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userId != null">
AND aur.user_type = #{userType,jdbcType=INTEGER}
</if>
AND aur.role_id = arr.role_id
AND arr.resource_id = ars.resource_id
ORDER BY
ars.resource_id ASC