Browse Source

update 修改权限 部门管理显示问题 日志记录打印sql

bzd_lxf 5 months ago
parent
commit
3f627c6b1c

+ 2 - 0
health-admin/src/main/java/com/bzd/HealthApplication.java

@@ -3,6 +3,7 @@ package com.bzd;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 /**
  * 启动程序
@@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  * @author LiXiagnFei
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@EnableTransactionManagement
 public class HealthApplication
 {
     public static void main(String[] args)

+ 5 - 1
health-admin/src/main/java/com/bzd/web/controller/system/SysUserController.java

@@ -334,7 +334,11 @@ public class SysUserController extends BaseController
     @ResponseBody
     public List<Ztree> deptTreeData()
     {
-        List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
+        //获取用户信息
+        SysUser user = getSysUser();
+        SysDept dept = new SysDept();
+        dept.setDeptId(user.getDeptId());
+        List<Ztree> ztrees = deptService.selectDeptTree(dept);
         return ztrees;
     }
 

+ 1 - 1
health-admin/src/main/resources/mybatis/mybatis-config.xml

@@ -12,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
         <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
         <setting name="defaultExecutorType"      value="SIMPLE" />
 		<!-- 指定 MyBatis 所用日志的具体实现 -->
-        <setting name="logImpl"                  value="SLF4J"  />
+        <setting name="logImpl"                  value="STDOUT_LOGGING"  />
         <!-- 使用驼峰命名法转换字段 -->
 		<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
 	</settings>

+ 3 - 3
health-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -36,10 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 
 	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
-        <include refid="selectDeptVo"/>
-        where d.del_flag = '0'
+		<include refid="selectDeptVo"/>
+		where d.del_flag = '0'
 		<if test="deptId != null and deptId != 0">
-			AND dept_id = #{deptId}
+			and FIND_IN_SET( #{deptId}, ancestors ) or dept_id = #{deptId}
 		</if>
         <if test="parentId != null and parentId != 0">
 			AND parent_id = #{parentId}