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

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleBlock;
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleListing;
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.mapper.ModuleBlockMapper;
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.mapper.ModuleListingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional(readOnly = true)
public class ModuleListingService extends CrudService<ModuleListingMapper, ModuleListing> {
	@Autowired
	private ModuleListingMapper moduleListingMapper;


	public ModuleListing get(String id) {
		return super.get(id);
	}
	
	public List<ModuleListing> findList(ModuleListing moduleListing) {
		return super.findList(moduleListing);
	}

	public Page<ModuleListing> findPage(Page<ModuleListing> page, ModuleListing moduleListing) {
		return super.findPage(page, moduleListing);
	}
	
	@Transactional(readOnly = false)
	public void save(ModuleListing moduleListing) {
		super.save(moduleListing);
	}

	//文件导入
	@Transactional(readOnly = false)
	public void savaList(List<ModuleListing> listings){
		for (ModuleListing moduleListing:listings){
			moduleListing.preInsert();
		}
		moduleListingMapper.insertList(listings);
	}
	//根据版本号的id查找对应的模块清单
	public List<ModuleListing> findByList(List<ModuleBlock> moduleBlocks){
		return moduleListingMapper.findByList(moduleBlocks);
	}
}