实现类
SysUser sysUser = ShiroUtils.getSysUser();
if (!sysUser.isAdmin()) {
wgEnterpriceStyle.setCreateUserId(sysUser.getUserId());
}
mapper.xml
oracle写法
<select id="selectWgEnterpriceStyleList" resultMap="WgEnterpriceStyleResult">
<include refid="selectWgEnterpriceStyleVo"/>
LEFT join SYS_USER u on f.create_user_id = u.user_id
<if test="wgEnterpriceStyle.createUserId != null">
INNER JOIN (
select
DEPT_ID
from
SYS_DEPT start with DEPT_ID = (select DEPT_ID from SYS_USER where user_id = #{wgEnterpriceStyle.createUserId}) connect
by prior DEPT_ID = PARENT_ID
)d on u.dept_id = d.DEPT_ID
</if>
</select>
<