正在显示
1 个修改的文件
包含
14 行增加
和
55 行删除
| @@ -2,10 +2,9 @@ package com.sunyo.wlpt.message.bus.service.controller; | @@ -2,10 +2,9 @@ package com.sunyo.wlpt.message.bus.service.controller; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
| 5 | -import com.sunyo.wlpt.message.bus.service.domain.*; | 5 | +import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding; |
| 6 | import com.sunyo.wlpt.message.bus.service.response.ResultJson; | 6 | import com.sunyo.wlpt.message.bus.service.response.ResultJson; |
| 7 | -import com.sunyo.wlpt.message.bus.service.service.*; | ||
| 8 | -import com.sunyo.wlpt.message.bus.service.utils.IdUtils; | 7 | +import com.sunyo.wlpt.message.bus.service.service.UserMessageBindingService; |
| 9 | import org.springframework.web.bind.annotation.*; | 8 | import org.springframework.web.bind.annotation.*; |
| 10 | 9 | ||
| 11 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
| @@ -22,21 +21,6 @@ import javax.annotation.Resource; | @@ -22,21 +21,6 @@ import javax.annotation.Resource; | ||
| 22 | public class UserMessageBindingController { | 21 | public class UserMessageBindingController { |
| 23 | 22 | ||
| 24 | @Resource | 23 | @Resource |
| 25 | - private BusServerService busServerService; | ||
| 26 | - | ||
| 27 | - @Resource | ||
| 28 | - private VirtualHostService virtualHostService; | ||
| 29 | - | ||
| 30 | - @Resource | ||
| 31 | - private BusExchangeService busExchangeService; | ||
| 32 | - | ||
| 33 | - @Resource | ||
| 34 | - private BusQueueService busQueueService; | ||
| 35 | - | ||
| 36 | - @Resource | ||
| 37 | - private RoutingKeyService routingKeyService; | ||
| 38 | - | ||
| 39 | - @Resource | ||
| 40 | private UserMessageBindingService userMessageBindingService; | 24 | private UserMessageBindingService userMessageBindingService; |
| 41 | 25 | ||
| 42 | /** | 26 | /** |
| @@ -63,7 +47,8 @@ public class UserMessageBindingController { | @@ -63,7 +47,8 @@ public class UserMessageBindingController { | ||
| 63 | @RequestParam(value = "routingKeyName", required = false) String routingKeyName, | 47 | @RequestParam(value = "routingKeyName", required = false) String routingKeyName, |
| 64 | @RequestParam(value = "subscriber", required = false) String subscriber, | 48 | @RequestParam(value = "subscriber", required = false) String subscriber, |
| 65 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 49 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
| 66 | - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 50 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) |
| 51 | + { | ||
| 67 | // 获取查询参数 | 52 | // 获取查询参数 |
| 68 | UserMessageBinding userMessageBinding = UserMessageBinding.builder() | 53 | UserMessageBinding userMessageBinding = UserMessageBinding.builder() |
| 69 | .username(username) | 54 | .username(username) |
| @@ -88,7 +73,8 @@ public class UserMessageBindingController { | @@ -88,7 +73,8 @@ public class UserMessageBindingController { | ||
| 88 | * @return {@link ResultJson} | 73 | * @return {@link ResultJson} |
| 89 | */ | 74 | */ |
| 90 | @DeleteMapping("/delete") | 75 | @DeleteMapping("/delete") |
| 91 | - public ResultJson deleteUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) { | 76 | + public ResultJson deleteUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) |
| 77 | + { | ||
| 92 | // 执行删除方法 | 78 | // 执行删除方法 |
| 93 | return userMessageBindingService.deleteByPrimaryKey(userMessageBinding.getId()) > 0 | 79 | return userMessageBindingService.deleteByPrimaryKey(userMessageBinding.getId()) > 0 |
| 94 | ? new ResultJson<>("200", "删除-账户消息配置信息,成功") | 80 | ? new ResultJson<>("200", "删除-账户消息配置信息,成功") |
| @@ -102,7 +88,8 @@ public class UserMessageBindingController { | @@ -102,7 +88,8 @@ public class UserMessageBindingController { | ||
| 102 | * @return {@link ResultJson} | 88 | * @return {@link ResultJson} |
| 103 | */ | 89 | */ |
| 104 | @GetMapping("/batchRemove") | 90 | @GetMapping("/batchRemove") |
| 105 | - public ResultJson batchRemoveUserMessageBinding(String ids) { | 91 | + public ResultJson batchRemoveUserMessageBinding(String ids) |
| 92 | + { | ||
| 106 | // 执行批量删除 | 93 | // 执行批量删除 |
| 107 | return userMessageBindingService.deleteByPrimaryKey(ids) > 0 | 94 | return userMessageBindingService.deleteByPrimaryKey(ids) > 0 |
| 108 | ? new ResultJson<>("200", "批量删除-账户消息配置信息,成功") | 95 | ? new ResultJson<>("200", "批量删除-账户消息配置信息,成功") |
| @@ -116,9 +103,10 @@ public class UserMessageBindingController { | @@ -116,9 +103,10 @@ public class UserMessageBindingController { | ||
| 116 | * @return {@link ResultJson} | 103 | * @return {@link ResultJson} |
| 117 | */ | 104 | */ |
| 118 | @PutMapping("/update") | 105 | @PutMapping("/update") |
| 119 | - public ResultJson updateUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) { | 106 | + public ResultJson updateUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) |
| 107 | + { | ||
| 120 | // 执行编辑 | 108 | // 执行编辑 |
| 121 | - return userMessageBindingService.updateByPrimaryKeySelective(umb_fillName(userMessageBinding)) > 0 | 109 | + return userMessageBindingService.updateByPrimaryKeySelective(userMessageBinding) > 0 |
| 122 | ? new ResultJson<>("200", "编辑-账户消息配置-信息,成功") | 110 | ? new ResultJson<>("200", "编辑-账户消息配置-信息,成功") |
| 123 | : new ResultJson<>("500", "编辑-账户消息配置-信息,失败"); | 111 | : new ResultJson<>("500", "编辑-账户消息配置-信息,失败"); |
| 124 | } | 112 | } |
| @@ -130,40 +118,11 @@ public class UserMessageBindingController { | @@ -130,40 +118,11 @@ public class UserMessageBindingController { | ||
| 130 | * @return {@link ResultJson} | 118 | * @return {@link ResultJson} |
| 131 | */ | 119 | */ |
| 132 | @PostMapping("/insert") | 120 | @PostMapping("/insert") |
| 133 | - public ResultJson insertUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) { | ||
| 134 | - // 设置id | ||
| 135 | - userMessageBinding.setId(IdUtils.generateId()); | 121 | + public ResultJson insertUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) |
| 122 | + { | ||
| 136 | // 执行新增 | 123 | // 执行新增 |
| 137 | - return userMessageBindingService.insertSelective(umb_fillName(userMessageBinding)) > 0 | 124 | + return userMessageBindingService.insertSelective(userMessageBinding) > 0 |
| 138 | ? new ResultJson<>("200", "添加-账户消息配置-信息,成功") | 125 | ? new ResultJson<>("200", "添加-账户消息配置-信息,成功") |
| 139 | : new ResultJson<>("500", "添加-账户消息配置-信息,失败"); | 126 | : new ResultJson<>("500", "添加-账户消息配置-信息,失败"); |
| 140 | } | 127 | } |
| 141 | - | ||
| 142 | - /** | ||
| 143 | - * 编辑 or 新增方法,根绝前端传递来的id值,来填充对应的name | ||
| 144 | - * 服务器id,虚拟主机id,交换机id,队列id,路由键id | ||
| 145 | - */ | ||
| 146 | - public UserMessageBinding umb_fillName(UserMessageBinding userMessageBinding) { | ||
| 147 | - // 填充,服务器名称 | ||
| 148 | - BusServer busServer = busServerService.selectByPrimaryKey(userMessageBinding.getServerId()); | ||
| 149 | - userMessageBinding.setServerName(busServer.getServerName()); | ||
| 150 | - | ||
| 151 | - // 填充,虚拟主机名称 | ||
| 152 | - VirtualHost virtualHost = virtualHostService.selectByPrimaryKey(userMessageBinding.getVirtualHostId()); | ||
| 153 | - userMessageBinding.setVirtualHostName(virtualHost.getVirtualHostName()); | ||
| 154 | - | ||
| 155 | - // 填充,交换机名称 | ||
| 156 | - BusExchange busExchange = busExchangeService.selectByPrimaryKey(userMessageBinding.getExchangeId()); | ||
| 157 | - userMessageBinding.setExchangeName(busExchange.getExchangeName()); | ||
| 158 | - | ||
| 159 | - // 填充,队列名称 | ||
| 160 | - BusQueue busQueue = busQueueService.selectByPrimaryKey(userMessageBinding.getQueueId()); | ||
| 161 | - userMessageBinding.setQueueName(busQueue.getQueueName()); | ||
| 162 | - | ||
| 163 | - // 填充,路由键名称 | ||
| 164 | - RoutingKey routingKey = routingKeyService.selectByPrimaryKey(userMessageBinding.getRoutingKeyId()); | ||
| 165 | - userMessageBinding.setRoutingKeyName(routingKey.getRoutingKeyName()); | ||
| 166 | - | ||
| 167 | - return userMessageBinding; | ||
| 168 | - } | ||
| 169 | } | 128 | } |
-
请 注册 或 登录 后发表评论