Spring安全性,当假设使用数据库时,发现以下查询要在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 =?
它有两个表身份验证和身份验证
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
答案 0 :(得分:1)
试试这个
用户按用户名查询强>
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=?