Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
d7b6a7ab
Commit
d7b6a7ab
authored
Sep 12, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询子类目
parent
f6b07fc2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
0 deletions
+42
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
...ao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
+8
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+18
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
...src/main/java/com/wwdz/ch/wx/service/CategoryService.java
+7
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/QueryPriceController.java
...rc/main/java/com/wwdz/ch/wx/web/QueryPriceController.java
+7
-0
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
View file @
d7b6a7ab
...
@@ -21,6 +21,8 @@ public interface CategoryDao {
...
@@ -21,6 +21,8 @@ public interface CategoryDao {
List
<
Category
>
queryByPids
(
List
<
Integer
>
pidList
);
List
<
Category
>
queryByPids
(
List
<
Integer
>
pidList
);
List
<
Category
>
queryByIds
(
List
<
Integer
>
idList
);
Category
findById
(
Integer
id
);
Category
findById
(
Integer
id
);
/**
/**
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
View file @
d7b6a7ab
...
@@ -65,6 +65,14 @@ public class CategoryDaoImpl implements CategoryDao {
...
@@ -65,6 +65,14 @@ public class CategoryDaoImpl implements CategoryDao {
return
categoryMapper
.
selectByExample
(
example
);
return
categoryMapper
.
selectByExample
(
example
);
}
}
@Override
public
List
<
Category
>
queryByIds
(
List
<
Integer
>
idList
)
{
CategoryExample
example
=
new
CategoryExample
();
CategoryExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIdIn
(
idList
).
andIsDeletedEqualTo
(
false
);
return
categoryMapper
.
selectByExample
(
example
);
}
public
Category
findById
(
Integer
id
)
{
public
Category
findById
(
Integer
id
)
{
return
categoryMapper
.
selectByPrimaryKey
(
id
);
return
categoryMapper
.
selectByPrimaryKey
(
id
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
d7b6a7ab
...
@@ -245,4 +245,22 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -245,4 +245,22 @@ public class CategoryServiceImpl implements CategoryService {
}
}
@Override
public
Result
findChildCategory
(
CategoryRequestDto
dto
)
{
try
{
List
<
Category
>
categoryList
=
new
ArrayList
<>();
List
<
Category
>
selfList
=
categoryDao
.
queryByIds
(
dto
.
getPidList
());
for
(
Category
category
:
selfList
)
{
if
(
category
.
getIsLeaf
())
{
categoryList
.
add
(
category
);
}
}
List
<
Category
>
childList
=
categoryDao
.
queryByPids
(
dto
.
getPidList
());
categoryList
.
addAll
(
childList
);
return
Result
.
success
(
categoryList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询子类目失败"
,
e
);
return
Result
.
failed
(
"查询子类目失败"
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/CategoryService.java
View file @
d7b6a7ab
...
@@ -59,5 +59,12 @@ public interface CategoryService {
...
@@ -59,5 +59,12 @@ public interface CategoryService {
*/
*/
Result
findCategoryByTransverse
(
CategoryRequestDto
dto
);
Result
findCategoryByTransverse
(
CategoryRequestDto
dto
);
/**
* 查询子类目,没有就返回本身
* @param dto
* @return
*/
Result
findChildCategory
(
CategoryRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/QueryPriceController.java
View file @
d7b6a7ab
...
@@ -60,6 +60,13 @@ public class QueryPriceController {
...
@@ -60,6 +60,13 @@ public class QueryPriceController {
}
}
@ApiOperation
(
value
=
"查询子类目"
)
@PostMapping
(
"/findChildCategory"
)
public
Result
findChildCategory
(
@RequestBody
CategoryRequestDto
dto
)
{
return
categoryService
.
findChildCategory
(
dto
);
}
@ApiOperation
(
value
=
"查询所有叶子类目"
)
@ApiOperation
(
value
=
"查询所有叶子类目"
)
@PostMapping
(
"/findAllChildCategory"
)
@PostMapping
(
"/findAllChildCategory"
)
public
Result
findAllChildCategory
(
@RequestBody
CategoryRequestDto
dto
)
{
public
Result
findAllChildCategory
(
@RequestBody
CategoryRequestDto
dto
)
{
...
...
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