Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1-office-web-sit
Commits
7220d44d
Commit
7220d44d
authored
Dec 10, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】知识检索接口
parent
ec2a8369
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
166 additions
and
3 deletions
+166
-3
NewsController.java
...a/io/office/modules/manage/controller/NewsController.java
+8
-0
NewsDao.java
src/main/java/io/office/modules/manage/dao/NewsDao.java
+3
-0
NewsService.java
...in/java/io/office/modules/manage/service/NewsService.java
+2
-0
NewsServiceImpl.java
...o/office/modules/manage/service/impl/NewsServiceImpl.java
+130
-3
NewsDao.xml
src/main/resources/mapper/manage/NewsDao.xml
+23
-0
No files found.
src/main/java/io/office/modules/manage/controller/NewsController.java
View file @
7220d44d
...
...
@@ -354,5 +354,13 @@ public class NewsController extends AbstractController {
return
R
.
ok
().
put
(
"data"
,
list
);
}
/**知识检索*/
@Login
@PostMapping
(
"/api/searchKnowledgeInfo"
)
public
R
searchKnowledgeInfo
(
@RequestBody
NewsParams
newsParams
)
{
Map
<
String
,
Object
>
retMap
=
this
.
newsService
.
searchKnowledgeInfo
(
newsParams
);
return
R
.
ok
().
put
(
"data"
,
retMap
);
}
}
src/main/java/io/office/modules/manage/dao/NewsDao.java
View file @
7220d44d
...
...
@@ -64,4 +64,7 @@ public interface NewsDao extends BaseMapper<NewsEntity> {
List
<
KnowledgeinfoEntity
>
selectTips
(
NewsParams
newsParams
);
List
<
String
>
selectChild
(
Map
<
String
,
Object
>
params
);
List
<
Map
<
String
,
Object
>>
searchKnowledgeInfo
(
Map
<
String
,
Object
>
map
);
}
src/main/java/io/office/modules/manage/service/NewsService.java
View file @
7220d44d
...
...
@@ -64,5 +64,7 @@ public interface NewsService extends IService<NewsEntity> {
List
<
GlossaryEntity
>
glossaryList
(
NewsParams
newsParams
);
List
<
KnowledgeinfoEntity
>
selectTips
(
NewsParams
newsParams
);
Map
<
String
,
Object
>
searchKnowledgeInfo
(
NewsParams
newsParams
);
}
src/main/java/io/office/modules/manage/service/impl/NewsServiceImpl.java
View file @
7220d44d
...
...
@@ -8,9 +8,9 @@ import io.office.modules.manage.entity.dto.NewsParams;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.
List
;
import
java.util.Map
;
import
java.util.
*
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -225,5 +225,131 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
return
list
;
}
@Override
public
Map
<
String
,
Object
>
searchKnowledgeInfo
(
NewsParams
newsParams
)
{
final
Map
<
String
,
Object
>[]
map
=
new
Map
[]{
new
HashMap
<>()};
Map
<
String
,
Object
>
retMap
=
new
HashMap
<>();
List
<
String
>
list
=
new
ArrayList
<>();
if
(
"all"
.
equals
(
newsParams
.
getType
())){
list
.
add
(
"sptm"
);
list
.
add
(
"ewtm"
);
list
.
add
(
"zxcbm"
);
list
.
add
(
"dwbm"
);
list
.
add
(
"gln"
);
list
.
add
(
"epc"
);
list
.
add
(
"rfid"
);
list
.
add
(
"gds"
);
list
.
add
(
"ecr"
);
list
.
add
(
"ebXML"
);
}
else
{
list
.
add
(
newsParams
.
getType
());
}
list
.
stream
().
forEach
(
item
->{
//判断是否是全部分类
if
(
"sptm"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"40"
);
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"sptm"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"sptm"
,
dataList
);
}
else
if
(
"ewtm"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"45"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"ewtm"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"ewtm"
,
dataList
);
}
else
if
(
"zxcbm"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"93"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"zxcbm"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"zxcbm"
,
dataList
);
}
else
if
(
"dwbm"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"94"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"dwbm"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"dwbm"
,
dataList
);
}
else
if
(
"gln"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"95"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"gln"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"gln"
,
dataList
);
}
else
if
(
"epc"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"83"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"epc"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"epc"
,
dataList
);
}
else
if
(
"rfid"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"77"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"rfid"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"rfid"
,
dataList
);
}
else
if
(
"gds"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"85"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"gds"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"gds"
,
dataList
);
}
else
if
(
"ecr"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"81"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"ecr"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"ecr"
,
dataList
);
}
else
if
(
"ebXML"
.
equals
(
item
)){
map
[
0
]
=
new
HashMap
<>();
map
[
0
].
put
(
"name"
,
"79"
);
map
[
0
].
put
(
"title"
,
newsParams
.
getTitle
());
List
<
String
>
child
=
getChild
(
map
[
0
]);
map
[
0
].
put
(
"list"
,
child
);
map
[
0
].
put
(
"typeName"
,
"ebXML"
);
List
<
Map
<
String
,
Object
>>
dataList
=
getDataList
(
map
[
0
]);
retMap
.
put
(
"ebXML"
,
dataList
);
}
});
return
retMap
;
}
private
List
<
Map
<
String
,
Object
>>
getDataList
(
Map
<
String
,
Object
>
map
)
{
List
<
Map
<
String
,
Object
>>
list
=
this
.
newsDao
.
searchKnowledgeInfo
(
map
);
return
list
;
}
private
List
<
String
>
getChild
(
Map
<
String
,
Object
>
map
)
{
List
<
String
>
list
=
this
.
newsDao
.
selectChild
(
map
);
return
list
;
}
}
\ No newline at end of file
src/main/resources/mapper/manage/NewsDao.xml
View file @
7220d44d
...
...
@@ -424,4 +424,26 @@
levels DESC,
knowledgeInfoid DESC
</select>
<select
id=
"selectChild"
resultType=
"java.lang.String"
>
select t.knowledgeCategoryID FROM knowledgeCategory t where t.parentCategoryID = #{name}
</select>
<select
id=
"searchKnowledgeInfo"
resultType=
"java.util.Map"
>
SELECT
t.Title,
t.knowledgeInfoID,
tt.description,
#{typeName} as type
FROM
knowledgeInfo t
LEFT JOIN knowledgeCategory tt ON t.knowledgeCategoryID = tt.knowledgeCategoryID
where 1=1
<if
test=
"title !=null and title !=''"
>
and t.Title like concat(concat('%',#{title}),'%')
</if>
and t.knowledgeCategoryID in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
</mapper>
\ 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