Pārlūkot izejas kodu

增加归属公司id冗余

yzc 1 gadu atpakaļ
vecāks
revīzija
077577fcb9

+ 12 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -179,6 +179,9 @@ public class SysUser extends BaseEntity {
     private String ddUserId;
     private Long companyId;
 
+    @TableField(exist = false)
+    private Long ofCompanyId;
+
     /**
      * 关键字
      */
@@ -196,6 +199,15 @@ public class SysUser extends BaseEntity {
 
     //================================================================
 
+
+    public Long getOfCompanyId() {
+        return ofCompanyId;
+    }
+
+    public void setOfCompanyId(Long ofCompanyId) {
+        this.ofCompanyId = ofCompanyId;
+    }
+
     public String getCompanyName() {
         return companyName;
     }

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

@@ -65,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="type != null">
 			AND d.type = #{type}
 		</if>
+		<if test="ancestors != null">
+			AND FIND_IN_SET( #{ancestors}, d.ancestors )
+		</if>
 <!--		<if test="tenantId != null and tenantId != ''">-->
 <!--			AND d.tenant_id = #{tenantId}-->
 <!--		</if>-->

+ 2 - 0
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="userCode" column="user_code"/>
 		<result property="userType"     column="user_type"	  />
 		<result property="companyId"     column="company_id"	  />
+		<result property="ofCompanyId"     column="company_id"	  />
 		<result property="companySet"     column="company_set"	  />
 		<association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
         <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
@@ -76,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			   u.tenant_id,
 			   u.user_code,
 			   u.company_id,
+			   u.company_id as ofCompanyId,
 			   u.company_set,
 			   d.dept_id,
 			   d.parent_id,