Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
d04558c0
Commit
d04558c0
authored
Apr 09, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
博客分类接口
parent
41e90fea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
src/main/java/cn/meteor/beyondclouds/modules/blog/api/BlogCategoryApi.java
+9
-1
src/main/java/cn/meteor/beyondclouds/modules/blog/service/IBlogCategoryService.java
+2
-1
src/main/java/cn/meteor/beyondclouds/modules/blog/service/impl/BlogCategoryServiceImpl.java
+6
-2
No files found.
src/main/java/cn/meteor/beyondclouds/modules/blog/api/BlogCategoryApi.java
View file @
d04558c0
...
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -33,7 +34,14 @@ public class BlogCategoryApi {
@ApiOperation
(
"获取博客分类"
)
@GetMapping
(
"/blog/categories"
)
public
Response
<
List
<
BlogCategory
>>
getBlogCategories
()
{
return
Response
.
success
(
blogCategoryService
.
getBlogCategory
());
return
Response
.
success
(
blogCategoryService
.
getBlogCategory
(
null
));
}
@Anonymous
@ApiOperation
(
"获取博客子分类"
)
@GetMapping
(
"/blog/{categoryId}/categories"
)
public
Response
<
List
<
BlogCategory
>>
getBlogSubCategories
(
@PathVariable
(
"categoryId"
)
Integer
categoryId
)
{
return
Response
.
success
(
blogCategoryService
.
getBlogCategory
(
categoryId
));
}
}
src/main/java/cn/meteor/beyondclouds/modules/blog/service/IBlogCategoryService.java
View file @
d04558c0
...
...
@@ -18,6 +18,7 @@ public interface IBlogCategoryService extends IService<BlogCategory> {
/**
* 获取博客分类列表
* @return
* @param categoryId
*/
List
<
BlogCategory
>
getBlogCategory
();
List
<
BlogCategory
>
getBlogCategory
(
Integer
categoryId
);
}
src/main/java/cn/meteor/beyondclouds/modules/blog/service/impl/BlogCategoryServiceImpl.java
View file @
d04558c0
...
...
@@ -21,10 +21,14 @@ import java.util.List;
public
class
BlogCategoryServiceImpl
extends
ServiceImpl
<
BlogCategoryMapper
,
BlogCategory
>
implements
IBlogCategoryService
{
@Override
public
List
<
BlogCategory
>
getBlogCategory
()
{
public
List
<
BlogCategory
>
getBlogCategory
(
Integer
categoryId
)
{
//只获取第一层分类
QueryWrapper
<
BlogCategory
>
blogCategoryQueryWrapper
=
new
QueryWrapper
<>();
blogCategoryQueryWrapper
.
isNull
(
true
,
"parent_id"
);
if
(
null
==
categoryId
)
{
blogCategoryQueryWrapper
.
isNull
(
true
,
"parent_id"
);
}
else
{
blogCategoryQueryWrapper
.
eq
(
"parent_id"
,
categoryId
);
}
blogCategoryQueryWrapper
.
orderByDesc
(
"priority"
);
blogCategoryQueryWrapper
.
orderByAsc
(
"category_id"
);
List
<
BlogCategory
>
blogCategoryList
=
list
(
blogCategoryQueryWrapper
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment