和ibatis及oracle有关的问题!
刚进公司上班,看到公司的代码很多这么写<selectid="selectRoleIdsByUserId"parameterClass="long"resultClass=...
刚进公司上班,看到公司的代码很多这么写
<select id="selectRoleIdsByUserId" parameterClass="long" resultClass="long">
select t1.role_id
from Sys_User_Role t1
where t1.user_id = #userId#
and exists (select 1
from sys_role t2
where t2.role_id = t1.role_id
and t2.status = '1')
</select>
及
<select id="selectRoleIdsByUserIdOnRolegroup" parameterClass="long" resultClass="long">
select t1.role_Id
from Sys_rolegroup_role t1
where exists (select 1
from sys_rolegroup t2
where t2.rolegroup_id = t1.rolegroup_id
and t2.status = '1'
and exists (select 1
from sys_oper_rolegroup t3
where t3.rolegroup_id = t2.rolegroup_id
and t3.oper_id = #operId#))
and exists (select 1
from sys_role t4
where t4.role_id = t1.role_id
and t4.status = '1')
</select>
我想问select 1 from有作用及好处啊?还有那个exist。不太理解,可以帮忙解释详细一点吗?就拿第一个举例。本人菜鸟一个! 展开
<select id="selectRoleIdsByUserId" parameterClass="long" resultClass="long">
select t1.role_id
from Sys_User_Role t1
where t1.user_id = #userId#
and exists (select 1
from sys_role t2
where t2.role_id = t1.role_id
and t2.status = '1')
</select>
及
<select id="selectRoleIdsByUserIdOnRolegroup" parameterClass="long" resultClass="long">
select t1.role_Id
from Sys_rolegroup_role t1
where exists (select 1
from sys_rolegroup t2
where t2.rolegroup_id = t1.rolegroup_id
and t2.status = '1'
and exists (select 1
from sys_oper_rolegroup t3
where t3.rolegroup_id = t2.rolegroup_id
and t3.oper_id = #operId#))
and exists (select 1
from sys_role t4
where t4.role_id = t1.role_id
and t4.status = '1')
</select>
我想问select 1 from有作用及好处啊?还有那个exist。不太理解,可以帮忙解释详细一点吗?就拿第一个举例。本人菜鸟一个! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询