Commit 01b69e69 by zhangzhijie

通辽侦查指令单点登录问题修复

parent 010dc78e
...@@ -29,7 +29,17 @@ ...@@ -29,7 +29,17 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version> <exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 添加jedis客户端 -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -85,9 +95,12 @@ ...@@ -85,9 +95,12 @@
<!-- 数据库驱动包--> <!-- 数据库驱动包-->
<dependency> <dependency>
<groupId>org.oracle</groupId> <groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId> <artifactId>ojdbc6</artifactId>
<version>10</version> <version>11.2.0.3</version>
<!-- <groupId>org.oracle</groupId>-->
<!-- <artifactId>ojdbc6</artifactId>-->
<!-- <version>10</version>-->
</dependency> </dependency>
<!-- alibaba的druid数据库连接池 --> <!-- alibaba的druid数据库连接池 -->
<dependency> <dependency>
......
...@@ -101,7 +101,8 @@ public class LoginController { ...@@ -101,7 +101,8 @@ public class LoginController {
if(user!=null){ if(user!=null){
request.getSession().setAttribute("user",user);//登录成功生成session request.getSession().setAttribute("user",user);//登录成功生成session
//设置权限 //设置权限
String perurl = loginQx(user,response,qxUrl+"/xzxt_shiro/access/xzxtlogin");; //String perurl = loginQx(user,response,qxUrl+"/xzxt_shiro/access/xzxtlogin");;
String perurl = loginService.getUserPermission(user.getId());
if (user.getUsername().equals("admin")) { if (user.getUsername().equals("admin")) {
request.getSession().setAttribute("perurl","admin");//权限url 放入session中 request.getSession().setAttribute("perurl","admin");//权限url 放入session中
......
...@@ -4,6 +4,8 @@ import com.founder.model.User; ...@@ -4,6 +4,8 @@ import com.founder.model.User;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* Created by Founder on 2018/9/3. * Created by Founder on 2018/9/3.
*/ */
...@@ -11,4 +13,6 @@ import org.springframework.stereotype.Component; ...@@ -11,4 +13,6 @@ import org.springframework.stereotype.Component;
@Mapper @Mapper
public interface LoginDao { public interface LoginDao {
User getUserByUser(User user); User getUserByUser(User user);
List<String> getUserPermission(String userId);
} }
...@@ -7,4 +7,6 @@ import com.founder.model.User; ...@@ -7,4 +7,6 @@ import com.founder.model.User;
*/ */
public interface ILoginService { public interface ILoginService {
User getUserByUser(User user); User getUserByUser(User user);
String getUserPermission(String id);
} }
...@@ -6,6 +6,8 @@ import com.founder.model.User; ...@@ -6,6 +6,8 @@ import com.founder.model.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* Created by Founder on 2018/9/3. * Created by Founder on 2018/9/3.
*/ */
...@@ -21,4 +23,20 @@ public class LoginService implements ILoginService{ ...@@ -21,4 +23,20 @@ public class LoginService implements ILoginService{
u = loginDao.getUserByUser(user); u = loginDao.getUserByUser(user);
return u; return u;
} }
@Override
public String getUserPermission(String userId) {
String perurl = "";
System.out.println(userId);
List<String> permissions = loginDao.getUserPermission(userId);
if (permissions == null && permissions.size() > 0) {
StringBuilder builder = new StringBuilder();
for (String permission : permissions) {
builder.append(permission).append(",");
}
perurl = builder.toString();
}
//perurl = "A010101,A010102";
return perurl;
}
} }
...@@ -13,11 +13,18 @@ ...@@ -13,11 +13,18 @@
UNITNAME unitname, UNITNAME unitname,
PASSWORD password, PASSWORD password,
POLICEMANID policemanid POLICEMANID policemanid
from sys_user where SCBZ='0' and OPEN_FLAG='1' from SYS_USER where SCBZ='0' and OPEN_FLAG='1'
<if test="policemanid!=null and policemanid!=''">and POLICEMANID=#{policemanid, jdbcType=VARCHAR}</if> <if test="policemanid!=null and policemanid!=''">and POLICEMANID=#{policemanid, jdbcType=VARCHAR}</if>
<if test="username!=null and username!=''">and username=#{username, jdbcType=VARCHAR}</if> <if test="username!=null and username!=''">and username=#{username, jdbcType=VARCHAR}</if>
<if test="unitcode!=null and unitcode!=''">and UNITCODE=#{unitcode, jdbcType=VARCHAR}</if> <if test="unitcode!=null and unitcode!=''">and UNITCODE=#{unitcode, jdbcType=VARCHAR}</if>
</select> </select>
<select id="getUserPermission" resultType="java.lang.String">
select b.PERMISSIONID
from SYS_USER_ROLE a
join SYS_ROLE_PERMISSION b on a.ROLE_ID = b.ROLEID
where a.USER_ID = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment