You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
c7-523/SystemRentController.java

50 lines
1.7 KiB

package com.qsd.orange.controller;
import com.qsd.orange.global.HttpResult;
import com.qsd.orange.global.R;
import com.qsd.orange.service.RentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("system/rent")
public class SystemRentController {
@Autowired
private RentService rentService;
@GetMapping("all")
public R all(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit
){
return R.success().page(rentService.sysAll(page, limit));
}
@GetMapping("search")
public R search(
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "9") Integer limit,
Integer status,
String keyword,
Integer type
){
switch (type){
case 0:
return R.success().page(rentService.sysSearch(page, limit, status, "id", keyword));
case 1:
return R.success().page(rentService.sysSearch(page, limit, status, "customer_identity", keyword));
case 2:
return R.success().page(rentService.sysSearch(page, limit, status, "car_number", keyword));
default:
return R.error(HttpResult.PARAM_ERROR);
}
}
}