| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- package com.xunmei.system.controller;
- import java.util.List;
- import com.xunmei.common.security.annotation.InnerAuth;
- import com.xunmei.system.api.domain.SysDevice;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.xunmei.common.log.annotation.Log;
- import com.xunmei.common.log.enums.BusinessType;
- import com.xunmei.common.security.annotation.RequiresPermissions;
- import com.xunmei.system.service.ISysDeviceService;
- import com.xunmei.common.core.web.controller.BaseController;
- import com.xunmei.common.core.web.domain.AjaxResult;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import com.xunmei.common.core.web.page.TableDataInfo;
- /**
- * 【请填写功能名称】Controller
- *
- * @author xunmei
- * @date 2023-08-22
- */
- @Api(tags = {"SysDevice"})
- @RestController
- @RequestMapping("/device")
- public class SysDeviceController extends BaseController {
- @Autowired
- private ISysDeviceService sysDeviceService;
- /**
- * 查询【请填写功能名称】列表
- */
- @ApiOperation(value = "查询SysDevice列表")
- @RequiresPermissions("system:device:list")
- @GetMapping("/list")
- public TableDataInfo<SysDevice> list(SysDevice sysDevice) {
- return sysDeviceService.selectPage(sysDevice);
- }
- /**
- * 获取【请填写功能名称】详细信息
- */
- @ApiOperation(value = "获取SysDevice详细信息")
- @RequiresPermissions("system:device:query")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(sysDeviceService.selectSysDeviceById(id));
- }
- /**
- * 通过机构id获取主机列表
- */
- @ApiOperation(value = "通过机构id获取主机列表")
- @RequiresPermissions("system:device:query")
- @GetMapping(value = "/getHostByOrgId/{orgId}")
- public AjaxResult getHostByOrgId(@PathVariable(value = "orgId", required = false) Long orgId) {
- return success(sysDeviceService.getHostByOrgId(orgId));
- }
- /**
- * 通过机构id查询主机
- */
- @ApiOperation(value = "通过机构id查询主机")
- @InnerAuth
- @GetMapping(value = "/getSysDeviceByOrgId")
- public List<SysDevice> getSysDeviceByOrgId(Long orgId) {
- return sysDeviceService.getHostByOrgId(orgId);
- }
- @ApiOperation(value = "通过主机查询视频监控")
- @InnerAuth
- @GetMapping(value = "/getSysDeviceByHostId")
- public List<SysDevice> getSysDeviceByHostId(Long hostId) {
- return sysDeviceService.getSysDeviceByHostId(hostId);
- }
- /**
- * 新增【请填写功能名称】
- */
- @ApiOperation(value = "新增SysDevice")
- @RequiresPermissions("system:device:add")
- @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody SysDevice sysDevice) {
- return toAjax(sysDeviceService.insertSysDevice(sysDevice));
- }
- /**
- * 修改【请填写功能名称】
- */
- @ApiOperation(value = "修改SysDevice")
- @RequiresPermissions("system:device:edit")
- @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody SysDevice sysDevice) {
- return toAjax(sysDeviceService.updateSysDevice(sysDevice));
- }
- /**
- * 删除【请填写功能名称】
- */
- @ApiOperation(value = "删除SysDevice")
- @RequiresPermissions("system:device:remove")
- @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids) {
- return toAjax(sysDeviceService.deleteSysDeviceByIds(ids));
- }
- }
|