2016-03-09 5 views
1

Spring безопасности, когда предполагается использовать базу данных, найдены следующие запросы будут descrbed в безопасности-context.xmlSpring Security - изменение запросов в безопасности-context.xml

users-by-username-query= 
select username,password,enabled from authentication where username=? 

authorities-by-username-query= 
select u.username, ur.authority from authentication u, authenticationrole ur 
where u.authenticationId = ur.authenticationId and u.username =? 

имеет две аутентификации таблицы и authenticationrole

authentication -> authenticationid, username, password, ENABLED(0/1) 

authenticationrole -> authenticationroleid, authenticationid, authority 

Хотите изменить эти запросы в соответствии с моей структуры БД

user -> userid, username, password, userstatus(0/1) 

role -> roleid, rolecode, rolename 

userrole -> roleid, userid 

ответ

1

Try т его

пользователей-по-имя пользователя-запрос

select username,password, userstatus from user where username=? 

власть-по-имя пользователя-запрос

select user.username, role.rolename from 
    user join userrole on user.userid=userrole.userid 
    join role on userrole.roleid=role.roleid, 
    where user.username=? 
+1

Благодаря @pragnani, он работал !!!! – MAX

Смежные вопросы