111 lines
3.9 KiB
Java
111 lines
3.9 KiB
Java
package com.engine.salary.biz;
|
|
|
|
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
|
|
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
|
import com.engine.salary.mapper.salarysob.SalarySobItemMapper;
|
|
import com.google.common.collect.Lists;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.ibatis.session.SqlSession;
|
|
import weaver.conn.mybatis.MyBatisFactory;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
public class SalarySobItemBiz {
|
|
|
|
public List<SalarySobItemPO> listAll() {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
return mapper.listAll();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
public List<SalarySobItemPO> listSome(SalarySobItemPO build) {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
return mapper.listSome(build);
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
public List<SalarySobItemPO> listBySalarySobIdWithHideItem(SalarySobItemPO build) {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
return mapper.listBySalarySobIdWithHideItem(build);
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
|
|
public void batchInsert(Collection<SalarySobItemPO> salarySobItemPOS) {
|
|
if(CollectionUtils.isEmpty(salarySobItemPOS)){
|
|
return;
|
|
}
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
List<List<SalarySobItemPO>> partition = Lists.partition((List) salarySobItemPOS, 100);
|
|
partition.forEach(mapper::batchInsert);
|
|
sqlSession.commit();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
|
|
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
mapper.deleteBySalarySobIds(salarySobIds);
|
|
sqlSession.commit();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
public void deleteItemShowBySalarySobId(Collection<Long> salarySobIds) {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
mapper.deleteItemShowBySalarySobId(salarySobIds);
|
|
sqlSession.commit();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
public void InsertItemShow(SalarySobItemHidePO salarySobItemHidePO) {
|
|
if(salarySobItemHidePO == null){
|
|
return;
|
|
}
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
mapper.insertItemShow(salarySobItemHidePO);
|
|
sqlSession.commit();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
public List<SalarySobItemPO> listBySalarySobIdAndGroupId(Long salarySobId, Collection<Long> salarySobItemGroupIds) {
|
|
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
|
try {
|
|
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
|
return mapper.listBySalarySobIdAndGroupId(salarySobId,salarySobItemGroupIds);
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
|
|
}
|