SsoSystemController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package com.jd.controller;
  2. import com.jd.code.ConstString;
  3. import com.jd.entity.basic.SsoSystem;
  4. import com.jd.service.SsoSystemService;
  5. import com.jd.util.Blank;
  6. import com.jd.util.SendUtil;
  7. import io.swagger.annotations.Api;
  8. import io.swagger.annotations.ApiOperation;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import java.util.HashMap;
  14. import java.util.Map;
  15. /**
  16. * SSO业务系统类
  17. * @author leihy
  18. */
  19. @RestController
  20. @RequestMapping("ssoSystem")
  21. @Api(value = "SSO业务系统", tags = {"SSO业务系统"})
  22. public class SsoSystemController {
  23. private final SsoSystemService ssoSystemService;
  24. public SsoSystemController(SsoSystemService ssoSystemService) {
  25. this.ssoSystemService = ssoSystemService;
  26. }
  27. /**
  28. * 查询SSO业务系统列表
  29. * @return
  30. */
  31. @GetMapping("/getSsoSystemList")
  32. @ApiOperation(value = "查询SSO业务系统列表")
  33. public Map<String, Object> getSsoSystemList(String userId) {
  34. Map<String, Object> map = new HashMap<>(4);
  35. map.put("userId", userId);
  36. return SendUtil.send(true, ConstString.RESULT_SUCCESS, ssoSystemService.getSsoSystemList(map));
  37. }
  38. /**
  39. * 获得sso系统列表页面
  40. * @param page 页面
  41. * @param limit 限制
  42. * @param queryValue 查询值
  43. * @return {@link Map}<{@link String}, {@link Object}>
  44. */
  45. @GetMapping("getSsoSystemListByPage")
  46. @ApiOperation(value = "分页查询SSO业务系统列表")
  47. public Map<String, Object> getSsoSystemListByPage(Integer page, Integer limit, String queryValue) {
  48. if (Blank.isEmpty(page, limit)) {
  49. return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS);
  50. }
  51. Map<String, Object> param = new HashMap<>(4);
  52. param.put("start", (page - 1) * limit);
  53. param.put("limit", limit);
  54. param.put("queryValue", queryValue);
  55. return ssoSystemService.getSsoSystemListByPage(param);
  56. }
  57. /**
  58. * 插入sso系统
  59. * @param ssoSystem sso系统
  60. * @return {@link Map}<{@link String}, {@link Object}>
  61. */
  62. @PostMapping("insertSsoSystem")
  63. @ApiOperation(value = "新增SSO业务系统")
  64. public Map<String, Object> insertSsoSystem(SsoSystem ssoSystem) {
  65. return ssoSystemService.insertSsoSystem(ssoSystem);
  66. }
  67. /**
  68. * 更新sso系统
  69. * @param ssoSystem sso系统
  70. * @return {@link Map}<{@link String}, {@link Object}>
  71. */
  72. @PostMapping("updateSsoSystem")
  73. @ApiOperation(value = "编辑SSO业务系统")
  74. public Map<String, Object> updateSsoSystem(SsoSystem ssoSystem) {
  75. return ssoSystemService.updateSsoSystem(ssoSystem);
  76. }
  77. /**
  78. * 删除sso系统
  79. * @param id id
  80. * @return {@link Map}<{@link String}, {@link Object}>
  81. */
  82. @PostMapping("deleteSsoSystem")
  83. @ApiOperation(value = "删除SSO业务系统")
  84. public Map<String, Object> deleteSsoSystem(Integer id) {
  85. if (Blank.isEmpty(id)) {
  86. return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS);
  87. }
  88. return ssoSystemService.deleteSsoSystem(id);
  89. }
  90. /**
  91. * 获得sso系统信息
  92. * @param id id
  93. * @return {@link Map}<{@link String}, {@link Object}>
  94. */
  95. @GetMapping("getSsoSystemInfo")
  96. @ApiOperation(value = "查询SSO业务系统详情")
  97. public Map<String, Object> getSsoSystemInfo(Integer id) {
  98. if (Blank.isEmpty(id)) {
  99. return SendUtil.send(false, ConstString.REQUEST_WRONGPARAMS);
  100. }
  101. return ssoSystemService.getSsoSystemInfo(id);
  102. }
  103. }