2023-12-11

复制代码
package com.example.backendmanage.controller;

import com.example.backendmanage.common.AjaxResult;
import com.example.backendmanage.info.UploadFile;
import com.example.backendmanage.mapper.FileMapper;
import com.example.backendmanage.mapper.FileMapper2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * 关于file数据库的增删查改
 * */
@RestController
@RequestMapping("/file")
public class FileController2 {
    @Autowired
    FileMapper2 fileMapper2;
    @RequestMapping("/load")
    public AjaxResult load(@RequestParam(defaultValue = "") String filename,
    @RequestParam(defaultValue = "") String fileType,@RequestParam Integer pageIndex,@RequestParam Integer pageSize){
        int total=0;
        Integer pageNum=(pageIndex-1)*pageSize;
        List<UploadFile> lists=fileMapper2.findFiles(filename,fileType,pageNum,pageSize);
        List<UploadFile> AllList=fileMapper2.findAllFiles();
        if (filename.equals("")&&fileType.equals("")){
            total=AllList.size();
        }else {
            total=lists.size();
        }
        HashMap<String,Object> res=new HashMap<>();
        res.put("FindValue",lists);
        res.put("total",total);
        return AjaxResult.success(res);
    }
}
复制代码

 

posted @   超爱彬宝同学  阅读(3)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
点击右上角即可分享
微信分享提示