DemoController.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.yihu.client.controller;
  2. import io.swagger.annotations.Api;
  3. import io.swagger.annotations.ApiOperation;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.jdbc.core.JdbcTemplate;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.*;
  8. import javax.websocket.server.PathParam;
  9. /**
  10. * Created by chenweida on 2018/5/23 0023.
  11. */
  12. @RestController
  13. @RequestMapping("demo")
  14. @Api(description = "demo例子")
  15. public class DemoController {
  16. @Autowired
  17. private JdbcTemplate jdbcTemplate;
  18. @ApiOperation(value = "ceshisql")
  19. @RequestMapping(value = "/testSQL", method = RequestMethod.GET)
  20. public String loginfoGET(
  21. String sql
  22. ) {
  23. jdbcTemplate.queryForList(sql);
  24. jdbcTemplate.queryForList(sql);
  25. jdbcTemplate.queryForList(sql);
  26. return "成功";
  27. }
  28. @ApiOperation(value = "ceshisql")
  29. @RequestMapping(value = "/testSQL", method = RequestMethod.DELETE)
  30. public String loginfoDELETE(
  31. String sql
  32. ) {
  33. jdbcTemplate.queryForList(sql);
  34. jdbcTemplate.queryForList(sql);
  35. jdbcTemplate.queryForList(sql);
  36. return "成功";
  37. }
  38. @ApiOperation(value = "ceshisql")
  39. @RequestMapping(value = "/testSQL", method = RequestMethod.PUT)
  40. public String loginfoPUT(
  41. String sql
  42. ) {
  43. jdbcTemplate.queryForList(sql);
  44. jdbcTemplate.queryForList(sql);
  45. jdbcTemplate.queryForList(sql);
  46. return "成功";
  47. }
  48. @ApiOperation(value = "ceshisql")
  49. @RequestMapping(value = "/testSQL", method = RequestMethod.POST)
  50. public String loginfoPOST(
  51. String sql
  52. ) throws InterruptedException {
  53. jdbcTemplate.queryForList(sql);
  54. jdbcTemplate.queryForList(sql);
  55. jdbcTemplate.queryForList(sql);
  56. return "成功";
  57. }
  58. @ApiOperation(value = "ceshisql")
  59. @RequestMapping(value = "/testSQL/{value}", method = RequestMethod.GET)
  60. public String loginfoValue(
  61. @PathVariable(value = "value") String value
  62. ) {
  63. jdbcTemplate.queryForList(value);
  64. jdbcTemplate.queryForList(value);
  65. jdbcTemplate.queryForList(value);
  66. return "成功";
  67. }
  68. }