|
|
@@ -24,14 +24,14 @@ public class ItemController {
|
|
|
@Autowired
|
|
|
private ItemService itemService;
|
|
|
|
|
|
- @Operation(summary = "首页物品列表", description = "按发布时间倒序,分页返回")
|
|
|
+ @Operation(summary = "首页物品列表", operationId = "listItems", description = "按发布时间倒序,分页返回")
|
|
|
@GetMapping
|
|
|
public Result<PageResult<ItemVO>> list(@RequestParam(defaultValue = "1") int pageNum,
|
|
|
@RequestParam(defaultValue = "10") int pageSize) {
|
|
|
return Result.success(PageResult.of(itemService.list(pageNum, pageSize)));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "搜索物品", description = "按标题/描述模糊匹配")
|
|
|
+ @Operation(summary = "搜索物品", operationId = "searchItems", description = "按标题/描述模糊匹配")
|
|
|
@GetMapping("/search")
|
|
|
public Result<PageResult<ItemVO>> search(@RequestParam String keyword,
|
|
|
@RequestParam(defaultValue = "1") int pageNum,
|
|
|
@@ -39,7 +39,7 @@ public class ItemController {
|
|
|
return Result.success(PageResult.of(itemService.search(keyword, pageNum, pageSize)));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "按分类筛选")
|
|
|
+ @Operation(summary = "按分类筛选", operationId = "listItemsByCategory")
|
|
|
@GetMapping("/category/{id}")
|
|
|
public Result<PageResult<ItemVO>> byCategory(@Parameter(description = "分类ID") @PathVariable Long id,
|
|
|
@RequestParam(defaultValue = "1") int pageNum,
|
|
|
@@ -47,32 +47,32 @@ public class ItemController {
|
|
|
return Result.success(PageResult.of(itemService.byCategory(id, pageNum, pageSize)));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "物品详情")
|
|
|
+ @Operation(summary = "物品详情", operationId = "getItemDetail")
|
|
|
@GetMapping("/{id}")
|
|
|
public Result<ItemVO> detail(@Parameter(description = "物品ID") @PathVariable Long id) {
|
|
|
return Result.success(itemService.detail(id));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "发布物品", description = "需要实名认证,图片以 multipart 上传")
|
|
|
+ @Operation(summary = "发布物品", operationId = "publishItem", description = "需要实名认证,图片以 multipart 上传")
|
|
|
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
public Result<Long> publish(@Valid ItemPublishRequest req, HttpSession session) {
|
|
|
return Result.success(itemService.publish(req, session));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "我的发布列表")
|
|
|
+ @Operation(summary = "我的发布列表", operationId = "listMyItems")
|
|
|
@GetMapping("/my")
|
|
|
public Result<List<ItemVO>> myItems(HttpSession session) {
|
|
|
return Result.success(itemService.myItems(session));
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "下架物品", description = "卖家下架自己的物品")
|
|
|
+ @Operation(summary = "下架物品", operationId = "offlineItem", description = "卖家下架自己的物品")
|
|
|
@PutMapping("/{id}/offline")
|
|
|
public Result<Void> offline(@Parameter(description = "物品ID") @PathVariable Long id, HttpSession session) {
|
|
|
itemService.offline(id, session);
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "删除物品", description = "卖家删除自己的物品")
|
|
|
+ @Operation(summary = "删除物品", operationId = "deleteItem", description = "卖家删除自己的物品")
|
|
|
@DeleteMapping("/{id}")
|
|
|
public Result<Void> delete(@Parameter(description = "物品ID") @PathVariable Long id, HttpSession session) {
|
|
|
itemService.delete(id, session);
|