From bf7532c954e1c978955b0d03eaa97cea34a88317 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 18 Jan 2024 18:33:45 +0800
Subject: [PATCH] 用户详情查询修改

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |    7 +++++--
 src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java  |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 src/main/java/org/springblade/modules/system/vo/UserDetailVO.java  |    2 +-
 3 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index bd86792..02d097a 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -111,8 +111,9 @@
     <resultMap id="selectUserDetailMap" type="org.springblade.modules.system.vo.UserDetailVO" autoMapping="true">
         <id property="id" column="id" />
         <collection property="deptList"  javaType="java.util.List"
-                    ofType="org.springblade.modules.system.entity.Dept" autoMapping="true">
+                    ofType="org.springblade.modules.system.vo.DeptDetailVO" autoMapping="true">
             <id property="id" column="cid"/>
+            <id property="level" column="region_level"/>
         </collection>
     </resultMap>
 
@@ -120,10 +121,12 @@
     <select id="getUserInfo" resultMap="selectUserDetailMap">
         SELECT
         bu.*,
-        bd.id as cid,bd.parent_id,bd.ancestors,bd.dept_category,bd.dept_name,bd.full_name,bd.sort,bd.region_code
+        bd.id as cid,bd.parent_id,bd.ancestors,bd.dept_category,bd.dept_name,bd.full_name,bd.sort,bd.region_code,
+        br.region_level
         FROM blade_user bu
         left join blade_user_dept bud on bud.user_id = bu.id
         left join blade_dept bd on bud.dept_id = bd.id and bd.is_deleted = 0
+        left join blade_region br on br.code = bd.region_code
         where bu.is_deleted = 0
         and bu.id = #{userId}
     </select>
diff --git a/src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java b/src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java
new file mode 100644
index 0000000..2e37d7f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java
@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.system.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tool.node.INode;
+import org.springblade.modules.system.entity.Dept;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "DeptVO对象", description = "DeptVO对象")
+public class DeptDetailVO extends Dept {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 层级
+	 */
+	private Integer level;
+}
diff --git a/src/main/java/org/springblade/modules/system/vo/UserDetailVO.java b/src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
index d2a455f..170acc9 100644
--- a/src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
+++ b/src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
@@ -42,5 +42,5 @@
 
 	private List<Role> roleList = new ArrayList<>();
 
-	private List<Dept> deptList = new ArrayList<>();
+	private List<DeptDetailVO> deptList = new ArrayList<>();
 }

--
Gitblit v1.9.3