首页 > 其他分享 >2023-12-11

2023-12-11

时间:2023-12-11 19:24:47浏览次数:29  
标签:11 12 RequestParam backendmanage 2023 import total com example

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);
    }
}

 

标签:11,12,RequestParam,backendmanage,2023,import,total,com,example
From: https://www.cnblogs.com/wllovelmbforever/p/17895331.html

相关文章