ExampleController.kt 818 B

1234567891011121314151617181920212223242526272829
  1. package com.gxzc.zen
  2. import com.gxzc.zen.sys.service.TestService
  3. import org.springframework.beans.factory.annotation.Autowired
  4. import org.springframework.ui.Model
  5. import org.springframework.web.bind.annotation.PathVariable
  6. import org.springframework.web.bind.annotation.RequestMapping
  7. import org.springframework.web.bind.annotation.RestController
  8. @RestController
  9. class ExampleController {
  10. @Autowired
  11. private val service: TestService? = null
  12. @RequestMapping("/")
  13. fun home(model: Model): String {
  14. // val one=service?.findOne(1)
  15. val list = service?.findList(mapOf())
  16. val html = "size:" + list?.size
  17. return "Hello World!" + html
  18. }
  19. @RequestMapping("/hello/{myName}")
  20. fun index(@PathVariable myName: String): String {
  21. return "Hello $myName!!!"
  22. }
  23. }