Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nnjcy-data-model
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
ljb
nnjcy-data-model
Commits
4a59a5df
Commit
4a59a5df
authored
Jul 04, 2023
by
ljb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加元数据目录树形查询
parent
1dd2675f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
spider-flow-web/src/main/java/org/spiderflow/controller/MetaDataCategoryController.java
+12
-2
spider-flow-web/src/main/java/org/spiderflow/entity/MetaDataCategory.java
+7
-2
spider-flow-web/src/main/java/org/spiderflow/service/MetaDataCategoryService.java
+13
-0
No files found.
spider-flow-web/src/main/java/org/spiderflow/controller/MetaDataCategoryController.java
View file @
4a59a5df
package
org
.
spiderflow
.
controller
;
package
org
.
spiderflow
.
controller
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.IdUtil
;
import
lombok.RequiredArgsConstructor
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.spiderflow.entity.MetaDataCategory
;
import
org.spiderflow.entity.MetaDataCategory
;
import
org.spiderflow.service.MetaDataCategoryService
;
import
org.spiderflow.service.MetaDataCategoryService
;
import
org.spiderflow.util.AssertUtils
;
import
org.spiderflow.util.AssertUtils
;
...
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
@Api
(
tags
=
"元数据目录"
)
@RestController
@RestController
@RequestMapping
(
value
=
"/spiderflow/metadataCategory"
)
@RequestMapping
(
value
=
"/spiderflow/metadataCategory"
)
public
class
MetaDataCategoryController
{
public
class
MetaDataCategoryController
{
...
@@ -58,7 +60,7 @@ public class MetaDataCategoryController {
...
@@ -58,7 +60,7 @@ public class MetaDataCategoryController {
public
ResultVo
add
(
@RequestBody
MetaDataCategory
metaDataCategory
)
{
public
ResultVo
add
(
@RequestBody
MetaDataCategory
metaDataCategory
)
{
AssertUtils
.
notNull
(
metaDataCategory
.
getCategoryName
(),
"缺少类别目录名称"
);
AssertUtils
.
notNull
(
metaDataCategory
.
getCategoryName
(),
"缺少类别目录名称"
);
AssertUtils
.
notNull
(
metaDataCategory
.
getStandardLevel
(),
"缺少类别目录级别"
);
AssertUtils
.
notNull
(
metaDataCategory
.
getStandardLevel
(),
"缺少类别目录级别"
);
metaDataCategory
.
setCategoryCode
(
IdUtil
.
fastS
impleUUID
());
metaDataCategory
.
setCategoryCode
(
IdUtil
.
s
impleUUID
());
boolean
b
=
metaDataCategoryService
.
save
(
metaDataCategory
);
boolean
b
=
metaDataCategoryService
.
save
(
metaDataCategory
);
return
b
?
ResultVo
.
success
(
"操作成功!"
)
:
ResultVo
.
fail
(
"操作失败"
);
return
b
?
ResultVo
.
success
(
"操作成功!"
)
:
ResultVo
.
fail
(
"操作失败"
);
}
}
...
@@ -98,4 +100,11 @@ public class MetaDataCategoryController {
...
@@ -98,4 +100,11 @@ public class MetaDataCategoryController {
boolean
b
=
metaDataCategoryService
.
removeById
(
id
);
boolean
b
=
metaDataCategoryService
.
removeById
(
id
);
return
b
?
ResultVo
.
success
(
"操作成功!"
)
:
ResultVo
.
fail
(
"操作失败!"
);
return
b
?
ResultVo
.
success
(
"操作成功!"
)
:
ResultVo
.
fail
(
"操作失败!"
);
}
}
@ApiOperation
(
"树形查询目录"
)
@GetMapping
(
"/tree"
)
public
ResultVo
getCategoryTree
(
@RequestParam
(
value
=
"categoryCode"
,
required
=
false
)
Integer
categoryCode
,
@RequestParam
(
value
=
"currentLevel"
,
defaultValue
=
"0"
)
Integer
currentLevel
){
return
ResultVo
.
success
(
metaDataCategoryService
.
getCategoryTree
(
categoryCode
,
currentLevel
));
}
}
}
\ No newline at end of file
spider-flow-web/src/main/java/org/spiderflow/entity/MetaDataCategory.java
View file @
4a59a5df
...
@@ -35,9 +35,14 @@ public class MetaDataCategory {
...
@@ -35,9 +35,14 @@ public class MetaDataCategory {
private
String
categoryCode
;
private
String
categoryCode
;
/**
/**
*
游戏品种名称
*
目录级别(顶级:0)
*/
*/
private
String
standardLevel
;
private
Integer
standardLevel
;
/**
* 子目录数
*/
private
Integer
subCount
;
/**
/**
* createTime
* createTime
...
...
spider-flow-web/src/main/java/org/spiderflow/service/MetaDataCategoryService.java
View file @
4a59a5df
...
@@ -11,6 +11,8 @@ import org.spiderflow.vo.PageVo;
...
@@ -11,6 +11,8 @@ import org.spiderflow.vo.PageVo;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
@Service
public
class
MetaDataCategoryService
extends
ServiceImpl
<
MetaDataCategoryDao
,
MetaDataCategory
>
{
public
class
MetaDataCategoryService
extends
ServiceImpl
<
MetaDataCategoryDao
,
MetaDataCategory
>
{
...
@@ -22,4 +24,14 @@ public class MetaDataCategoryService extends ServiceImpl<MetaDataCategoryDao, Me
...
@@ -22,4 +24,14 @@ public class MetaDataCategoryService extends ServiceImpl<MetaDataCategoryDao, Me
LambdaQueryWrapper
<
MetaDataCategory
>
wrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
MetaDataCategory
>
wrapper
=
new
LambdaQueryWrapper
<>();
return
PagingUtils
.
paging
(
req
,
metaDataCategoryDao
,
wrapper
,
MetaDataCategory
.
class
);
return
PagingUtils
.
paging
(
req
,
metaDataCategoryDao
,
wrapper
,
MetaDataCategory
.
class
);
}
}
public
List
<
MetaDataCategory
>
getCategoryTree
(
Integer
categoryCode
,
Integer
currentLevel
){
List
<
MetaDataCategory
>
list
;
if
(
null
==
categoryCode
){
list
=
lambdaQuery
().
eq
(
MetaDataCategory:
:
getStandardLevel
,
0
).
list
();
}
else
{
list
=
lambdaQuery
().
eq
(
MetaDataCategory:
:
getCategoryCode
,
categoryCode
).
eq
(
MetaDataCategory:
:
getStandardLevel
,
++
currentLevel
).
orderByAsc
(
MetaDataCategory:
:
getId
).
list
();
}
return
list
;
}
}
}
\ No newline at end of file
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