MyBatis 获取用户操作列表,带动态 SQL 和权限控制
<p>@Select('<script>
' + ' SELECT * FROM (SELECT ID, USER_ID, MENU_ID, COUNT, CREATE_TIME, UPDATE_TIME
' + ' FROM T_IAC_USER_ACTION
' + ' WHERE USER_ID = #{id}
' + ' <if test='!isAdministrator'>
' + ' AND MENU_ID IN
' + ' <foreach item='item' index='index' collection='userAssociatedMenuIdSet' open='(' separator=',' close=')'>
' + ' #{item}
' + ' </foreach>
' + ' </if>
' + ' ORDER BY COUNT)
' + ' WHERE ROWNUM <= 5
' + ' </script>')
' + 'List<UserAction> getUserActionList(@Param('isAdministrator') boolean isAdministrator,
' + ' @Param('id') String id,
' + ' @Param('userAssociatedMenuIdSet') Set<String> userAssociatedMenuIdSet);</p>
原文地址: https://www.cveoy.top/t/topic/nw6W 著作权归作者所有。请勿转载和采集!