| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class DownloadService implements DownloadMapper { |
| | | @Autowired |
| | | PathHelper pathHelper; |
| | | |
| | | @Autowired |
| | | DownloadMapper downloadMapper; |
| | | |
| | |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return downloadMapper.selectByPage(name, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountForExport(Integer createUser, String name) { |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return downloadMapper.selectCountForExport(createUser, name); |
| | | } |
| | | |
| | | @Override |
| | | public List<DownloadEntity> selectByPageForExport(Integer createUser, String name, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeStr(name); |
| | | |
| | | return downloadMapper.selectByPageForExport(createUser, name, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public Integer updates(List<DownloadEntity> list) { |
| | | return downloadMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | * |
| | | * @param de 下载实体类 |
| | | * @return 下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | } |