update 解决定时任务cpu飙升问题
This commit is contained in:
@@ -17,14 +17,14 @@ public interface ManageDocumentsMapper extends BaseMapper<ManageDocuments> {
|
||||
* 分页查询所有文档(中文)
|
||||
* @return
|
||||
*/
|
||||
List<ManageDocumentDto> getListDataByPage(@Param("keyword") String keyword);
|
||||
List<ManageDocumentDto> getListDataByPage(@Param("keyword") String keyword,@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 查询所有文档(英文)
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
List<ManageDocumentDto> getListDataEnByPage(@Param("keyword") String keyword);
|
||||
List<ManageDocumentDto> getListDataEnByPage(@Param("keyword") String keyword,@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 查询所有文档类型对应的文章列表
|
||||
|
||||
@@ -39,9 +39,9 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||
PageHelper.startPage(manageSearchDocumentVo.getPageNum(), manageSearchDocumentVo.getPageSize());
|
||||
List<ManageDocumentDto> listDataByPage;
|
||||
if (CountryConstant.EN.equals(manageSearchDocumentVo.getLang())){
|
||||
listDataByPage = manageDocumentsMapper.getListDataByPage(manageSearchDocumentVo.getKeyword());
|
||||
listDataByPage = manageDocumentsMapper.getListDataEnByPage(manageSearchDocumentVo.getKeyword(),manageSearchDocumentVo.getType());
|
||||
}else{
|
||||
listDataByPage = manageDocumentsMapper.getListDataByPage(manageSearchDocumentVo.getKeyword());
|
||||
listDataByPage = manageDocumentsMapper.getListDataByPage(manageSearchDocumentVo.getKeyword(),manageSearchDocumentVo.getType());
|
||||
}
|
||||
return getDataTable(listDataByPage);
|
||||
}
|
||||
@@ -111,7 +111,6 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||
.updateUser(SecurityUtils.getUsername())
|
||||
.build();
|
||||
}
|
||||
|
||||
int insert = manageDocumentsMapper.insert(build);
|
||||
if (insert > 0){
|
||||
return R.success("添加文章成功");
|
||||
@@ -182,6 +181,7 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||
.updateUser(documents.getUpdateUser())
|
||||
.updateTime(documents.getUpdateTime())
|
||||
.createTime(documents.getCreateTime())
|
||||
.type(documents.getType())
|
||||
.build();
|
||||
if (CountryConstant.EN.equals(manageBaseVo.getLang())){
|
||||
build.setTitle(documents.getTitleEn());
|
||||
@@ -205,9 +205,9 @@ public class ManageDocumentsServiceImpl extends ServiceImpl<ManageDocumentsMappe
|
||||
PageHelper.startPage(manageSearchDocumentVo.getPageNum(), manageSearchDocumentVo.getPageSize());
|
||||
List<ManageDocumentDto> listDataByPage;
|
||||
if (CountryConstant.EN.equals(manageSearchDocumentVo.getLang())){
|
||||
listDataByPage = manageDocumentsMapper.getListDataEnByPage(manageSearchDocumentVo.getKeyword());
|
||||
listDataByPage = manageDocumentsMapper.getListDataEnByPage(manageSearchDocumentVo.getKeyword(), manageSearchDocumentVo.getType());
|
||||
}else{
|
||||
listDataByPage = manageDocumentsMapper.getListDataByPage(manageSearchDocumentVo.getKeyword());
|
||||
listDataByPage = manageDocumentsMapper.getListDataByPage(manageSearchDocumentVo.getKeyword(), manageSearchDocumentVo.getType());
|
||||
}
|
||||
|
||||
return getDataTable(listDataByPage);
|
||||
|
||||
@@ -17,4 +17,7 @@ public class ManageSearchDocumentVo extends PageVo{
|
||||
|
||||
@ApiModelProperty(value = "语言",example = "zh")
|
||||
private String lang;
|
||||
|
||||
@ApiModelProperty(value = "文档类型",example = "1 挖矿教程 2常见问题 3公告中心 0其他")
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
@@ -19,14 +19,39 @@ SELECT
|
||||
type
|
||||
FROM
|
||||
manage_documents
|
||||
<where>
|
||||
del = false
|
||||
<if test="keyword != null">
|
||||
AND title like CONCAT('%',#{keyword},'%') OR sub_title like CONCAT('%',#{keyword},'%') OR content like CONCAT('%',#{keyword},'%')
|
||||
</if>
|
||||
</where>
|
||||
<where>
|
||||
del = false
|
||||
<choose>
|
||||
<when test="type != null">
|
||||
AND type = #{type}
|
||||
<if test="keyword != null">
|
||||
AND (<include refid="keywordSearch"/>)
|
||||
</if>
|
||||
</when>
|
||||
<when test="keyword != null">
|
||||
AND (<include refid="keywordSearch"/>)
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="keywordSearch">
|
||||
title like CONCAT('%',#{keyword},'%')
|
||||
OR sub_title like CONCAT('%',#{keyword},'%')
|
||||
OR content like CONCAT('%',#{keyword},'%')
|
||||
</sql>
|
||||
|
||||
|
||||
<sql id="keywordSearchEn">
|
||||
title_en like CONCAT('%',#{keyword},'%')
|
||||
OR sub_title_en like CONCAT('%',#{keyword},'%')
|
||||
OR content_en like CONCAT('%',#{keyword},'%')
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getListDataEnByPage" resultType="com.m2pool.manage.dto.ManageDocumentDto">
|
||||
SELECT
|
||||
id,
|
||||
@@ -42,9 +67,18 @@ FROM
|
||||
manage_documents
|
||||
<where>
|
||||
del = false
|
||||
<if test="keyword != null">
|
||||
AND title_en like CONCAT('%',#{keyword},'%') OR sub_title_en like CONCAT('%',#{keyword},'%') OR content_en like CONCAT('%',#{keyword},'%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="type != null">
|
||||
AND type = #{type}
|
||||
<if test="keyword != null">
|
||||
AND (<include refid="keywordSearchEn"/>)
|
||||
</if>
|
||||
</when>
|
||||
<when test="keyword != null">
|
||||
AND (<include refid="keywordSearchEn"/>)
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user