外部人员名称不可重复
This commit is contained in:
parent
942a3b2a97
commit
b77e7a737c
|
|
@ -9,6 +9,7 @@ import com.engine.salary.entity.extemp.po.ExtEmpPO;
|
|||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.extemp.ExternalEmployeeMapper;
|
||||
import com.engine.salary.service.ExtEmpService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
|
|
@ -18,6 +19,7 @@ import com.engine.salary.util.page.SalaryPageUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -58,6 +60,12 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
|
|||
|
||||
@Override
|
||||
public void save(ExtEmpSaveParam param) {
|
||||
|
||||
List<ExtEmpPO> extEmpPOS = getExternalEmployeeMapper().listSome(ExtEmpPO.builder().username(param.getUsername()).build());
|
||||
if (CollectionUtils.isNotEmpty(extEmpPOS)) {
|
||||
throw new SalaryRunTimeException("姓名已存在!");
|
||||
}
|
||||
|
||||
ExtEmpPO po = new ExtEmpPO();
|
||||
BeanUtils.copyProperties(param, po);
|
||||
|
||||
|
|
@ -75,6 +83,15 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
|
|||
|
||||
@Override
|
||||
public void update(ExtEmpSaveParam param) {
|
||||
|
||||
ExtEmpPO oldPO = getExternalEmployeeMapper().getById(param.getId());
|
||||
if (!StringUtils.equals(oldPO.getUsername(), param.getUsername())) {
|
||||
List<ExtEmpPO> extEmpPOS = getExternalEmployeeMapper().listSome(ExtEmpPO.builder().username(param.getUsername()).build());
|
||||
if (CollectionUtils.isNotEmpty(extEmpPOS)) {
|
||||
throw new SalaryRunTimeException("姓名已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
ExtEmpPO po = new ExtEmpPO();
|
||||
BeanUtils.copyProperties(param, po);
|
||||
|
||||
|
|
@ -105,7 +122,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
|
|||
}
|
||||
List<ExtEmpPO> extEmpPOS = new ArrayList<>();
|
||||
List<List<Long>> partition = Lists.partition(ids, 500);
|
||||
partition.forEach(list ->extEmpPOS.addAll(getExternalEmployeeMapper().listSome(ExtEmpPO.builder().ids(list).build())) );
|
||||
partition.forEach(list -> extEmpPOS.addAll(getExternalEmployeeMapper().listSome(ExtEmpPO.builder().ids(list).build())));
|
||||
return coverList(extEmpPOS);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue