he2802 il y a 2 ans
Parent
commit
7bb61098d7
15 fichiers modifiés avec 43 ajouts et 31 suppressions
  1. 2 2
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/top/TopSysRoleController.java
  2. 1 1
      zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/top/TopSysUserController.java
  3. 1 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysRole.java
  4. 1 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysUser.java
  5. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java
  6. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/order/service/impl/TopOrderBankPayServiceImpl.java
  7. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/mapper/TopSysRoleMapper.java
  8. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/mapper/TopSysUserRoleMapper.java
  9. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/ITopSysRoleService.java
  10. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysDeptServiceImpl.java
  11. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysMenuServiceImpl.java
  12. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysRoleServiceImpl.java
  13. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysUserServiceImpl.java
  14. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/top/TopSysRoleMapper.xml
  15. 27 16
      zhongzheng-system/src/main/resources/mapper/modules/top/TopSysUserMapper.xml

+ 2 - 2
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/top/TopSysRoleController.java

@@ -6,6 +6,7 @@ import com.zhongzheng.common.annotation.Log;
 import com.zhongzheng.common.constant.UserConstants;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.model.TopLoginUser;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
@@ -14,7 +15,6 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.framework.web.service.TopSysPermissionService;
 import com.zhongzheng.framework.web.service.TopTokenService;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserService;
 import io.swagger.annotations.Api;
@@ -29,7 +29,7 @@ import java.util.List;
 
 /**
  * 角色信息Controller
- * 
+ *
  * @author ruoyi
  * @date 2023-03-10
  */

+ 1 - 1
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/top/TopSysUserController.java

@@ -8,6 +8,7 @@ import com.zhongzheng.common.constant.UserConstants;
 import com.zhongzheng.common.core.bo.SysUserEditBo;
 import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.core.domain.model.TopLoginUser;
 import com.zhongzheng.common.core.page.TableDataInfo;
@@ -19,7 +20,6 @@ import com.zhongzheng.common.utils.ToolsUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
 import com.zhongzheng.framework.web.service.TopTokenService;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.service.ITopSysPostService;
 import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserService;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/domain/TopSysRole.java → zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysRole.java

@@ -1,4 +1,4 @@
-package com.zhongzheng.modules.top.user.domain;
+package com.zhongzheng.common.core.domain.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.zhongzheng.common.annotation.Excel;

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysUser.java

@@ -144,7 +144,7 @@ public class TopSysUser implements Serializable
 
     /** 角色对象 */
     @TableField(exist = false)
-    private List<SysRole> roles;
+    private List<TopSysRole> roles;
 
     /** 角色组 */
     @TableField(exist = false)

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
@@ -67,7 +68,6 @@ import com.zhongzheng.modules.top.order.service.ITopOrderBankPayService;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCommissionExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderCompanyExportVo;
 import com.zhongzheng.modules.top.order.vo.TopOldOrderSellerExportVo;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
 import com.zhongzheng.modules.top.user.service.ITopSysConfigService;
 import com.zhongzheng.modules.top.user.service.ITopSysRoleService;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/order/service/impl/TopOrderBankPayServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ToolsUtils;
@@ -23,7 +24,6 @@ import com.zhongzheng.modules.top.order.domain.TopOrderBankPay;
 import com.zhongzheng.modules.top.order.mapper.TopOrderBankPayMapper;
 import com.zhongzheng.modules.top.order.service.ITopOrderBankPayService;
 import com.zhongzheng.modules.top.order.vo.TopOrderBankPayVo;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
 import com.zhongzheng.modules.top.user.service.ITopSysRoleService;
 import com.zhongzheng.modules.top.user.service.ITopSysUserRoleService;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/mapper/TopSysRoleMapper.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.top.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 
 import java.util.List;
 

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/mapper/TopSysUserRoleMapper.java

@@ -3,7 +3,7 @@ package com.zhongzheng.modules.top.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.common.core.domain.entity.SysRole;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
 
 import java.util.List;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/ITopSysRoleService.java

@@ -2,7 +2,7 @@ package com.zhongzheng.modules.top.user.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.common.core.domain.entity.SysRole;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 
 import java.util.List;
 import java.util.Set;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysDeptServiceImpl.java

@@ -7,10 +7,10 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.annotation.DataScope;
 import com.zhongzheng.common.constant.UserConstants;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.modules.top.user.domain.TopSysDept;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.mapper.TopSysDeptMapper;
 import com.zhongzheng.modules.top.user.mapper.TopSysRoleMapper;
 import com.zhongzheng.modules.top.user.mapper.TopSysUserMapper;

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysMenuServiceImpl.java

@@ -5,12 +5,12 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.constant.UserConstants;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.modules.system.domain.vo.MetaVo;
 import com.zhongzheng.modules.system.domain.vo.RouterVo;
 import com.zhongzheng.modules.top.user.domain.TopSysMenu;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.domain.TopSysRoleMenu;
 import com.zhongzheng.modules.top.user.mapper.TopSysMenuMapper;
 import com.zhongzheng.modules.top.user.mapper.TopSysRoleMapper;

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysRoleServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.common.annotation.DataScope;
 import com.zhongzheng.common.constant.UserConstants;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.spring.SpringUtils;
 import com.zhongzheng.modules.top.user.domain.*;

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/service/impl/TopSysUserServiceImpl.java

@@ -14,6 +14,7 @@ import com.zhongzheng.common.annotation.DataScope;
 import com.zhongzheng.common.constant.UserConstants;
 import com.zhongzheng.common.core.domain.entity.SysRole;
 import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.zhongzheng.common.core.domain.entity.TopSysRole;
 import com.zhongzheng.common.core.domain.entity.TopSysUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
@@ -25,7 +26,6 @@ import com.zhongzheng.modules.top.user.bo.TopSysUserAddBo;
 import com.zhongzheng.modules.top.user.bo.TopSysUserEditBo;
 import com.zhongzheng.modules.top.user.bo.TopSysUserQueryBo;
 import com.zhongzheng.modules.top.user.domain.TopSysPost;
-import com.zhongzheng.modules.top.user.domain.TopSysRole;
 import com.zhongzheng.modules.top.user.domain.TopSysUserPost;
 import com.zhongzheng.modules.top.user.domain.TopSysUserRole;
 import com.zhongzheng.modules.top.user.mapper.*;
@@ -191,7 +191,7 @@ public class TopSysUserServiceImpl extends ServiceImpl<TopSysUserMapper, TopSysU
                 sysUser.setRoleIds(collect);
                 List<TopSysRole> sysRoles = iTopSysRoleService.listByIds(collect);
                 if (CollectionUtils.isNotEmpty(sysRoles)){
-                    List<SysRole> collect1 = sysRoles.stream().map(x -> BeanUtil.toBean(x, SysRole.class)).collect(Collectors.toList());
+                    List<TopSysRole> collect1 = sysRoles.stream().map(x -> BeanUtil.toBean(x, TopSysRole.class)).collect(Collectors.toList());
                     sysUser.setRoles(collect1);
                 }
             }else {

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/top/TopSysRoleMapper.xml

@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zhongzheng.modules.top.user.mapper.TopSysRoleMapper">
 
-    <resultMap type="com.zhongzheng.modules.top.user.domain.TopSysRole" id="TopSysRoleResult">
+    <resultMap type="com.zhongzheng.common.core.domain.entity.TopSysRole" id="TopSysRoleResult">
         <result property="roleId" column="role_id"/>
         <result property="roleName" column="role_name"/>
         <result property="roleKey" column="role_key"/>

+ 27 - 16
zhongzheng-system/src/main/resources/mapper/modules/top/TopSysUserMapper.xml

@@ -23,6 +23,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
+        <collection property="roles" column="user_id" select="findRolesList" javaType="java.util.List" />
+    </resultMap>
+
+    <select id="findRolesList" resultMap="RoleResult">
+        SELECT
+            r.role_id,
+            r.role_name,
+            r.data_scope,
+            r.role_key
+        FROM
+            top_sys_user_role ur
+                LEFT JOIN top_sys_role r ON r.role_id = ur.role_id
+        where  ur.user_id =#{user_id}
+    </select>
+
+
+
+    <resultMap id="RoleResult" type="TopSysRole">
+        <id property="roleId" column="role_id"/>
+        <result property="roleName" column="role_name"/>
+        <result property="roleKey" column="role_key"/>
+        <result property="roleSort" column="role_sort"/>
+        <result property="dataScope" column="data_scope"/>
+        <result property="status" column="role_status"/>
     </resultMap>
 
     <sql id="selectTopUserVo">
@@ -41,23 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                u.login_date,
                u.create_by,
                u.create_time,
-               u.remark,
-               d.dept_id,
-               d.parent_id,
-               d.dept_name,
-               d.order_num,
-               d.leader,
-               d.status as dept_status,
-               r.role_id,
-               r.role_name,
-               r.role_key,
-               r.role_sort,
-               r.data_scope,
-               r.status as role_status
+               u.remark
+
         from top_sys_user u
-                 left join top_sys_dept d on u.dept_id = d.dept_id
-                 left join top_sys_user_role ur on u.user_id = ur.user_id
-                 left join top_sys_role r on r.role_id = ur.role_id
+                
     </sql>