package com.select_test.controller;
import com.select_test.service.T_classDaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/class")
public class T_classDaoController {
@GetMapping({"/{classname}",""})//设置两个路径
public Object selectByClass(@PathVariable(required=false) String classname) {
System.out.println("controller classsName");
return classDaoService.getDate(classname);
}
}
//required=false表示该参数非必要
//可以访问该controller的路径为:
//1.http://localhost:8083/class
//2.http://localhost:8083/class/一年级1班(此处为classname)
|