/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.entity.LiKuResourcePool;
import com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.mapper.LiKuResourcePoolMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 利库资源池Service
 * @author enford
 * @version 1.0
 */
@Service
@Transactional(readOnly = true)
public class LiKuResourcePoolService extends CrudService<LiKuResourcePoolMapper, LiKuResourcePool> {

	@Override
	public LiKuResourcePool get(String id) {
		return super.get(id);
	}

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

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

	@Override
	@Transactional(readOnly = false)
	public void save(LiKuResourcePool entity) {
		super.save(entity);
	}

	@Override
	@Transactional(readOnly = false)
	public void delete(LiKuResourcePool entity) {
		super.delete(entity);
	}

	@Transactional(readOnly = false)
	public void insertList(List<LiKuResourcePool> list) {
		for (LiKuResourcePool li :
				list) {
			li.preInsert();
		}
		mapper.insertList(list);
	}


	/**
	 * 清空利库资源池数据
	 */
	@Transactional(readOnly = false)
	public void clearLiKuResource() {
		mapper.clearLiKuResource();
	}

	/**
	 * 查询所有本部利库资源数据
	 */
	public List<LiKuResourcePool> findLiKuList(Integer isSectionLength, Integer whereFrom) {
		return mapper.findLiKuList(isSectionLength, whereFrom);
	}

	/**
	 * 更新物资上报后利库
	 */
	@Transactional(readOnly = false)
	public void updateAllList(List<LiKuResourcePool> list) {
		mapper.updateAllList(list);
	}

}