lxw
2022-09-07 fabb5ca75a65da3b1ed8b6447b75d3ca191f93de
src/main/java/com/whyc/service/SoftwareService.java
@@ -1,8 +1,13 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.whyc.dto.Response;
import com.whyc.mapper.SoftwareMapper;
import com.whyc.pojo.Software;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
@@ -12,6 +17,8 @@
@Service
public class SoftwareService {
    @Autowired
    private SoftwareMapper mapper;
    public List<Software> excelParse(InputStream inputStream) throws IOException, InvalidFormatException {
        List<Software> softwareList = new LinkedList<>();
@@ -52,5 +59,15 @@
        return softwareList;
    }
    //查询软件列表的信息
    public Response getAllSoftware(String fileName, int pageCurr, int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        QueryWrapper wrapper=new QueryWrapper();
        if(fileName!=null&&!fileName.isEmpty()){
            wrapper.like("file_name",fileName);
        }
        wrapper.orderByAsc("id");
        List list=mapper.selectList(wrapper);
        return new Response().setII(1,list.size()>0,list,"软件信息返回");
    }
}