weaver-hrm-salary/src/com/engine/salary/service/impl/VariableArchiveItemServiceI...

79 lines
2.6 KiB
Java
Raw Normal View History

2024-08-09 10:21:40 +08:00
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.mapper.datacollection.VariableArchiveItemMapper;
import com.engine.salary.service.VariableArchiveItemService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
import java.util.List;
/**
* @author Harryxzy
* @ClassName VariableArchiveItemServiceImpl
* @date 2024/08/07 9:29
* @description 浮动薪酬档案明细
*/
public class VariableArchiveItemServiceImpl extends Service implements VariableArchiveItemService {
private VariableArchiveItemMapper getVariableArchiveItemMapper(){
return MapperProxyFactory.getProxy(VariableArchiveItemMapper.class);
}
/**
* 根据浮动薪资档案id获取
*
* @param variableArchiveIds
* @return
*/
@Override
public List<VariableArchiveItemPO> listByVariableArchiveIds(List<Long> variableArchiveIds) {
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return Collections.emptyList();
}
return getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
}
/**
* 查询浮动薪酬档案中已使用的浮动薪资项目
*
* @return
*/
@Override
public List<Long> listUsingItems() {
return getVariableArchiveItemMapper().listUsingItems();
}
@Override
public int batchInsert(List<VariableArchiveItemPO> insertList) {
2024-08-13 15:25:57 +08:00
if (CollectionUtils.isEmpty(insertList)) {
return 0;
}
List<List<VariableArchiveItemPO>> partition = Lists.partition(insertList, 50);
partition.forEach(part -> getVariableArchiveItemMapper().batchInsert(part));
return 0;
2024-08-09 10:21:40 +08:00
}
@Override
public void deleteByArchiveIds(List<Long> variableArchiveIds) {
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return;
}
List<List<Long>> partition = Lists.partition(variableArchiveIds, 500);
partition.forEach(part -> getVariableArchiveItemMapper().deleteByArchiveIds(part));
}
@Override
public void deleteByIds(List<Long> variableArchiveItemIds) {
if (CollectionUtils.isEmpty(variableArchiveItemIds)) {
return;
}
List<List<Long>> partition = Lists.partition(variableArchiveItemIds, 500);
partition.forEach(part -> getVariableArchiveItemMapper().deleteByIds(part));
}
}