ExampleController.kt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package com.gxzc.zen.controller
  2. import com.baomidou.kisso.annotation.Action
  3. import com.baomidou.kisso.annotation.Login
  4. import com.baomidou.kisso.annotation.Permission
  5. import com.gxzc.zen.api.sys.service.ISysPermissionService
  6. import com.gxzc.zen.api.sys.service.ISysUserService
  7. import org.slf4j.LoggerFactory
  8. import org.springframework.beans.factory.annotation.Autowired
  9. import org.springframework.cache.CacheManager
  10. import org.springframework.web.bind.annotation.GetMapping
  11. import org.springframework.web.bind.annotation.RestController
  12. @RestController
  13. class ExampleController {
  14. companion object {
  15. private val logger = LoggerFactory.getLogger(ExampleController::class.java)
  16. }
  17. @Autowired
  18. private lateinit var cacheManager: CacheManager
  19. @Autowired
  20. private lateinit var sysUserService: ISysUserService
  21. @Autowired
  22. private lateinit var sysPermissionService: ISysPermissionService
  23. @GetMapping("testTransaction")
  24. fun testTransaction() {
  25. // mgrFondsService.testTransaction()
  26. }
  27. @GetMapping("testLoad")
  28. fun testLoad() {
  29. // sysUserService.selectListCacheable()
  30. }
  31. @GetMapping("testCache")
  32. @Login(action = Action.Skip)
  33. @Permission("user:crud")
  34. fun testCache() {
  35. println(cacheManager.cacheNames)
  36. val a = sysPermissionService.getPermissionSetByUserId(1)
  37. println(a)
  38. println("增量测试哦")
  39. val test = cacheManager.getCache("user")["test1"]
  40. }
  41. }