package com.oying.modules.sh.rest; import com.oying.annotation.Log; import com.oying.modules.sh.domain.OrderAddressSnapshot; import com.oying.modules.sh.service.OrderAddressSnapshotService; import com.oying.modules.sh.domain.dto.OrderAddressSnapshotQueryCriteria; 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 lixin * @date 2025-06-11 **/ @RestController @RequiredArgsConstructor @Api(tags = "SH:订单地址快照") @RequestMapping("/api/orderAddressSnapshot") public class OrderAddressSnapshotController { private final OrderAddressSnapshotService orderAddressSnapshotService; @ApiOperation("导出数据") @GetMapping(value = "/download") @PreAuthorize("@el.check('orderAddressSnapshot:list')") public void exportOrderAddressSnapshot(HttpServletResponse response, OrderAddressSnapshotQueryCriteria criteria) throws IOException { orderAddressSnapshotService.download(orderAddressSnapshotService.queryAll(criteria), response); } @GetMapping @ApiOperation("查询订单地址快照") @PreAuthorize("@el.check('orderAddressSnapshot:list')") public ResponseEntity> queryOrderAddressSnapshot(OrderAddressSnapshotQueryCriteria criteria){ Page page = new Page<>(criteria.getPage(), criteria.getSize()); return new ResponseEntity<>(orderAddressSnapshotService.queryAll(criteria,page),HttpStatus.OK); } @PostMapping @Log("新增订单地址快照") @ApiOperation("新增订单地址快照") @PreAuthorize("@el.check('orderAddressSnapshot:add')") public ResponseEntity createOrderAddressSnapshot(@Validated @RequestBody OrderAddressSnapshot resources){ orderAddressSnapshotService.create(resources); return new ResponseEntity<>(HttpStatus.CREATED); } @PutMapping @Log("修改订单地址快照") @ApiOperation("修改订单地址快照") @PreAuthorize("@el.check('orderAddressSnapshot:edit')") public ResponseEntity updateOrderAddressSnapshot(@Validated @RequestBody OrderAddressSnapshot resources){ orderAddressSnapshotService.update(resources); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @DeleteMapping @Log("删除订单地址快照") @ApiOperation("删除订单地址快照") @PreAuthorize("@el.check('orderAddressSnapshot:del')") public ResponseEntity deleteOrderAddressSnapshot(@ApiParam(value = "传ID数组[]") @RequestBody List ids) { orderAddressSnapshotService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } }