2022-03-15 14:18:04 +08:00
|
|
|
package com.engine.salary.biz;
|
|
|
|
|
|
|
|
|
|
import com.engine.salary.entity.datacollection.po.AttendQuoteDataValuePO;
|
|
|
|
|
import com.engine.salary.mapper.datacollection.AttendQuoteDataValueMapper;
|
2022-05-26 13:41:58 +08:00
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-03-15 14:18:04 +08:00
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
import weaver.conn.mybatis.MyBatisFactory;
|
|
|
|
|
|
2022-04-24 17:42:32 +08:00
|
|
|
import java.util.ArrayList;
|
2022-03-15 14:18:04 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class AttendQuoteDataValueBiz {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据考勤引用字段表的主键id删除
|
2022-03-16 14:29:02 +08:00
|
|
|
*
|
2022-03-15 14:18:04 +08:00
|
|
|
* @param attendQuoteDataIds
|
|
|
|
|
*/
|
|
|
|
|
public void deleteByAttendQuoteDataIds(List<Long> attendQuoteDataIds) {
|
|
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
|
2022-06-30 14:21:29 +08:00
|
|
|
List<List<Long>> partition = Lists.partition(attendQuoteDataIds, 500);
|
|
|
|
|
partition.forEach(mapper::deleteByAttendQuoteDataIds);
|
2022-03-15 14:18:04 +08:00
|
|
|
sqlSession.commit();
|
|
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<AttendQuoteDataValuePO> listSome(AttendQuoteDataValuePO param) {
|
2024-01-29 10:05:30 +08:00
|
|
|
List<AttendQuoteDataValuePO> list = new ArrayList<>();
|
2022-03-15 14:18:04 +08:00
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
|
2024-01-29 10:05:30 +08:00
|
|
|
|
|
|
|
|
List<Long> employeeIds = param.getEmployeeIds();
|
2024-02-20 10:06:17 +08:00
|
|
|
if (CollectionUtils.isNotEmpty(employeeIds)) {
|
|
|
|
|
List<List<Long>> partition = Lists.partition(employeeIds, 100);
|
|
|
|
|
partition.forEach(empIds -> {
|
|
|
|
|
param.setEmployeeIds(empIds);
|
|
|
|
|
list.addAll(mapper.listSome(param));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2024-01-29 10:05:30 +08:00
|
|
|
list.addAll(mapper.listSome(param));
|
2024-02-20 10:06:17 +08:00
|
|
|
}
|
2022-03-15 14:18:04 +08:00
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
2024-01-29 10:05:30 +08:00
|
|
|
return list;
|
2022-03-15 14:18:04 +08:00
|
|
|
}
|
|
|
|
|
|
2022-03-16 14:29:02 +08:00
|
|
|
public void insertData(List<AttendQuoteDataValuePO> values) {
|
2024-01-29 10:05:30 +08:00
|
|
|
if (CollectionUtils.isEmpty(values)) {
|
2022-05-26 13:41:58 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2022-03-16 14:29:02 +08:00
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
|
2022-05-26 13:41:58 +08:00
|
|
|
List<List<AttendQuoteDataValuePO>> partition = Lists.partition(values, 100);
|
|
|
|
|
partition.forEach(mapper::insertData);
|
2022-03-16 14:29:02 +08:00
|
|
|
sqlSession.commit();
|
|
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-24 17:42:32 +08:00
|
|
|
|
2024-02-23 15:11:56 +08:00
|
|
|
public void deleteByAttendQuoteIds(List<Long> quoteIds) {
|
2022-04-24 17:42:32 +08:00
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
|
|
|
|
|
mapper.deleteByAttendIds(quoteIds);
|
|
|
|
|
sqlSession.commit();
|
|
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-28 16:15:51 +08:00
|
|
|
|
|
|
|
|
public void updateDataValue(AttendQuoteDataValuePO po) {
|
|
|
|
|
|
2024-01-29 10:05:30 +08:00
|
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
|
|
|
try {
|
|
|
|
|
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
|
|
|
|
|
mapper.updateDataValueByFiledIdAndEmployeeId(po);
|
|
|
|
|
sqlSession.commit();
|
|
|
|
|
} finally {
|
|
|
|
|
sqlSession.close();
|
|
|
|
|
}
|
2022-10-28 16:15:51 +08:00
|
|
|
|
|
|
|
|
}
|
2022-03-15 14:18:04 +08:00
|
|
|
}
|