Commit b5ac042c by 田超

Merge branch 'feature/slowsql1012' into 'master'

feat:[none]agentBookListSlowsql

See merge request rays/pcloud-book!1432
parents dc41f803 16871da1
......@@ -1282,7 +1282,7 @@ public class BookBizImpl implements BookBiz {
if (ListUtils.isEmpty(agent4AdviserIds)) {
return new PageBean(0, 0, new ArrayList<>());
}
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listPage4Agent");
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listPage4Agent", "countListPage4Agent");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(pageParam.getPageNum(), pageParam.getNumPerPage(), pageBean.getTotalCount(), new ArrayList<>());
}
......
......@@ -1331,7 +1331,96 @@
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
A.CREATED_DATE DESC
A.IS_DELETE, A.CREATED_DATE DESC
</select>
<!-- 书刊列表-出版端-书刊总数-->
<select id="countListPage4Agent" parameterType="map" resultType="integer">
SELECT
count(1)
FROM
(
SELECT
A.BOOK_ID
FROM
BOOK_ADVISER A
INNER JOIN
BOOK B
ON
A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
AND
A.ADVISER_ID IN
<foreach collection="agent4AdviserIds" index="i" item="item" open="(" separator="," close=")">
${item}
</foreach>
AND A.IS_MAIN_EDITOR = 1
<if test="isFundSupport != null">
LEFT JOIN BOOK_FUND BF
ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
</if>
<if test="minimumSupport != null">
LEFT JOIN book_minimum_support s
ON B.BOOK_ID = s.book_id AND s.end_time <![CDATA[ > ]]> NOW() AND s.start_time <![CDATA[ < ]]> NOW()
</if>
WHERE
1=1
<if test="typeCode!=null">
AND B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId!=null">
AND A.CHANNEL_ID = #{channelId}
</if>
<if test="bookName!=null">
AND (B.BOOK_NAME LIKE CONCAT('%',#{bookName},'%')
OR B.ISBN LIKE CONCAT(#{bookName},'%')
<if test="nameList != null and nameList.size > 0">
OR (
<foreach collection="nameList" close=" " separator=" and " open=" " item="item">
(B.BOOK_NAME LIKE CONCAT('%', '${item}', '%'))
</foreach>
)
</if>
<if test="adviserIds!=null and adviserIds.size()>0">
OR
A.ADVISER_ID in
<foreach collection="adviserIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
)
</if>
<if test="isbn!=null">
AND B.ISBN LIKE CONCAT(#{isbn},'%')
</if>
<if test="templetId!=null">
AND A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds!=null and secondTempletIds.size()>0">
AND A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="thirdTempletIds!=null and thirdTempletIds.size()>0">
AND A.third_TEMPLET_ID in
<foreach collection="thirdTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="isFundSupport != null">
AND BF.BOOK_FUND_ID IS NOT NULL
</if>
<if test="isPrint != null">
AND A.IS_PRINT = #{isPrint}
</if>
<if test="minimumSupport != null">
AND s.id is NOT NULL
</if>
<if test="startTime!=null and endTime!=null">
and b.CREATED_DATE between #{startTime} and #{endTime}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
) tmp
</select>
<!-- 获取书籍列表(APP) -->
......
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