lxw
2022-09-07 fabb5ca75a65da3b1ed8b6447b75d3ca191f93de
查询软件列表的信息
1个文件已添加
2个文件已修改
38 ■■■■ 已修改文件
src/main/java/com/whyc/controller/SoftwareController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/SoftwareMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SoftwareService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/SoftwareController.java
@@ -5,12 +5,10 @@
import com.whyc.service.SoftwareService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@@ -39,4 +37,11 @@
        return response;
    }
    @ApiOperation(value = "查询软件列表的信息")
    @GetMapping("getAllSoftware")
    public Response getAllSoftware(@RequestParam(required = false) String fileName,@RequestParam int pageCurr,@RequestParam int pageSize ){
        return service.getAllSoftware(fileName,pageCurr,pageSize);
    }
}
src/main/java/com/whyc/mapper/SoftwareMapper.java
New file
@@ -0,0 +1,6 @@
package com.whyc.mapper;
import com.whyc.pojo.Software;
public interface SoftwareMapper extends CustomMapper<Software>{
}
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,"软件信息返回");
    }
}