Commit ec1edcc8 by 田超

Merge branch 'fixbug/batchImportMethodCategoryIsNull' into 'master'

bug: [none] 资讯从资讯库中导入分类没有映射值

See merge request rays/pcloud-book!888
parents ea2a4b66 2513e73f
...@@ -306,9 +306,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -306,9 +306,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap.put("subjectLabelId", subjectLabelId); paramMap.put("subjectLabelId", subjectLabelId);
} }
PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew( PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew(
new PageParam(currentPage,numPerPage) ,paramMap,"listAppletNews"); new PageParam(currentPage, numPerPage), paramMap, "listAppletNews", "listAppletNewsCount");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){ if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
fillLabel(pageBeanNew.getRecordList()); fillLabel(pageBeanNew.getRecordList());
setLabelContent(pageBeanNew.getRecordList()); setLabelContent(pageBeanNew.getRecordList());
...@@ -556,7 +556,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -556,7 +556,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
Long newsId = newsDTO.getId(); Long newsId = newsDTO.getId();
List<AppletNewsCategoryDTO> newsCategoryDTOList = appletNewsCategoryDao.getByNewsId(newsId); List<AppletNewsCategoryDTO> newsCategoryDTOList = appletNewsCategoryDao.getByNewsId(newsId);
if (ListUtils.isEmpty(newsCategoryDTOList)) { if (ListUtils.isEmpty(newsCategoryDTOList)) {
return; continue;
} }
List<Long> firstClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getFirstClassify) List<Long> firstClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getFirstClassify)
...@@ -1003,7 +1003,17 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -1003,7 +1003,17 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if (ListUtils.isEmpty(appletNewsList)) { if (ListUtils.isEmpty(appletNewsList)) {
return; return;
} }
appletNewsDao.insert(appletNewsList); appletNewsDao.insert(appletNewsList);
for (AppletNews appletNews: appletNewsList){
AppletNewsCategory category = new AppletNewsCategory();
category.setFirstClassify(appletNews.getFirstClassify());
category.setSecondClassify(appletNews.getSecondClassify());
category.setGradeLabelId(appletNews.getGradeLabelId());
category.setSubjectLabelId(appletNews.getSubjectLabelId());
saveAppletNewsCategory(Arrays.asList(category),appletNews.getId());
}
} }
@Override @Override
......
...@@ -129,6 +129,55 @@ ...@@ -129,6 +129,55 @@
where id=#{id} where id=#{id}
</delete> </delete>
<select id="listAppletNewsCount" parameterType="map" resultType="integer">
SELECT count(DISTINCT n.id)
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
LEFT JOIN applet_news_category category on n.id = category.applet_news_id
WHERE 1=1
<if test="name != null">
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
</if>
<if test="newsClassifyId >0">
AND n.news_classify_id = #{newsClassifyId}
</if>
<if test="showState != null">
AND n.show_state = #{showState}
</if>
<if test="firstClassify!=null">
AND category.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND category.second_classify =#{secondClassify}
</if>
<if test="gradeLabelId != null">
AND category.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
AND category.subject_label_id = #{subjectLabelId}
</if>
<if test="rightsClassifyId!=null">
AND n.rights_classify_id =#{rightsClassifyId}
</if>
<if test="source != null">
AND n.source = #{source}
</if>
<if test="customTagId != null">
AND n.custom_tag_id = #{customTagId}
</if>
<choose>
<when test="agentId != null">
and n.agent_id = #{agentId}
</when>
<otherwise>
and n.agent_id = 0
</otherwise>
</choose>
ORDER BY n.update_time DESC
</select>
<select id="listAppletNews" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="listAppletNews" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT DISTINCT SELECT DISTINCT
n.id, n.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment