返回空容易产生异常,当值为null时,返回为0的写法
<select id="getBookWordCountBookPssAndChapterLockOrPass" resultType="LONG" parameterType="STRING"> select COALESCE(sum(word_count),0) as word_count from t_news_count WHERE chapter_id in ( SELECT chapter_id from t_content_chapter WHERE book_id = #{book_id,jdbcType=VARCHAR} AND ( status = 3 OR status = 1) ) AND ( 3 = (SELECT current_state FROM t_content_metadata WHERE book_id = #{book_id,jdbcType=VARCHAR} ) ) </select>
时间: 2024-10-29 19:06:37