新增岗位部门没关联进去

This commit is contained in:
xuwenbo
2020-05-30 14:10:32 +08:00
parent 59e64b8ba9
commit f6fe0f2190
2 changed files with 2 additions and 4 deletions

View File

@ -81,6 +81,7 @@ public class JobController {
if (resources.getId() != null) { if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
} }
resources.setDeptId(resources.getDept().getId());
return new ResponseEntity<>(jobService.save(resources),HttpStatus.CREATED); return new ResponseEntity<>(jobService.save(resources),HttpStatus.CREATED);
} }

View File

@ -67,11 +67,9 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
//@Cacheable //@Cacheable
public List<Job> queryAll(JobQueryCriteria criteria){ public List<Job> queryAll(JobQueryCriteria criteria){
List<Job> jobList = baseMapper.selectList(QueryHelpPlus.getPredicate(Job.class, criteria)); List<Job> jobList = baseMapper.selectList(QueryHelpPlus.getPredicate(Job.class, criteria));
List<Job> jobScopeList = new ArrayList<>();
if(criteria.getDeptIds().size()==0){ if(criteria.getDeptIds().size()==0){
for (Job job : jobList) { for (Job job : jobList) {
job.setDept(deptService.getById(job.getDeptId())); job.setDept(deptService.getById(job.getDeptId()));
jobScopeList.add(job);
} }
}else { }else {
//断权限范围 //断权限范围
@ -79,12 +77,11 @@ public class JobServiceImpl extends BaseServiceImpl<JobMapper, Job> implements J
for (Job job : jobList) { for (Job job : jobList) {
if(deptId ==job.getDeptId()){ if(deptId ==job.getDeptId()){
job.setDept(deptService.getById(job.getDeptId())); job.setDept(deptService.getById(job.getDeptId()));
jobScopeList.add(job);
} }
} }
} }
} }
return jobScopeList; return jobList;
} }