Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
think-tank
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
think-tank
Commits
91d87531
提交
91d87531
authored
11月 08, 2024
作者:
布红亮
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
查询新增全部和其他查询
上级
a939f4c4
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
47 行增加
和
8 行删除
+47
-8
ThinktankBasicInfoServiceImpl.java
...thinktank/service/impl/ThinktankBasicInfoServiceImpl.java
+29
-8
ThinktankBasicInfoListVo.java
.../java/com/zzsn/thinktank/vo/ThinktankBasicInfoListVo.java
+4
-0
ThinktankBasicInfoMapper.xml
src/main/resources/mapper/ThinktankBasicInfoMapper.xml
+14
-0
没有找到文件。
src/main/java/com/zzsn/thinktank/service/impl/ThinktankBasicInfoServiceImpl.java
浏览文件 @
91d87531
...
...
@@ -3,7 +3,6 @@ package com.zzsn.thinktank.service.impl;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.core.date.DateTime
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -11,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Maps
;
import
com.zzsn.thinktank.constants.CommonConstants
;
import
com.zzsn.thinktank.entity.*
;
import
com.zzsn.thinktank.mapper.ThinktankBasicInfoMapper
;
...
...
@@ -27,7 +27,6 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
...
...
@@ -40,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
...
...
@@ -357,9 +355,23 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
@Override
public
Result
<?>
getList
(
ThinktankBasicInfoListVo
thinktankBasicInfoListVo
)
{
if
(
thinktankBasicInfoListVo
!=
null
&&
StringUtils
.
isNotBlank
(
thinktankBasicInfoListVo
.
getTypeId
())
// 缓存的type类型
String
cacheTypeStr
=
thinktankBasicInfoListVo
.
getTypeId
();
if
(
StringUtils
.
equals
(
thinktankBasicInfoListVo
.
getQueryType
(),
"all"
))
{
cacheTypeStr
=
"all"
;
thinktankBasicInfoListVo
.
setTypeId
(
null
);
thinktankBasicInfoListVo
.
setExcludeTypeIds
(
null
);
}
else
if
(
StringUtils
.
equals
(
thinktankBasicInfoListVo
.
getQueryType
(),
"other"
))
{
// 其它-排除热门的
cacheTypeStr
=
thinktankBasicInfoListVo
.
getExcludeTypeIds
().
toString
();
thinktankBasicInfoListVo
.
setTypeId
(
null
);
}
else
{
thinktankBasicInfoListVo
.
setExcludeTypeIds
(
null
);
}
if
(
StringUtils
.
isNotBlank
(
cacheTypeStr
)
&&
StringUtils
.
isBlank
(
thinktankBasicInfoListVo
.
getTagId
())){
IPage
cacheObject
=
(
IPage
)
simRedisUtil
.
getCacheObject
(
KEY
+
"_"
+
thinktankBasicInfoListVo
.
getTypeId
()
IPage
cacheObject
=
(
IPage
)
simRedisUtil
.
getCacheObject
(
KEY
+
"_"
+
cacheTypeStr
+
"_"
+
thinktankBasicInfoListVo
.
getColumn
()
+
"_"
+
thinktankBasicInfoListVo
.
getOrder
());
if
(
cacheObject
!=
null
){
return
Result
.
OK
(
cacheObject
);
...
...
@@ -452,9 +464,18 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
thinktankTagService
.
addTagTop
(
s
);
}
}
if
(
thinktankBasicInfoListVo
!=
null
&&
StringUtils
.
isNotBlank
(
thinktankBasicInfoListVo
.
getTypeId
())
&&
StringUtils
.
isBlank
(
thinktankBasicInfoListVo
.
getTagId
())){
simRedisUtil
.
setCacheObject
(
KEY
+
"_"
+
thinktankBasicInfoListVo
.
getTypeId
()
if
(
StringUtils
.
isNotBlank
(
cacheTypeStr
)
&&
StringUtils
.
isBlank
(
thinktankBasicInfoListVo
.
getTagId
())){
if
(
Arrays
.
asList
(
"all"
,
"other"
).
contains
(
cacheTypeStr
))
{
// all 和other数据量过大,只存id
List
<
Map
<
String
,
Object
>>
ids
=
(
List
<
Map
<
String
,
Object
>>)
page
.
getRecords
().
stream
()
.
map
(
v
->
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"id"
,
((
ThinktankBasicInfoVo
)
v
).
getId
());
return
map
;
}).
collect
(
Collectors
.
toList
());
page
.
setRecords
(
ids
);
}
simRedisUtil
.
setCacheObject
(
KEY
+
"_"
+
cacheTypeStr
+
"_"
+
thinktankBasicInfoListVo
.
getColumn
()
+
"_"
+
thinktankBasicInfoListVo
.
getOrder
(),
page
,
10L
,
TimeUnit
.
DAYS
);
}
return
Result
.
OK
(
page
);
...
...
src/main/java/com/zzsn/thinktank/vo/ThinktankBasicInfoListVo.java
浏览文件 @
91d87531
...
...
@@ -38,6 +38,10 @@ public class ThinktankBasicInfoListVo {
//类别 根据左侧树id
private
String
typeId
;
//all other
private
String
queryType
;
//查询排除类别
private
List
<
String
>
excludeTypeIds
;
//标签
private
String
tagId
;
...
...
src/main/resources/mapper/ThinktankBasicInfoMapper.xml
浏览文件 @
91d87531
...
...
@@ -27,6 +27,12 @@
AND a.tag_id like '%${item}%'
</foreach>
</if>
<if
test=
"excludeTypeIds != null and excludeTypeIds.size > 0"
>
AND a.belong_country_id not in
<foreach
item=
"item"
index=
"index"
collection=
"excludeTypeIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"keyword != null and keyword != ''"
>
AND
...
...
@@ -50,6 +56,14 @@
<if
test=
"typeId != null and typeId != ''"
>
AND a.belong_country_id = #{typeId}
</if>
<if
test=
"excludeTypeIds != null and excludeTypeIds.size > 0"
>
AND a.belong_country_id not in
<foreach
item=
"item"
index=
"index"
collection=
"excludeTypeIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"thinktankName != null and thinktankName != ''"
>
AND a.chinese_whole like '%${thinktankName}%'
</if>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论