ExampleController.kt 843 B

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