haoyu 2 лет назад
Родитель
Сommit
5bee524e86

+ 36 - 30
src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java

@@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.PageResult;
-import com.ydtech.modules.admin.model.QuOrders;
-import com.ydtech.modules.admin.model.QuTeamNum;
-import com.ydtech.modules.admin.model.SysDept;
-import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.QuTeamNumDto;
+import com.ydtech.modules.admin.model.dto.QuUserNumDto;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserVO;
@@ -54,8 +52,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
             ",sd.id as deptId,sd.name as deptName" +
             ",psd.id as pDeptId,psd.name as pDeptName" +
             ",t4.id as roleId" +
-            ",t4.name as roleName"
-            ;
+            ",t4.name as roleName";
 
 
     String selectUserFromSql = " from sys_user su " +
@@ -66,8 +63,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
             " left join sys_role t4 on t3.role_id=t4.id " +
             " where 1=1 " +
             " AND sd.id &lt;&gt; '' "
-            + ""
-            ;
+            + "";
 
     String selectUserFromWhereSql = " " +
 //            "<if test='page.columnFilters.usertype !=null and page.columnFilters.usertype.value!=\"\" and page.columnFilters.usertype.value!=null '>" +
@@ -77,24 +73,24 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 //            " and su.approval_status = #{page.columnFilters.approvalStatus.value}" +
 //            "</if> " +
             "<if test='page.dto !=null  '> " +
-                "<if test='page.dto.status !=null and page.dto.status!=\"\" '> " +
-                " and su.status = #{page.dto.status}" +
-                "</if> " +
-                "<if test='page.dto.name !=null and page.dto.name!=\"\" '> " +
-                " and su.name like concat('%',#{page.dto.name},'%')" +
-                "</if> " +
-                "<if test='page.dto.userId !=null and page.dto.userId!=\"\" '>" +
-                " and su.id = #{page.dto.userId}" +
-                "</if> " +
-                "<if test='page.dto.mobile !=null and page.dto.mobile!=\"\"  '>" +
-                " and su.mobile = #{page.dto.mobile}" +
-                "</if> " +
-                "<if test='page.dto.deptId !=null and page.dto.deptId!=\"\"  '>" +
-                " and su.dept_id like concat('%',#{page.dto.deptId},'%')" +
-                "</if> " +
-                "<if test='page.dto.roleId !=null and page.dto.roleId!=\"\"  '>" +
-                " and t3.role_id = #{page.dto.roleId}" +
-                "</if> " +
+            "<if test='page.dto.status !=null and page.dto.status!=\"\" '> " +
+            " and su.status = #{page.dto.status}" +
+            "</if> " +
+            "<if test='page.dto.name !=null and page.dto.name!=\"\" '> " +
+            " and su.name like concat('%',#{page.dto.name},'%')" +
+            "</if> " +
+            "<if test='page.dto.userId !=null and page.dto.userId!=\"\" '>" +
+            " and su.id = #{page.dto.userId}" +
+            "</if> " +
+            "<if test='page.dto.mobile !=null and page.dto.mobile!=\"\"  '>" +
+            " and su.mobile = #{page.dto.mobile}" +
+            "</if> " +
+            "<if test='page.dto.deptId !=null and page.dto.deptId!=\"\"  '>" +
+            " and su.dept_id like concat('%',#{page.dto.deptId},'%')" +
+            "</if> " +
+            "<if test='page.dto.roleId !=null and page.dto.roleId!=\"\"  '>" +
+            " and t3.role_id = #{page.dto.roleId}" +
+            "</if> " +
             "</if> " +
             "";
 
@@ -120,13 +116,19 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
             "LEFT JOIN sys_role r ON r.id = sur.role_id WHERE r.id IN ('21') and u.status=1 and u.dept_id=#{deptId}")
     List<SysUserVO> findByReferrerId(@Param("deptId") String deptId);
 
+
+    @Select("SELECT u.id,u.name FROM sys_user u " +
+            "LEFT JOIN sys_user_role sur ON sur.user_id = u.id " +
+            "LEFT JOIN sys_role r ON r.id = sur.role_id WHERE r.id IN ('22') and u.status=1 and u.id NOT LIKE '%M%'")
+    List<SysUser> findBackListByDeptId(@Param("deptId") String deptId);
+
     List<SysUserVO> findListByDeptId(@Param("sysUser") SysUser sysUser);
 
-    Page<SysUserBaseVO> gainUserBaseInfo(@Param("page") Page page,@Param("user") SysUserDto user);
+    Page<SysUserBaseVO> gainUserBaseInfo(@Param("page") Page page, @Param("user") SysUserDto user);
 
-    IPage<SysUserBaseVO> findUserList(@Param("page") Page page,@Param("user") SysUserDto user);
+    IPage<SysUserBaseVO> findUserList(@Param("page") Page page, @Param("user") SysUserDto user);
 
-    IPage<SysUserBaseVO> findBackUserList(@Param("page") Page page,@Param("user") SysUserDto user);
+    IPage<SysUserBaseVO> findBackUserList(@Param("page") Page page, @Param("user") SysUserDto user);
 
     /**
      * 获取用户列表
@@ -135,7 +137,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      * @param containsSubDept   是否包含下级机构
      * @return
      */
-    public IPage<SysUser> selectUserPage(Page page, @Param("sysUser")SysUser sysUser,@Param("containsSubDept")String containsSubDept);
+    public IPage<SysUser> selectUserPage(Page page, @Param("sysUser") SysUser sysUser, @Param("containsSubDept") String containsSubDept);
 
 
 
@@ -163,6 +165,10 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 
     List<QuTeamNum> getUser(@Param("quTeamNumDto")QuTeamNumDto quTeamNumDto);
 
+    List<QuUserNum> getUserNum(@Param("quUserNumDto") QuUserNumDto quUserNumDto);
+
+    List<QuUserNum> getUserByCompany(@Param("quUserNumDto") QuUserNumDto quUserNumDto);
+
 }
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/admin/model/SysUser.java

@@ -16,6 +16,7 @@ import springfox.documentation.annotations.ApiIgnore;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 用户
@@ -178,6 +179,9 @@ public class SysUser extends BaseEntity {
     @ApiModelProperty("岗位名称")
     private String positionName;
 
+    @TableField(exist = false)
+    private List<SysUser> children;
+
     /**
      * 验证用户
      *

+ 11 - 4
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -7,14 +7,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.admin.model.QuTeamNum;
+import com.ydtech.modules.admin.model.QuUserNum;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.model.dto.QuTeamNumDto;
+import com.ydtech.modules.admin.model.dto.QuUserNumDto;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
-import com.ydtech.modules.admin.model.vo.SysUser2Vo;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
-import com.ydtech.modules.admin.model.vo.SysUserInternalVO;
-import com.ydtech.modules.admin.model.vo.SysUserVO;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.base.model.dto.PageDto;
 import com.ydtech.modules.base.model.vo.PageVo;
 
@@ -126,6 +125,14 @@ public interface SysUserService extends IService<SysUser> {
      * @return
      */
     List<SysUser> findUserList(String deptId);
+
+    List<SysUser>  findTree();
+
+    List<SysUser> findBackListByDeptId(String deptId);
+
+    IPage<QuUserNum> quUserNum(QuUserNumDto quUserNumDto);
+
+    IPage<QuUserNum> getQuUserByCompany(QuUserNumDto quUserNumDto);
 }