ExampleController.kt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.gxzc.zen.controller
  2. import com.gxzc.zen.api.sys.model.SysDept
  3. import com.gxzc.zen.api.sys.service.ISysDeptService
  4. import com.gxzc.zen.mq.publisher.Sender
  5. import org.slf4j.LoggerFactory
  6. import org.springframework.beans.factory.annotation.Autowired
  7. import org.springframework.transaction.annotation.Transactional
  8. import org.springframework.web.bind.annotation.GetMapping
  9. import org.springframework.web.bind.annotation.RestController
  10. @RestController
  11. class ExampleController {
  12. companion object {
  13. private val logger = LoggerFactory.getLogger(ExampleController::class.java)
  14. }
  15. @Autowired
  16. lateinit var sysDeptService: ISysDeptService
  17. @Autowired
  18. lateinit var sender: Sender
  19. @GetMapping("test")
  20. @Transactional
  21. fun test() {
  22. // logger.info("a: {}", sysDeptService.selectCount(EntityWrapper<SysDept>().where("1","1000L")))
  23. // logger.info("b: {}", sysDeptMapper.selectCount(EntityWrapper<SysDept>()))
  24. sysDeptService.insert(SysDept().also {
  25. it.deptName = "ahaha"
  26. it.sort = 2
  27. it.principal = "a"
  28. })
  29. }
  30. @GetMapping("testMq")
  31. fun testMq() {
  32. for (i in 1..10) {
  33. sender.send("msg $i")
  34. // Thread.sleep(1000)
  35. }
  36. }
  37. }