/* * Copyright 2019-2020 Zheng Jie * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package me.zhengjie.modules.temp.rest; import me.zhengjie.annotation.Log; import me.zhengjie.modules.temp.domain.WechatSendHistory; import me.zhengjie.modules.temp.service.WechatSendHistoryService; import me.zhengjie.modules.temp.service.dto.WechatSendHistoryQueryCriteria; import org.springframework.data.domain.Pageable; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.*; import java.io.IOException; import javax.servlet.http.HttpServletResponse; /** * @website https://eladmin.vip * @author baolh * @date 2025-02-19 **/ @RestController @RequiredArgsConstructor @Api(tags = "wechatSendHistory管理") @RequestMapping("/api/wechatSendHistory") public class WechatSendHistoryController { private final WechatSendHistoryService wechatSendHistoryService; @Log("导出数据") @ApiOperation("导出数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('wechatSendHistory:list')") public void exportWechatSendHistory(HttpServletResponse response, WechatSendHistoryQueryCriteria criteria) throws IOException { wechatSendHistoryService.download(wechatSendHistoryService.queryAll(criteria), response); } @GetMapping @Log("查询wechatSendHistory") @ApiOperation("查询wechatSendHistory") @PreAuthorize("@el.check('wechatSendHistory:list')") public ResponseEntity queryWechatSendHistory(WechatSendHistoryQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(wechatSendHistoryService.queryAll(criteria,pageable),HttpStatus.OK); } @PostMapping @Log("新增wechatSendHistory") @ApiOperation("新增wechatSendHistory") @PreAuthorize("@el.check('wechatSendHistory:add')") public ResponseEntity createWechatSendHistory(@Validated @RequestBody WechatSendHistory resources){ return new ResponseEntity<>(wechatSendHistoryService.create(resources),HttpStatus.CREATED); } @PutMapping @Log("修改wechatSendHistory") @ApiOperation("修改wechatSendHistory") @PreAuthorize("@el.check('wechatSendHistory:edit')") public ResponseEntity updateWechatSendHistory(@Validated @RequestBody WechatSendHistory resources){ wechatSendHistoryService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @DeleteMapping @Log("删除wechatSendHistory") @ApiOperation("删除wechatSendHistory") @PreAuthorize("@el.check('wechatSendHistory:del')") public ResponseEntity deleteWechatSendHistory(@RequestBody Long[] ids) { wechatSendHistoryService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } }