|  |  |  | 
|---|
|  |  |  | package com.doumee.cloud.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.CloudRequiredPermission; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.PlatformDevice; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformDeviceService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody PlatformDevice platformDevice) { | 
|---|
|  |  |  | return ApiResponse.success(platformDeviceService.create(platformDevice)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | platformDeviceService.deleteById(id); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("批量删除") | 
|---|
|  |  |  | @GetMapping("/delete/batch") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:delete") | 
|---|
|  |  |  | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody PlatformDevice platformDevice) { | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody PlatformDevice platformDevice,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | platformDeviceService.updateById(platformDevice); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:query") | 
|---|
|  |  |  | public ApiResponse<PageData<PlatformDevice>> findPage (@RequestBody PageWrap<PlatformDevice> pageWrap) { | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:query") | 
|---|
|  |  |  | public ApiResponse<PageData<PlatformDevice>> findPage (@RequestBody PageWrap<PlatformDevice> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(platformDeviceService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<PlatformDevice> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<PlatformDevice> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ExcelExporter.build(PlatformDevice.class).export(platformDeviceService.findPage(pageWrap).getRecords(), "月台_关联监控点LED和广播信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:platformdevice:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | @CloudRequiredPermission("business:platformdevice:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(platformDeviceService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|