EmployeeServiceImpl.java
1.06 KB
package com.bsth.service.schedule.impl;
import com.bsth.entity.Personnel;
import com.bsth.service.schedule.EmployeeService;
import com.bsth.service.schedule.ScheduleException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Created by xu on 16/12/15.
*/
@Service
public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implements EmployeeService {
@Override
@Transactional
public void validate_gh(Personnel personnel) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (personnel.getId() != null) {
param.put("id_ne", personnel.getId());
}
param.put("companyCode_eq", personnel.getCompanyCode());
param.put("jobCode_eq", personnel.getJobCode());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("相同公司工号重复");
}
}
}