Delete 'BookInfoController.java'

master
pf3bvju7e 2 years ago
parent 5bc455be5a
commit dbda2c0683

@ -1,106 +0,0 @@
package com.yx.controller;
import com.github.pagehelper.PageInfo;
import com.yx.po.BookInfo;
import com.yx.po.TypeInfo;
import com.yx.service.BookInfoService;
import com.yx.service.TypeInfoService;
import com.yx.utils.DataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@Controller
public class BookInfoController {
@Autowired
private BookInfoService bookInfoService;
@Autowired
private TypeInfoService typeInfoService;
/**
*
* @return
*/
@GetMapping("/bookIndex")
public String bookIndex(){
return "book/bookIndex";
}
/**
* bookjson
* @param bookInfo
* @param pageNum
* @param limit
* @return
*/
@RequestMapping("/bookAll")
@ResponseBody //@ResponseBody将java对象转为json格式的数据表示该方法的返回结果直接写入 HTTP response body 中一般在异步ajax获取数据时使用
public DataInfo bookAll(BookInfo bookInfo, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "15") Integer limit){
PageInfo<BookInfo> pageInfo = bookInfoService.queryBookInfoAll(bookInfo,pageNum,limit);
return DataInfo.ok("成功",pageInfo.getTotal(),pageInfo.getList());//总条数getTotal数据封装成list,以便加载分页显示,由于加了ResponseBody,就会返回一个字符串
}
/**
*
*/
@GetMapping("/bookAdd")
public String bookAdd(){
return "book/bookAdd";
}
/**
*
*/
@RequestMapping("/addBookSubmit")
@ResponseBody
public DataInfo addBookSubmit(BookInfo info){
bookInfoService.addBookSubmit(info);
return DataInfo.ok();
}
/**
* id()
*/
@GetMapping("/queryBookInfoById")
public String queryTypeInfoById(Integer id, Model model){
BookInfo bookInfo= bookInfoService.queryBookInfoById(id);
model.addAttribute("info",bookInfo);
return "book/updateBook";
}
/**
*
*/
@RequestMapping("/updateBookSubmit")
@ResponseBody
public DataInfo updateBookSubmit(@RequestBody BookInfo info){
bookInfoService.updateBookSubmit(info);
return DataInfo.ok();
}
/**
*
*/
@RequestMapping("/deleteBook")
@ResponseBody
public DataInfo deleteBook(String ids){
List<String> list= Arrays.asList(ids.split(","));
bookInfoService.deleteBookByIds(list);
return DataInfo.ok();
}
@RequestMapping("/findAllList")
@ResponseBody
public List<TypeInfo> findAll(){
PageInfo<TypeInfo> pageInfo = typeInfoService.queryTypeInfoAll(null,1,100);
List<TypeInfo> lists = pageInfo.getList();
return lists;
}
}
Loading…
Cancel
Save