This commit is contained in:
lijiaqi 2024-01-10 13:49:27 +08:00
parent 3e46af3895
commit 708195d8df
3 changed files with 27 additions and 6 deletions

View File

@ -56,9 +56,11 @@ public class PersonnelController extends BaseController {
@ApiImplicitParam(name = "column", value = "排序字段 字段名"),
@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "isInfo", value = "是否退休列表")})
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column,Boolean isInfo){
return personnelService.personnelList(getPage(),request,orderBy,column,isInfo);
@ApiImplicitParam(name = "isInfo", value = "是否退休列表"),
@ApiImplicitParam(name = "deptId", value = "部门id"),
})
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column,Boolean isInfo,String deptId){
return personnelService.personnelList(getPage(),request,orderBy,column,isInfo,deptId);
}
@GetMapping("getById")

View File

@ -26,7 +26,7 @@ public interface IPersonnelService {
* 人员列表
* @return
*/
AjaxResult personnelList(Page page , SelectRequest request, String orderBy, String column, Boolean isInfo);
AjaxResult personnelList(Page page , SelectRequest request, String orderBy, String column, Boolean isInfo,String deptId);
AjaxResult getById(String id,String type,String personnelType);
AjaxResult personnelByExchangeList();

View File

@ -19,6 +19,7 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.CacheUtil;
import com.ydool.common.utils.ColumnUtil;
import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.oa.workFlow.data.entity.WorkFlow;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.staff.dto.AttachmentDto;
@ -59,6 +60,7 @@ import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper;
import com.ydool.system.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -131,14 +133,31 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Resource
private PlacesMapper placesMapper;
@Autowired
private UserServiceImpl userService;
/**
* 人员列表
*
* @return
*/
@Override
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo) {
QueryWrapper wrapper = selectWrapper(request, orderBy, column,isInfo);
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo,String deptId) {
QueryWrapper<Personnel> wrapper = selectWrapper(request, orderBy, column,isInfo);
User user = userService.getOne(new QueryWrapper<User>().lambda()
.eq(User::getId, StpUtil.getLoginIdAsString())
.last("limit 1")
);
if ("all".equals(user.getPermissions())) {
wrapper.lambda().eq(StrUtil.isNotBlank(deptId), Personnel::getPresentDept, deptId);
} else if ("dept".equals(user.getPermissions())) {
wrapper.lambda().eq(Personnel::getPresentDept, user.getDept());
} else if ("my".equals(user.getPermissions())) {
// todo 查看自己的
} else {
return AjaxResult.fail("无权限");
}
Page personnelPage = page(page, wrapper);
List<Personnel> list = personnelPage.getRecords();
personnelPage.setRecords(list.stream().map(e -> {