| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.InterphoneSubParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.InterphoneSubService; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("v1/interphone/sub") |
| | | public class InterphoneSubController { |
| | | |
| | | |
| | | private PermissionConfig permissionConfig; |
| | | private final InterphoneSubService interphoneSubService; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addSub(@RequestBody InterphoneSubParam interphoneSubParam) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneSubService.addSub(interphoneSubParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/update/{id}") |
| | | public ResponseVO<Object> updateSub(@PathVariable Integer id, @RequestBody InterphoneSubParam interphoneSubParam) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneSubService.updateSub(id, interphoneSubParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/delete/{id}") |
| | | public ResponseVO<Object> deleteSub(@PathVariable Integer id) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneSubService.deleteSub(id)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/detail/{id}") |
| | | public ResponseVO<Object> detailSub(@PathVariable Integer id) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneSubService.getSub(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除主机 |
| | | * 子设备列表 |
| | | */ |
| | | @GetMapping("/getList/{keyword}") |
| | | public ResponseVO<Object> getInterphoneHostList(@PathVariable String keyword) { |
| | | return ResponseUtil.success(interphoneSubService.getInterphoneSubList(keyword)); |
| | | @GetMapping("/getList") |
| | | public ResponseVO<Object> getInterphoneHostList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword",required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.FOR_HELP_MANAGER.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneSubService.getInterphoneSubList(baseConditionVO, keyword)); |
| | | } |
| | | |
| | | } |