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

import com.jeeplus.common.config.Global;
import com.jeeplus.common.oss.OSSClientUtil;
import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.service.CrudService;
import com.jeeplus.modules.appversion.dao.AppversionsDao;
import com.jeeplus.modules.appversion.entity.Appversions;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * app版本信息Service
 * @author YangFan
 * @version 2017-07-07
 */
@Service
@Transactional(readOnly = true)
public class AppversionsService extends CrudService<AppversionsDao, Appversions> {

	public Appversions get(String id) {
		return super.get(id);
	}
	
	public List<Appversions> findList(Appversions appversions) {
		return super.findList(appversions);
	}
	
	public Page<Appversions> findPage(Page<Appversions> page, Appversions appversions) {
		return super.findPage(page, appversions);
	}
	
	@Transactional(readOnly = false)
	public void save(Appversions appversions, MultipartFile appFile) {
		if(appFile !=null && !appFile.isEmpty() && appFile.getSize()>0){
			OSSClientUtil ossClientUtil = new OSSClientUtil();
			String aliyunUrl = ossClientUtil.uploadImg2OSSAndroid(appFile, "appData");
			appversions.setUrl(aliyunUrl);
		}
		super.save(appversions);
	}
	
	@Transactional(readOnly = false)
	public void delete(Appversions appversions) {
		super.delete(appversions);
	}




}