mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 01:25:28 +08:00
feat :组件分类
This commit is contained in:
parent
d0e5c81582
commit
88197f942c
@ -1,8 +1,5 @@
|
||||
### H5 组件分类管理接口测试
|
||||
|
||||
|
||||
### 1. 分页查询分类(查询一级分类)
|
||||
GET {{baseUrl}}/h5/category/page?pageNum=1&pageSize=10
|
||||
GET http://localhost:19200/h5/h5/category/page?pageNum=1&pageSize=10&parentId=1
|
||||
Content-Type: application/json
|
||||
|
||||
### 2. 分页查询分类(查询指定父分类的子分类)
|
||||
|
||||
@ -23,7 +23,7 @@ import java.util.List;
|
||||
*/
|
||||
@Tag(name = "H5 组件分类管理")
|
||||
@RestController
|
||||
@RequestMapping("/h5/category")
|
||||
@RequestMapping("category")
|
||||
@RequiredArgsConstructor
|
||||
public class H5ComponentCategoryController {
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
*/
|
||||
@Tag(name = "H5 组件管理")
|
||||
@RestController
|
||||
@RequestMapping("/h5/component")
|
||||
@RequestMapping("component")
|
||||
@RequiredArgsConstructor
|
||||
public class H5ComponentController {
|
||||
|
||||
@ -47,7 +47,7 @@ public class H5ComponentController {
|
||||
@Parameter(description = "搜索关键词") @RequestParam(required = false) String keyword,
|
||||
@Parameter(description = "分类 ID") @RequestParam(required = false) Long categoryId,
|
||||
@Parameter(description = "标签 ID") @RequestParam(required = false) Long tagId) {
|
||||
|
||||
|
||||
Page<H5ComponentVO> result = h5ComponentService.getPage(page, pageSize, type, keyword, categoryId, tagId);
|
||||
return new Result<>(result);
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class H5ComponentController {
|
||||
@Parameter(description = "组件信息", required = true) @RequestBody @Validated H5Component component,
|
||||
@Parameter(description = "分类 ID 列表") @RequestBody(required = false) List<Long> categoryIds,
|
||||
@Parameter(description = "标签 ID 列表") @RequestBody(required = false) List<Long> tagIds) {
|
||||
|
||||
|
||||
Long id = h5ComponentService.create(component, categoryIds, tagIds);
|
||||
return new Result<>(id);
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class H5ComponentController {
|
||||
@Parameter(description = "组件信息", required = true) @RequestBody @Validated H5Component component,
|
||||
@Parameter(description = "分类 ID 列表") @RequestBody(required = false) List<Long> categoryIds,
|
||||
@Parameter(description = "标签 ID 列表") @RequestBody(required = false) List<Long> tagIds) {
|
||||
|
||||
|
||||
component.setId(id);
|
||||
h5ComponentService.update(component, categoryIds, tagIds);
|
||||
return new Result<>();
|
||||
@ -113,7 +113,7 @@ public class H5ComponentController {
|
||||
public Result<List<H5ComponentVO>> getHotComponents(
|
||||
@Parameter(description = "组件类型") @RequestParam(required = false) String type,
|
||||
@Parameter(description = "数量限制", required = true) @RequestParam Integer limit) {
|
||||
|
||||
|
||||
List<H5ComponentVO> result = h5ComponentService.getHotComponents(type, limit);
|
||||
return new Result<>(result);
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ import java.util.List;
|
||||
*/
|
||||
@Tag(name = "H5 组件标签管理")
|
||||
@RestController
|
||||
@RequestMapping("/h5/tag")
|
||||
@RequestMapping("tag")
|
||||
@RequiredArgsConstructor
|
||||
public class H5TagController {
|
||||
|
||||
@ -37,7 +37,7 @@ public class H5TagController {
|
||||
@GetMapping("/hot")
|
||||
public Result<List<H5Tag>> getHotTags(
|
||||
@Parameter(description = "数量限制", required = true) @RequestParam Integer limit) {
|
||||
|
||||
|
||||
List<H5Tag> result = h5TagService.getHotTags(limit);
|
||||
return new Result<>(result);
|
||||
}
|
||||
@ -46,7 +46,7 @@ public class H5TagController {
|
||||
@GetMapping("/by-type")
|
||||
public Result<List<H5Tag>> getTagsByType(
|
||||
@Parameter(description = "组件类型") @RequestParam(required = false) String type) {
|
||||
|
||||
|
||||
List<H5Tag> result = h5TagService.getTagsByType(type);
|
||||
return new Result<>(result);
|
||||
}
|
||||
@ -55,7 +55,7 @@ public class H5TagController {
|
||||
@PostMapping
|
||||
public Result<Long> create(
|
||||
@Parameter(description = "标签信息", required = true) @RequestBody @Validated H5Tag tag) {
|
||||
|
||||
|
||||
Long id = h5TagService.create(tag);
|
||||
return new Result<>(id);
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class H5TagController {
|
||||
public Result<Void> update(
|
||||
@Parameter(description = "标签 ID", required = true) @PathVariable Long id,
|
||||
@Parameter(description = "标签信息", required = true) @RequestBody @Validated H5Tag tag) {
|
||||
|
||||
|
||||
tag.setId(id);
|
||||
h5TagService.update(tag);
|
||||
return new Result<>();
|
||||
|
||||
@ -1,50 +1,50 @@
|
||||
package com.luban.api.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.luban.api.entity.Scripts;
|
||||
import com.luban.api.convert.ScriptsConvert;
|
||||
import com.luban.api.service.ScriptsService;
|
||||
import com.luban.api.vo.ScriptsVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 作品 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author lizhengwei
|
||||
* @since 2024-06-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/scripts")
|
||||
public class ScriptsController {
|
||||
|
||||
|
||||
private final ScriptsService scriptsService;
|
||||
|
||||
public ScriptsController(ScriptsService scriptsService) {
|
||||
this.scriptsService = scriptsService;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "根据scriptsId查询")
|
||||
@GetMapping("/{id}")
|
||||
public ScriptsVO findScriptsById(@PathVariable Long id) {
|
||||
return ScriptsConvert.toVO(scriptsService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询所有scripts")
|
||||
@GetMapping
|
||||
public List<ScriptsVO> listAllScriptss(@RequestParam Integer _limit) {
|
||||
QueryWrapper<Scripts> wrapper = new QueryWrapper<>();
|
||||
wrapper.last("limit " + _limit);
|
||||
return scriptsService.list(wrapper).stream().map(ScriptsConvert::toVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//package com.luban.api.controller;
|
||||
//
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
//import com.luban.api.entity.Scripts;
|
||||
//import com.luban.api.convert.ScriptsConvert;
|
||||
//import com.luban.api.service.ScriptsService;
|
||||
//import com.luban.api.vo.ScriptsVO;
|
||||
//import io.swagger.v3.oas.annotations.Operation;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * 作品 前端控制器
|
||||
// * </p>
|
||||
// *
|
||||
// * @author lizhengwei
|
||||
// * @since 2024-06-21
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("/scripts")
|
||||
//public class ScriptsController {
|
||||
//
|
||||
//
|
||||
// private final ScriptsService scriptsService;
|
||||
//
|
||||
// public ScriptsController(ScriptsService scriptsService) {
|
||||
// this.scriptsService = scriptsService;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Operation(summary = "根据scriptsId查询")
|
||||
// @GetMapping("/{id}")
|
||||
// public ScriptsVO findScriptsById(@PathVariable Long id) {
|
||||
// return ScriptsConvert.toVO(scriptsService.getById(id));
|
||||
// }
|
||||
//
|
||||
// @Operation(summary = "查询所有scripts")
|
||||
// @GetMapping
|
||||
// public List<ScriptsVO> listAllScriptss(@RequestParam Integer _limit) {
|
||||
// QueryWrapper<Scripts> wrapper = new QueryWrapper<>();
|
||||
// wrapper.last("limit " + _limit);
|
||||
// return scriptsService.list(wrapper).stream().map(ScriptsConvert::toVO).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
|
||||
Loading…
Reference in New Issue
Block a user