package com.engine.salary.biz;

import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
import com.engine.salary.mapper.salaryitem.SysSalaryItemMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;

import java.util.List;

public class SysSalaryItemBiz {

    public SysSalaryItemPO getById(Long id) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SysSalaryItemMapper mapper = sqlSession.getMapper(SysSalaryItemMapper.class);
            return mapper.getById(id);
        } finally {
            sqlSession.close();
        }
    }

    public List<SysSalaryItemPO> listAll() {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SysSalaryItemMapper mapper = sqlSession.getMapper(SysSalaryItemMapper.class);
            return mapper.listAll();
        } finally {
            sqlSession.close();
        }
    }

    public List<SysSalaryItemPO> listSome(SysSalaryItemPO build) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SysSalaryItemMapper mapper = sqlSession.getMapper(SysSalaryItemMapper.class);
            return mapper.listSome(build);
        } finally {
            sqlSession.close();
        }
    }

    public SysSalaryItemPO selectOneByName(String name) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SysSalaryItemMapper mapper = sqlSession.getMapper(SysSalaryItemMapper.class);
            return mapper.selectOneByName(name);
        } finally {
            sqlSession.close();
        }
    }
}
