分类分组搜索

<!--<select id="orderStatusList" parameterType="map" resultType="com.xinruke.cmall.order.interfaces.vo.OrderStatusVO">-->
<!--SELECT-->
<!--count( commodity.order_base_id ) count,-->
<!--commodity.STATUS,-->
<!--commodity.pay_status payStatus-->
<!--FROM-->
<!--(-->
<!--SELECT-->
<!--t.order_base_id,-->
<!--max(t.order_commodity_id) order_commodity_id,-->
<!--max(t.STATUS) STATUS,-->
<!--max(t.pay_status) pay_status-->
<!--FROM-->
<!--odr_order_commodity t-->
<!--WHERE-->
<!--consumer_id = #{consumerId} GROUP BY t.order_base_id ) commodity-->

<!--GROUP BY-->
<!--commodity.STATUS,commodity.pay_status-->
<!--</select>-->
<select id="orderStatusList" parameterType="map" resultType="com.xinruke.cmall.order.interfaces.vo.OrderStatusVO">
SELECT
count( t.order_base_id ) count,
t.STATUS,
t.pay_status payStatus
FROM
odr_order_base t
WHERE
consumer_id = #{consumerId}

GROUP BY
t.STATUS,t.pay_status
</select>

<!--<select id="orderStatusCategoryList" parameterType="map" resultType="com.xinruke.cmall.order.interfaces.vo.OrderStatusVO">-->
<!--SELECT-->
<!--count( commodity.order_base_id ) count,-->
<!--commodity.activity_code activityCode,-->
<!--commodity.delivery_type deliveryType,-->
<!--commodity.STATUS,-->
<!--commodity.pay_status payStatus-->
<!--FROM-->
<!--(-->
<!--SELECT-->
<!--t.order_base_id,-->
<!--t.activity_code,-->
<!--max(t.order_commodity_id) order_commodity_id,-->
<!--max(t.STATUS) STATUS,-->
<!--max(t.pay_status) pay_status,-->
<!--max(t.delivery_type) delivery_type-->
<!--FROM-->
<!--odr_order_commodity t-->
<!--WHERE-->
<!--1=1-->
<!--<if test="consumerId != null">AND consumer_id = #{consumerId}</if>-->
<!--<if test="activityCode != null and activityCode != 0">AND activity_code=#{activityCode}</if>-->
<!--<if test="deliveryType != null and activityCode == 0">AND delivery_type=#{deliveryType}</if>-->
<!--GROUP BY t.activity_code,t.order_base_id ) commodity-->
<!--GROUP BY-->
<!--commodity.activity_code,commodity.STATUS,commodity.pay_status,commodity.delivery_type-->
<!--</select>-->
<select id="orderStatusCategoryList" parameterType="map" resultType="com.xinruke.cmall.order.interfaces.vo.OrderStatusVO">
SELECT
count( t.order_base_id ) count,
t.activity_code activityCode,
t.delivery_type deliveryType,
t.STATUS,
t.pay_status payStatus
FROM
odr_order_base t
WHERE
1=1
<if test="consumerId != null">AND consumer_id = #{consumerId}</if>
<if test="activityCode != null and activityCode != 0">AND activity_code=#{activityCode}</if>
<if test="deliveryType != null and activityCode == 0">AND delivery_type=#{deliveryType}</if>

GROUP BY
t.activity_code,t.STATUS,t.pay_status,t.delivery_type
</select>
posted @ 2020-03-06 11:16  怕黑,可是却恋上了夜  阅读(131)  评论(0编辑  收藏  举报