package com.oying.modules.message.rest; import com.oying.annotation.Log; import com.oying.modules.message.domain.MessageBuyer; import com.oying.modules.message.service.MessageBuyerService; import com.oying.modules.message.domain.dto.MessageBuyerQueryCriteria; import lombok.RequiredArgsConstructor; import java.util.List; 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; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.oying.utils.PageResult; /** * @author 李萌 * @date 2025-05-14 **/ @RestController @RequiredArgsConstructor @Api(tags = "消息_买家") @RequestMapping("/api/messageBuyer") public class MessageBuyerController { private final MessageBuyerService messageBuyerService; @ApiOperation("导出数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('messageBuyer:list')") public void exportMessageBuyer(HttpServletResponse response, MessageBuyerQueryCriteria criteria) throws IOException { messageBuyerService.download(messageBuyerService.queryAll(criteria), response); } @GetMapping @ApiOperation("查询消息_买家") @PreAuthorize("@el.check('messageBuyer:list')") public ResponseEntity> queryMessageBuyer(MessageBuyerQueryCriteria criteria){ Page page = new Page<>(criteria.getPage(), criteria.getSize()); return new ResponseEntity<>(messageBuyerService.queryAll(criteria,page),HttpStatus.OK); } @PostMapping @Log("新增消息_买家") @ApiOperation("新增消息_买家") @PreAuthorize("@el.check('messageBuyer:add')") public ResponseEntity createMessageBuyer(@Validated @RequestBody MessageBuyer resources){ messageBuyerService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); } @PutMapping @Log("修改消息_买家") @ApiOperation("修改消息_买家") @PreAuthorize("@el.check('messageBuyer:edit')") public ResponseEntity updateMessageBuyer(@Validated @RequestBody MessageBuyer resources){ messageBuyerService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @DeleteMapping @Log("删除消息_买家") @ApiOperation("删除消息_买家") @PreAuthorize("@el.check('messageBuyer:del')") public ResponseEntity deleteMessageBuyer(@ApiParam(value = "传ID数组[]") @RequestBody List ids) { messageBuyerService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } }