package com.oying.modules.message.rest; import com.oying.annotation.Log; import com.oying.modules.message.domain.MessageSeller; import com.oying.modules.message.service.MessageSellerService; import com.oying.modules.message.domain.dto.MessageSellerQueryCriteria; 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/messageSeller") public class MessageSellerController { private final MessageSellerService messageSellerService; @ApiOperation("导出数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('messageSeller:list')") public void exportMessageSeller(HttpServletResponse response, MessageSellerQueryCriteria criteria) throws IOException { messageSellerService.download(messageSellerService.queryAll(criteria), response); } @GetMapping @ApiOperation("查询消息_卖家") @PreAuthorize("@el.check('messageSeller:list')") public ResponseEntity> queryMessageSeller(MessageSellerQueryCriteria criteria){ Page page = new Page<>(criteria.getPage(), criteria.getSize()); return new ResponseEntity<>(messageSellerService.queryAll(criteria,page),HttpStatus.OK); } @PostMapping @Log("新增消息_卖家") @ApiOperation("新增消息_卖家") @PreAuthorize("@el.check('messageSeller:add')") public ResponseEntity createMessageSeller(@Validated @RequestBody MessageSeller resources){ messageSellerService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); } @PutMapping @Log("修改消息_卖家") @ApiOperation("修改消息_卖家") @PreAuthorize("@el.check('messageSeller:edit')") public ResponseEntity updateMessageSeller(@Validated @RequestBody MessageSeller resources){ messageSellerService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @DeleteMapping @Log("删除消息_卖家") @ApiOperation("删除消息_卖家") @PreAuthorize("@el.check('messageSeller:del')") public ResponseEntity deleteMessageSeller(@ApiParam(value = "传ID数组[]") @RequestBody List ids) { messageSellerService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } }