package com.jeeplus.modules.sg.managementcenter.reserveManagement.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.filing.basicInformation.entity.BasicInformationChild;
import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ScaleDetails;
import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.ScaleDetailsMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 * 人员流转 Service
 */
@Service
@Transactional(readOnly = true)
public class ScaleDetailsService extends CrudService<ScaleDetailsMapper, ScaleDetails> {

    @Override
    public ScaleDetails get(ScaleDetails entity) {
        ScaleDetails standard = mapper.get(entity);
        return standard;
    }

    @Override
    public ScaleDetails get(String id) {
        ScaleDetails standard = mapper.get(id);
        return standard;
    }

    @Override
    public List<ScaleDetails> findList(ScaleDetails entity) {
        return super.findList(entity);
    }

    @Override
    public Page<ScaleDetails> findPage(Page<ScaleDetails> page, ScaleDetails entity) {
        return super.findPage(page, entity);
    }

    public Page<ScaleDetails> findExaminePage(Page<ScaleDetails> page, ScaleDetails entity) {
        dataRuleFilter(entity);
        entity.setPage(page);
        page.setList(mapper.findExamineList(entity));
        return page;
    }


    @Override
    @Transactional(readOnly = false)
    public void save(ScaleDetails entity) {
        if (entity.getIsNewRecord()) {
            entity.preInsert();
            mapper.insert(entity);
        } else {
            entity.preUpdate();
            mapper.update(entity);
        }
    }

    @Transactional(readOnly = false)
    public void insert(ScaleDetails entity) {
        mapper.insert(entity);
    }

    @Transactional(readOnly = false)
    public void update(ScaleDetails entity) {
        mapper.update(entity);
    }

    @Override
    @Transactional(readOnly = false)
    public void deleteAll(Collection<ScaleDetails> entitys) {
        super.deleteAll(entitys);
    }

    public List<ScaleDetails> exportList(String[] ids) {
        return mapper.exportList(ids);
    }


    public List<ScaleDetails> exportAfterList(String[] ids) {
        return mapper.exportAfterList(ids);
    }

}
