2022-11-17 11:11:58 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
|
import com.engine.salary.entity.salaryBill.po.SalarySendRangeObj;
|
|
|
|
|
|
import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper;
|
|
|
|
|
|
import com.engine.salary.service.SalarySendRangeObjService;
|
2022-11-17 14:25:10 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-11-17 11:11:58 +08:00
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
|
import weaver.conn.mybatis.MyBatisFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
2022-11-17 14:25:10 +08:00
|
|
|
|
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
|
|
|
|
|
|
|
2022-11-17 11:11:58 +08:00
|
|
|
|
public class SalarySendRangeObjServiceImpl extends Service implements SalarySendRangeObjService {
|
|
|
|
|
|
|
|
|
|
|
|
private <R> R runSalarySendRangeObjMapper(Function<SalarySendRangeObjMapper, R> mapper) {
|
2022-11-17 14:25:10 +08:00
|
|
|
|
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
|
|
|
|
|
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
|
2022-11-17 11:11:58 +08:00
|
|
|
|
return mapper.apply(salarySendRangeObjMapper);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-17 14:25:10 +08:00
|
|
|
|
public List<SalarySendRangeObj> listBySalarySendIdAndRangeIds(Long salarySendId, List<Long> rangeIds) {
|
|
|
|
|
|
if (salarySendId == null || CollectionUtils.isEmpty(rangeIds)) {
|
2022-11-17 11:11:58 +08:00
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
}
|
2022-11-17 14:25:10 +08:00
|
|
|
|
return runSalarySendRangeObjMapper(mapper ->
|
|
|
|
|
|
mapper.listBySalarySendIdAndRangeIds(salarySendId, rangeIds, DEFAULT_TENANT_KEY)
|
2022-11-17 11:11:58 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-17 14:25:10 +08:00
|
|
|
|
public void batchInsert(List<SalarySendRangeObj> listObj) {
|
|
|
|
|
|
if (listObj == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<List<SalarySendRangeObj>> p = Lists.partition(listObj, 150);
|
|
|
|
|
|
p.forEach(list-> runSalarySendRangeObjMapper(m->m.batchInsert(list)));
|
2022-11-17 11:11:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-17 14:25:10 +08:00
|
|
|
|
public void deleteBySalarySendIds(Collection<Long> salarySendIds) {
|
|
|
|
|
|
runSalarySendRangeObjMapper(mapper->mapper.deleteBySalarySendIds(salarySendIds));
|
2022-11-17 11:11:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-17 14:25:10 +08:00
|
|
|
|
public void deleteByRangeIds(Collection<Long> rangeIds, Long currentEmployeeId) {
|
2022-11-17 11:11:58 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-17 14:25:10 +08:00
|
|
|
|
public List<Long> getSendInfoIdsBySalarySendIdAndRangeIds(Long salarySendId, List<Long> rangeIds, Long employeeId) {
|
2022-11-17 11:11:58 +08:00
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|