修改状态
This commit is contained in:
parent
825674398f
commit
f1190bb43b
|
@ -271,19 +271,38 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult deleteByIds(PersonnelDeleteRequest ids) {
|
public AjaxResult deleteByIds(PersonnelDeleteRequest ids) {
|
||||||
List<String> asList = Arrays.asList(ids.getIds());
|
List<String> idList = Arrays.asList(ids.getIds());
|
||||||
for (String s : asList) {
|
|
||||||
Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper<Personnel>().eq(Personnel::getId, s).eq(Personnel::getAlterationSign, "1")
|
for (String id : idList) {
|
||||||
.eq(Personnel::getChangeAlterationSign, "1").in(Personnel::getAuditState, 1, 2).in(Personnel::getChangeAuditState, 1, 2));
|
Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper<Personnel>()
|
||||||
|
.eq(Personnel::getId, id)
|
||||||
|
.eq(Personnel::getAlterationSign, "1")
|
||||||
|
.eq(Personnel::getChangeAlterationSign, "1")
|
||||||
|
.in(Personnel::getAuditState, 1, 2)
|
||||||
|
.in(Personnel::getChangeAuditState, 1, 2));
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(personnel)) {
|
if (ObjectUtil.isNotEmpty(personnel)) {
|
||||||
return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!");
|
return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isEmpty(asList)) {
|
|
||||||
|
if (CollectionUtil.isEmpty(idList)) {
|
||||||
return AjaxResult.fail().msg("Id不能为空!");
|
return AjaxResult.fail().msg("Id不能为空!");
|
||||||
} else {
|
} else {
|
||||||
int i = personnelMapper.deleteBatchIds(asList);
|
List<Personnel> personnels = personnelMapper.selectBatchIds(idList);
|
||||||
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
|
|
||||||
|
for (Personnel personnel : personnels) {
|
||||||
|
if ("退休".equals(personnel.getWorkState()) || "离职".equals(personnel.getWorkState())) {
|
||||||
|
CompanyName companyName = companyNameMapper.selectById(personnel.getCompanyName());
|
||||||
|
if (companyName != null) {
|
||||||
|
companyName.setResidualNumber(companyName.getResidualNumber() - 1);
|
||||||
|
companyNameMapper.updateById(companyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int deleteCount = personnelMapper.deleteBatchIds(idList);
|
||||||
|
return deleteCount > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue