员工管理
parent
2b392ec1d1
commit
fa79d7a83b
|
@ -35,7 +35,6 @@ public interface RemoteDeptService {
|
||||||
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||||
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId);
|
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @param dept:
|
* @param dept:
|
||||||
* @return Result
|
* @return Result
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.couplet.common.system.remote;
|
||||||
|
|
||||||
|
import com.couplet.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.system.domain.SysUser;
|
||||||
|
import com.couplet.common.system.remote.factory.RemoteEmployeeFallbackFactory;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param null:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 远程调用用户服务
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteEmployeeService",
|
||||||
|
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||||
|
fallbackFactory = RemoteEmployeeFallbackFactory.class,
|
||||||
|
path = "/user")
|
||||||
|
public interface RemoteEmployeeService {
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result<TableDataInfo<SysUser>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 调用用户列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Result<TableDataInfo<SysUser>> list (SysUser user);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加用户管理
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result add (@Validated @RequestBody SysUser user);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改用户
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public Result edit (@Validated @RequestBody SysUser user);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param userIds:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除用户
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{userIds}")
|
||||||
|
public Result remove (@PathVariable(value = "userIds") Long[] userIds);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param null:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description X修改用户状态
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public Result changeStatus (@RequestBody SysUser user);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result<List<SysUser>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据deptId获取企业下有那些员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping("userList/{deptId}")
|
||||||
|
public Result<List<SysUser>> userList(@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* @author fufanrui
|
* @author fufanrui
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @description: TODO
|
* @description: 企业服务降级处理
|
||||||
* @date 2024/3/27 15:29
|
* @date 2024/3/27 15:29
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -30,7 +30,6 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
*
|
*
|
||||||
|
@ -41,6 +40,7 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
|
||||||
public Result<List<SysDept>> getSysDeptByDeptId(Long deptId) {
|
public Result<List<SysDept>> getSysDeptByDeptId(Long deptId) {
|
||||||
return Result.error("调用失败...."+cause.getMessage());
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @param cause:
|
* @param cause:
|
||||||
* @return RemoteDeptService
|
* @return RemoteDeptService
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.couplet.common.system.remote.factory;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.system.domain.SysUser;
|
||||||
|
import com.couplet.common.system.remote.RemoteEmployeeService;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 员工服务降级处理
|
||||||
|
* @date 2024/3/31 19:43
|
||||||
|
*/
|
||||||
|
public class RemoteEmployeeFallbackFactory implements FallbackFactory<RemoteEmployeeService> {
|
||||||
|
@Override
|
||||||
|
public RemoteEmployeeService create(Throwable cause) {
|
||||||
|
return new RemoteEmployeeService() {
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result<TableDataInfo<SysUser>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 员工列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<TableDataInfo<SysUser>> list(SysUser user) {
|
||||||
|
return Result.error("调用失败"+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result add(SysUser user) {
|
||||||
|
return Result.error("调用失败"+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result edit(SysUser user) {
|
||||||
|
return Result.error("调用失败"+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result remove(Long[] userIds) {
|
||||||
|
return Result.error("调用失败"+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result changeStatus(SysUser user) {
|
||||||
|
return Result.error("调用失败"+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<SysUser>> userList(Long deptId) {
|
||||||
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,3 +2,4 @@ com.couplet.common.system.remote.factory.RemoteUserFallbackFactory
|
||||||
com.couplet.common.system.remote.factory.RemoteLogFallbackFactory
|
com.couplet.common.system.remote.factory.RemoteLogFallbackFactory
|
||||||
com.couplet.common.system.remote.factory.RemoteFileFallbackFactory
|
com.couplet.common.system.remote.factory.RemoteFileFallbackFactory
|
||||||
com.couplet.common.system.remote.factory.RemoteDeptFallbackFactory
|
com.couplet.common.system.remote.factory.RemoteDeptFallbackFactory
|
||||||
|
com.couplet.common.system.remote.factory.RemoteEmployeeFallbackFactory
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.couplet.server.controller;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.common.system.domain.SysUser;
|
||||||
|
import com.couplet.server.service.EmployeeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.couplet.common.core.utils.PageUtils.startPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 员工管理控制器
|
||||||
|
* @date 2024/3/31 19:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("employee")
|
||||||
|
public class EmployeeController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmployeeService employeeservice;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result<List<SysUser>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 员工列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:list")
|
||||||
|
@PostMapping("employeeList")
|
||||||
|
public Result<TableDataInfo<SysUser>> userList (SysUser user){
|
||||||
|
startPage();
|
||||||
|
List<SysUser> list = employeeservice.userList(user);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@RequiresPermissions("system:user:add")
|
||||||
|
public Result insert (@RequestBody SysUser user) {
|
||||||
|
return employeeservice.insert(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result edit (@RequestBody SysUser user) {
|
||||||
|
return employeeservice.deit(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param userIds:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:remove")
|
||||||
|
@DeleteMapping("/{userIds}")
|
||||||
|
public Result remove (@PathVariable(value = "userIds") Long[] userIds) {
|
||||||
|
return employeeservice.remove(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改员工状态
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:edit")
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public Result changeStatus(@RequestBody SysUser user){
|
||||||
|
return employeeservice.changeStatus(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -28,7 +28,7 @@ public class ManageController {
|
||||||
* @description 登入后获取到企业下的所有部门
|
* @description 登入后获取到企业下的所有部门
|
||||||
* @date
|
* @date
|
||||||
*/
|
*/
|
||||||
@GetMapping("manageList")
|
@PostMapping("manageList")
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
public Result<List<SysDept>> manageList() {
|
public Result<List<SysDept>> manageList() {
|
||||||
List<SysDept> sysDepts = manageServer.selectDeptList();
|
List<SysDept> sysDepts = manageServer.selectDeptList();
|
||||||
|
@ -51,6 +51,13 @@ public class ManageController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param sysDept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改企业部门信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@RequiresPermissions("system:dept:edit")
|
@RequiresPermissions("system:dept:edit")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
@ -58,6 +65,13 @@ public class ManageController {
|
||||||
return manageServer.manageEdit(sysDept);
|
return manageServer.manageEdit(sysDept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除部门信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@RequiresPermissions("system:dept:remove")
|
@RequiresPermissions("system:dept:remove")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deptId}")
|
@DeleteMapping("/{deptId}")
|
||||||
|
@ -71,6 +85,13 @@ public class ManageController {
|
||||||
// return manageServer.getSysDeptByDeptId(deptId);
|
// return manageServer.getSysDeptByDeptId(deptId);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据deptId获取信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@RequiresPermissions("system:dept:query")
|
@RequiresPermissions("system:dept:query")
|
||||||
@GetMapping(value = "/{deptId}")
|
@GetMapping(value = "/{deptId}")
|
||||||
public Result getInfo(@PathVariable Long deptId) {
|
public Result getInfo(@PathVariable Long deptId) {
|
||||||
|
@ -79,15 +100,16 @@ public class ManageController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 获取企业列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@GetMapping("/list/exclude/{deptId}")
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
public Result excludeChild(@PathVariable(value = "deptId") Long deptId) {
|
public Result excludeChild(@PathVariable(value = "deptId") Long deptId) {
|
||||||
return manageServer.excludeChild(deptId);
|
return manageServer.excludeChild(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.couplet.server.service;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.system.domain.SysUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EmployeeService {
|
||||||
|
TableDataInfo<SysUser> employeeList(SysUser user);
|
||||||
|
|
||||||
|
Result insert(SysUser user);
|
||||||
|
|
||||||
|
Result deit(SysUser user);
|
||||||
|
|
||||||
|
Result remove(Long[] userIds);
|
||||||
|
|
||||||
|
Result changeStatus(SysUser user);
|
||||||
|
|
||||||
|
List<SysUser> userList(SysUser user);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.couplet.server.service.impl;
|
||||||
|
|
||||||
|
import com.couplet.common.core.constant.SecurityConstants;
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.security.utils.SecurityUtils;
|
||||||
|
import com.couplet.common.system.domain.LoginUser;
|
||||||
|
import com.couplet.common.system.domain.SysUser;
|
||||||
|
import com.couplet.common.system.remote.RemoteEmployeeService;
|
||||||
|
import com.couplet.common.system.remote.RemoteUserService;
|
||||||
|
import com.couplet.server.service.EmployeeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 员工管理服务实现类
|
||||||
|
* @date 2024/3/31 19:42
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EmployeeServiceImpl implements EmployeeService{
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteEmployeeService remoteEmployeeService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param null:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 员工列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysUser> employeeList(SysUser user) {
|
||||||
|
Result<TableDataInfo<SysUser>> list = remoteEmployeeService.list(user);
|
||||||
|
TableDataInfo<SysUser> employeeList = list.getData();
|
||||||
|
return employeeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result insert(SysUser user) {
|
||||||
|
return remoteEmployeeService.add(user);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改员工信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result deit(SysUser user) {
|
||||||
|
return remoteEmployeeService.edit(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param userIds:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除员工信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result remove(Long[] userIds) {
|
||||||
|
return remoteEmployeeService.remove(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param user:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改员工状态
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result changeStatus(SysUser user) {
|
||||||
|
return remoteEmployeeService.changeStatus(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> userList(SysUser user) {
|
||||||
|
String username = SecurityUtils.getUsername();
|
||||||
|
Result<LoginUser> userInfo = remoteUserService.getUserInfo(username, SecurityConstants.FROM_SOURCE);
|
||||||
|
LoginUser data = userInfo.getData();
|
||||||
|
SysUser sysUser = data.getSysUser();
|
||||||
|
Long deptId = sysUser.getDeptId();
|
||||||
|
Result<List<SysUser>> listResult = remoteEmployeeService.userList(deptId);
|
||||||
|
List<SysUser> userList = listResult.getData();
|
||||||
|
return userList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -29,42 +29,78 @@ public class ManageServiceImpl implements ManageServer{
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteUserService remoteUserService;
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param :
|
||||||
|
* @return List<SysDept>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 企业管理列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDept> selectDeptList() {
|
public List<SysDept> selectDeptList() {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
String username = loginUser.getUsername();
|
Long deptId = loginUser.getSysUser().getDeptId();
|
||||||
Result<LoginUser> userInfo = remoteUserService.getUserInfo(username, SecurityConstants.FROM_SOURCE);
|
|
||||||
LoginUser user = userInfo.getData();
|
|
||||||
Long deptId = user.getDeptId();
|
|
||||||
Result<List<SysDept>> sysDeptByDeptId = remoteDeptService.getSysDeptByDeptId(deptId);
|
Result<List<SysDept>> sysDeptByDeptId = remoteDeptService.getSysDeptByDeptId(deptId);
|
||||||
List<SysDept> dept = sysDeptByDeptId.getData();
|
List<SysDept> dept = sysDeptByDeptId.getData();
|
||||||
return dept;
|
return dept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param sysDept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result insertDept(SysDept sysDept) {
|
public Result insertDept(SysDept sysDept) {
|
||||||
|
|
||||||
return remoteDeptService.add(sysDept);
|
return remoteDeptService.add(sysDept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param sysDept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改企业部门信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result manageEdit(SysDept sysDept) {
|
public Result manageEdit(SysDept sysDept) {
|
||||||
return remoteDeptService.edit(sysDept);
|
return remoteDeptService.edit(sysDept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除企业部门信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result manageRemove(Long deptId) {
|
public Result manageRemove(Long deptId) {
|
||||||
return remoteDeptService.remove(deptId);
|
return remoteDeptService.remove(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 获取企业信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result getInfo(Long deptId) {
|
public Result getInfo(Long deptId) {
|
||||||
return remoteDeptService.getInfo(deptId);
|
return remoteDeptService.getInfo(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 获取企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result excludeChild(Long deptId) {
|
public Result excludeChild(Long deptId) {
|
||||||
return remoteDeptService.excludeChild(deptId);
|
return remoteDeptService.excludeChild(deptId);
|
||||||
|
|
|
@ -1,20 +1,31 @@
|
||||||
package com.couplet.system.controller;
|
package com.couplet.system.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.couplet.common.core.constant.SecurityConstants;
|
||||||
import com.couplet.common.core.constant.UserConstants;
|
import com.couplet.common.core.constant.UserConstants;
|
||||||
import com.couplet.common.core.utils.StringUtils;
|
import com.couplet.common.core.utils.StringUtils;
|
||||||
import com.couplet.common.core.web.controller.BaseController;
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.page.PageDomain;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
|
import com.couplet.common.core.web.page.TableSupport;
|
||||||
import com.couplet.common.log.annotation.Log;
|
import com.couplet.common.log.annotation.Log;
|
||||||
import com.couplet.common.log.enums.BusinessType;
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
import com.couplet.common.security.annotation.RequiresPermissions;
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
import com.couplet.common.security.utils.SecurityUtils;
|
import com.couplet.common.security.utils.SecurityUtils;
|
||||||
|
import com.couplet.common.system.domain.LoginUser;
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
|
import com.couplet.common.system.remote.RemoteUserService;
|
||||||
import com.couplet.system.service.SysDeptService;
|
import com.couplet.system.service.SysDeptService;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.math3.analysis.solvers.BrentSolver;
|
import org.apache.commons.math3.analysis.solvers.BrentSolver;
|
||||||
|
import org.apache.commons.math3.analysis.solvers.SecantSolver;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
|
@ -26,7 +37,8 @@ public class SysDeptController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptService deptService;
|
private SysDeptService deptService;
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
/**
|
/**
|
||||||
* 获取部门列表
|
* 获取部门列表
|
||||||
*/
|
*/
|
||||||
|
@ -110,14 +122,13 @@ public class SysDeptController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
*
|
||||||
* @param deptId 企业ID
|
|
||||||
* @return 企业信息,内含有部门
|
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||||
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId){
|
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId){
|
||||||
List<SysDept> sysDept = deptService.getSysDeptByDeptId(deptId);
|
List<SysDept> sysDepts = deptService.getSysDeptByDeptId(deptId);
|
||||||
Result<List<SysDept>> success = Result.success(sysDept);
|
Result<List<SysDept>> success = Result.success(sysDepts);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class SysUserController extends BaseController {
|
||||||
* 获取用户列表
|
* 获取用户列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:user:list")
|
@RequiresPermissions("system:user:list")
|
||||||
@GetMapping("/list")
|
@PostMapping("/list")
|
||||||
public Result<TableDataInfo<SysUser>> list (SysUser user) {
|
public Result<TableDataInfo<SysUser>> list (SysUser user) {
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
@ -107,7 +107,7 @@ public class SysUserController extends BaseController {
|
||||||
// 权限集合
|
// 权限集合
|
||||||
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
||||||
// 查询企业信息
|
// 查询企业信息
|
||||||
Long deptId = deptService.selectDeptIdByLeader(sysUser.getUserName());
|
Long deptId = deptService.selectDeptIdByLeader(sysUser.getDept().getLeader());
|
||||||
LoginUser sysUserVo = new LoginUser();
|
LoginUser sysUserVo = new LoginUser();
|
||||||
sysUserVo.setSysUser(sysUser);
|
sysUserVo.setSysUser(sysUser);
|
||||||
sysUserVo.setRoles(roles);
|
sysUserVo.setRoles(roles);
|
||||||
|
@ -291,4 +291,19 @@ public class SysUserController extends BaseController {
|
||||||
public Result deptTree (SysDept dept) {
|
public Result deptTree (SysDept dept) {
|
||||||
return success(deptService.selectDeptTreeList(dept));
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param null:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据deptId获取企业下的员工
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping("userList/{deptId}")
|
||||||
|
public Result<List<SysUser>> userList(@PathVariable(value = "deptId") Long deptId){
|
||||||
|
List<SysUser> userList = userService.userList(deptId);
|
||||||
|
Result<List<SysUser>> success = Result.success(userList);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById (Long deptId);
|
public int deleteDeptById (Long deptId);
|
||||||
|
|
||||||
SysDept selectDeptIdByLeader(String userName);
|
List<SysDept> selectDeptIdByLeader(String userName);
|
||||||
|
|
||||||
List<SysDept> getSysDeptByDeptId(Long deptId);
|
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||||
|
|
||||||
|
|
|
@ -139,4 +139,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysUser checkEmailUnique (String email);
|
public SysUser checkEmailUnique (String email);
|
||||||
|
|
||||||
|
List<SysUser> userList(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.couplet.system.service;
|
package com.couplet.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import com.couplet.system.domain.vo.TreeSelect;
|
import com.couplet.system.domain.vo.TreeSelect;
|
||||||
|
|
||||||
|
@ -138,15 +139,17 @@ public interface SysDeptService extends IService<SysDept> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过负责人查询企业ID
|
* 通过负责人查询企业ID
|
||||||
* @param userName 负责人
|
* @param leader 负责人
|
||||||
* @return 企业ID
|
* @return 企业ID
|
||||||
*/
|
*/
|
||||||
Long selectDeptIdByLeader (String userName);
|
Long selectDeptIdByLeader(String leader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
* @param deptId 企业ID
|
* @param deptId 企业ID
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
List<SysDept> getSysDeptByDeptId(Long deptId);
|
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,4 +225,6 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||||
|
|
||||||
|
List<SysUser> userList(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.couplet.common.core.exception.ServiceException;
|
||||||
import com.couplet.common.core.text.Convert;
|
import com.couplet.common.core.text.Convert;
|
||||||
import com.couplet.common.core.utils.SpringUtils;
|
import com.couplet.common.core.utils.SpringUtils;
|
||||||
import com.couplet.common.core.utils.StringUtils;
|
import com.couplet.common.core.utils.StringUtils;
|
||||||
|
import com.couplet.common.core.web.page.TableDataInfo;
|
||||||
import com.couplet.common.datascope.annotation.DataScope;
|
import com.couplet.common.datascope.annotation.DataScope;
|
||||||
import com.couplet.common.security.utils.SecurityUtils;
|
import com.couplet.common.security.utils.SecurityUtils;
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
|
@ -284,16 +285,16 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
/**
|
/**
|
||||||
* 通过负责人查询企业ID
|
* 通过负责人查询企业ID
|
||||||
*
|
*
|
||||||
* @param userName 负责人
|
* @param leader 负责人
|
||||||
*
|
*
|
||||||
* @return 企业ID
|
* @return 企业ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long selectDeptIdByLeader (String userName) {
|
public Long selectDeptIdByLeader (String leader) {
|
||||||
|
|
||||||
SysDept sysDept = deptMapper.selectDeptIdByLeader(userName);
|
List<SysDept> sysDept = deptMapper.selectDeptIdByLeader(leader);
|
||||||
|
Long deptId = sysDept.get(0).getDeptId();
|
||||||
return sysDept == null ? null : sysDept.getDeptId();
|
return sysDept == null ? null : deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,9 +309,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysDept> getSysDeptByDeptId(Long deptId) {
|
public List<SysDept> getSysDeptByDeptId(Long deptId) {
|
||||||
|
|
||||||
return deptMapper.getSysDeptByDeptId(deptId);
|
return deptMapper.getSysDeptByDeptId(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -502,4 +502,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
return successMsg.toString();
|
return successMsg.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysUser> userList(Long deptId) {
|
||||||
|
|
||||||
|
return userMapper.userList(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,10 +109,13 @@
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDeptIdByLeader" resultType="com.couplet.common.system.domain.SysDept">
|
<select id="selectDeptIdByLeader" resultType="com.couplet.common.system.domain.SysDept">
|
||||||
SELECT * FROM sys_dept d LEFT JOIN sys_user u on d.dept_id = u.dept_id WHERE u.user_name = #{userName}
|
SELECT * FROM sys_dept d WHERE d.leader = #{leader}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSysDeptByDeptId" resultType="com.couplet.common.system.domain.SysDept">
|
<select id="getSysDeptByDeptId" resultType="com.couplet.common.system.domain.SysDept">
|
||||||
SELECT * FROM sys_dept WHERE parent_id = #{deptId}
|
SELECT d.*
|
||||||
|
FROM sys_dept AS d
|
||||||
|
WHERE CONCAT(',', d.ancestors, ',') LIKE CONCAT('%,', #{deptId}, ',%') AND d.dept_id != #{deptId} AND d.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="com.couplet.common.system.domain.SysDept">
|
<insert id="insertDept" parameterType="com.couplet.common.system.domain.SysDept">
|
||||||
|
|
|
@ -183,6 +183,10 @@
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="userList" resultType="com.couplet.common.system.domain.SysUser">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
WHERE u.dept_id = #{deptId} AND u.del_flag=0
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="com.couplet.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="com.couplet.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
|
|
Loading…
Reference in New Issue