| | |
| | | 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.InterphoneHostParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.InterphoneHostService; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("/v1/interphone/host") |
| | | public class InterphoneHostController { |
| | | |
| | | private PermissionConfig permissionConfig; |
| | | private final InterphoneHostService interphoneHostService; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addHost(@RequestBody InterphoneHostParam interphoneHostParam) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneHostService.addHost(interphoneHostParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/update/{id}") |
| | | public ResponseVO<Object> updateHost(@PathVariable Integer id, @RequestBody InterphoneHostParam interphoneHostParam) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneHostService.updateHost(id, interphoneHostParam)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/delete/{id}") |
| | | public ResponseVO<Object> deleteHost(@PathVariable Integer id) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_DELETE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneHostService.deleteHost(id)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/detail/{id}") |
| | | public ResponseVO<Object> detailHost(@PathVariable Integer id) { |
| | | if (!permissionConfig.check(MenuEnum.INTER_PHONE_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(interphoneHostService.getHost(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除主机 |
| | | * 主机列表 |
| | | */ |
| | | @GetMapping("/getList") |
| | | public ResponseVO<Object> getInterphoneHostList(@PathVariable String keyword) { |
| | | return ResponseUtil.success(interphoneHostService.getInterphoneHostList(keyword)); |
| | | 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(interphoneHostService.getInterphoneHostList(baseConditionVO, keyword)); |
| | | } |
| | | |
| | | |