|  |  |  | 
|---|
|  |  |  | package com.doumee.api.cloud; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.service.system.NoticesService; | 
|---|
|  |  |  | 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.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Api(tags = "系统消息信息表") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping("/cloudService/business/notices") | 
|---|
|  |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/notices") | 
|---|
|  |  |  | public class NoticesCloudController extends BaseController { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NoticesService noticesService; | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody Notices notices) { | 
|---|
|  |  |  | return ApiResponse.success(noticesService.create(notices)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id) { | 
|---|
|  |  |  | noticesService.deleteById(id); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("批量删除") | 
|---|
|  |  |  | @GetMapping("/delete/batch") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:delete") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:delete") | 
|---|
|  |  |  | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
|---|
|  |  |  | String [] idArray = ids.split(","); | 
|---|
|  |  |  | List<Integer> idList = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:update") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Notices notices) { | 
|---|
|  |  |  | noticesService.updateById(notices); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("分页查询") | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:query") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:query") | 
|---|
|  |  |  | public ApiResponse<PageData<Notices>> findPage (@RequestBody PageWrap<Notices> pageWrap) { | 
|---|
|  |  |  | pageWrap.getModel().setPalt(Constants.ZERO); | 
|---|
|  |  |  | return ApiResponse.success(noticesService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<Notices> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | ExcelExporter.build(Notices.class).export(noticesService.findPage(pageWrap).getRecords(), "系统消息信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | @GetMapping("/{id}") | 
|---|
|  |  |  | @RequiresPermissions("business:notices:query") | 
|---|
|  |  |  | @CloudRequiredPermission("business:notices:query") | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id) { | 
|---|
|  |  |  | return ApiResponse.success(noticesService.findById(id)); | 
|---|
|  |  |  | } | 
|---|