| | |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.InterphoneHostSubService; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("/v1/hostBind") |
| | | public class InterphoneHostSubController { |
| | | |
| | | private PermissionConfig permissionConfig; |
| | | private final InterphoneHostSubService interphoneHostSubService; |
| | | |
| | | /** |
| | | * 主机绑定子机 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("/bind") |
| | | public ResponseVO<Object> bind(@RequestBody Map map) { |
| | | Integer hostId = (Integer) map.get("hostId"); |
| | | Integer subId = (Integer) map.get("subId"); |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_HOST_SUB_BINDING.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | int hostId = Integer.parseInt(map.get("hostId").toString()); |
| | | int subId = Integer.parseInt(map.get("subId").toString()); |
| | | return ResponseUtil.success(interphoneHostSubService.bindHostSub(hostId, subId)); |
| | | } |
| | | |
| | | /** |
| | | * 主机解绑子机 |
| | | * @param subId |
| | | * @return |
| | | */ |
| | | @PostMapping("/unbind/{subId}") |
| | | public ResponseVO<Object> unbind(@PathVariable Integer subId) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_HOST_SUB_UNBIND.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneHostSubService.unbindHostSub(subId)); |
| | | } |
| | | } |