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
3bc2cdd4
Commit
3bc2cdd4
authored
Aug 25, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 小程序分类名称搜索
parent
18ea215a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
...ao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
+7
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+11
-1
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
View file @
3bc2cdd4
...
@@ -35,6 +35,14 @@ public interface CategoryDao {
...
@@ -35,6 +35,14 @@ public interface CategoryDao {
*/
*/
List
<
Category
>
queryByName
(
String
name
);
List
<
Category
>
queryByName
(
String
name
);
/**
* 判断是否存在子类目
*
* @param id
* @return
*/
boolean
isExistedChild
(
Integer
id
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
int
updateById
(
Category
category
);
int
updateById
(
Category
category
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/CategoryDaoImpl.java
View file @
3bc2cdd4
...
@@ -64,6 +64,13 @@ public class CategoryDaoImpl implements CategoryDao {
...
@@ -64,6 +64,13 @@ public class CategoryDaoImpl implements CategoryDao {
return
categoryMapper
.
selectByExample
(
example
);
return
categoryMapper
.
selectByExample
(
example
);
}
}
@Override
public
boolean
isExistedChild
(
Integer
id
)
{
CategoryExample
example
=
new
CategoryExample
();
example
.
or
().
andPidEqualTo
(
id
).
andIsDeletedEqualTo
(
false
);
return
categoryMapper
.
countByExample
(
example
)
>
0
;
}
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
public
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
String
order
)
{
CategoryExample
example
=
new
CategoryExample
();
CategoryExample
example
=
new
CategoryExample
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
3bc2cdd4
...
@@ -82,7 +82,17 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -82,7 +82,17 @@ public class CategoryServiceImpl implements CategoryService {
return
Result
.
success
(
new
ArrayList
<>());
return
Result
.
success
(
new
ArrayList
<>());
}
}
try
{
try
{
return
Result
.
success
(
categoryDao
.
queryByName
(
dto
.
getName
()));
List
<
Category
>
result
=
new
ArrayList
<>();
List
<
Category
>
list
=
categoryDao
.
queryByName
(
dto
.
getName
());
// 筛选叶子节点
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
Category
category
:
list
)
{
if
(!
categoryDao
.
isExistedChild
(
category
.
getId
()))
{
result
.
add
(
category
);
}
}
}
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"搜索分类失败"
,
e
);
logger
.
error
(
"搜索分类失败"
,
e
);
return
Result
.
failed
(
"搜索分类失败"
);
return
Result
.
failed
(
"搜索分类失败"
);
...
...
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