package com.oying.modules.pc.store.rest; import com.oying.annotation.Log; import com.oying.modules.pc.common.core.domain.R; import com.oying.modules.pc.store.domain.StoreCategory; import com.oying.modules.pc.store.service.StoreCategoryService; import com.oying.modules.pc.store.domain.dto.StoreCategoryQueryCriteria; 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.oying.utils.PageResult; /** * @author lzp * @date 2025-04-24 **/ @Api(tags = "商品中心:店铺类目") @RestController @RequiredArgsConstructor @RequestMapping("/api/pc/storeCategory") public class StoreCategoryController { private final StoreCategoryService storeCategoryService; @GetMapping @ApiOperation("查询api/store/category") public ResponseEntity queryStoreCategory(StoreCategoryQueryCriteria criteria){ Page page = new Page<>(criteria.getPage(), criteria.getSize()); return ResponseEntity.ok(R.success(storeCategoryService.queryAll(criteria, page))); } @PostMapping @Log("新增api/store") @ApiOperation("新增api/store") @PreAuthorize("@el.check('storeCategory:add')") public ResponseEntity createStoreCategory(@Validated @RequestBody StoreCategory resources){ storeCategoryService.create(resources); return ResponseEntity.status(HttpStatus.CREATED).build(); } @PutMapping @Log("修改api/store") @ApiOperation("修改api/store") @PreAuthorize("@el.check('storeCategory:edit')") public ResponseEntity updateStoreCategory(@Validated @RequestBody StoreCategory resources){ storeCategoryService.update(resources); return ResponseEntity.noContent().build(); } @DeleteMapping @Log("删除api/store") @ApiOperation("删除api/store") @PreAuthorize("@el.check('storeCategory:del')") public ResponseEntity deleteStoreCategory(@ApiParam(value = "传ID数组[]") @RequestBody List ids) { storeCategoryService.deleteAll(ids); return ResponseEntity.noContent().build(); } }