package com.engine.salary.biz;

import com.engine.salary.entity.salarysob.po.SalarySobDefaultItemGroupPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.mapper.salarysob.SalarySobDefaultItemGroupMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;

import java.util.List;

public class SalarySobDefaultItemGroupBiz {

    public List<SalarySobDefaultItemGroupPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SalarySobDefaultItemGroupMapper mapper = sqlSession.getMapper(SalarySobDefaultItemGroupMapper.class);
            return mapper.listSome(SalarySobDefaultItemGroupPO.builder().incomeCategory(incomeCategory.getValue()).build());
        } finally {
            sqlSession.close();
        }
    }

}
