package com.boying.controller;
|
|
import com.boying.common.BaseController;
|
import com.boying.entity.WhiteList;
|
import com.boying.service.WhiteListService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Sort;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
@RequestMapping("whiteList")
|
public class WhiteListController extends BaseController {
|
|
@Autowired
|
private WhiteListService whiteListService;
|
|
@PostMapping("findPage")
|
public Object findPage(int page,int pageSize,String carNo) {
|
Pageable pageable = PageRequest.of(page-1,pageSize, Sort.Direction.DESC,"id");
|
Page<WhiteList> pages = whiteListService.findPage2(pageable,carNo);
|
return success("",pages);
|
}
|
|
@PostMapping("save")
|
public Object save(WhiteList whiteList) {
|
whiteListService.save(whiteList);
|
return success("保存成功");
|
}
|
|
@PostMapping("delete")
|
public Object delete(Long id) {
|
whiteListService.delete(id);
|
return success("删除成功");
|
}
|
}
|