關於點贊和點倒的sql語句

<select id="selectTotalCommentByCboId" resultMap="BaseResultMap" parameterType="com.nxmall.order.entity.OrderCommentEntity" > select COUNT(IF (indicate1 = 1, TRUE,NULL) )AS a1,COUNT(IF (indicate1 = 2, TRUE,NULL) )AS a2, COUNT(IF (indicate2 = 1, TRUE,NULL) )AS b1,COUNT(IF (indicate2 = 2, TRUE,NULL) )AS b2, COUNT(IF (indicate3 = 1, TRUE,NULL) )AS c1,COUNT(IF (indicate3 = 2, TRUE,NULL) )AS c2, COUNT(IF (indicate4 = 1, TRUE,NULL) )AS d1,COUNT(IF (indicate4 = 2, TRUE,NULL) )AS d2, count(*) AS totalCount FROM nxmall_order_comment where cbo_id = #{cboId,jdbcType=BIGINT} <if test="cmemberRole != null"> and cmember_role = #{cmemberRole,jdbcType=TINYINT} </if> </select>it

相關文章
相關標籤/搜索