xin
2025-05-30 347909bae241fff128b628ea6d12992d7e5b4b10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.oying.modules.pc.store.rest;
 
import com.oying.annotation.Log;
import com.oying.utils.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;
 
/**
* @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<Object> 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<Long> ids) {
        storeCategoryService.deleteAll(ids);
        return ResponseEntity.noContent().build();
    }
}