package com.engine.salary.biz;

import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
import com.engine.salary.mapper.archive.SalaryArchiveDimissionMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;

import java.util.List;

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

    public void updateById(SalaryArchiveDimissionPO po) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SalaryArchiveDimissionMapper mapper = sqlSession.getMapper(SalaryArchiveDimissionMapper.class);
            mapper.updateIgnoreNull(po);
            sqlSession.commit();
        } finally {
            sqlSession.close();
        }
    }

    public void insert(SalaryArchiveDimissionPO build) {
        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SalaryArchiveDimissionMapper mapper = sqlSession.getMapper(SalaryArchiveDimissionMapper.class);
            mapper.insertIgnoreNull(build);
            sqlSession.commit();
        } finally {
            sqlSession.close();
        }
    }
}
