IMWebOrderStatictisMapper.xml 1.2 KB
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.integral.web.dao.IMWebOrderStatictisDao">
    
    <!-- 统计订单数量 -->
	<select id="statisticsOrderNum" parameterType="map" resultMap="orderCountResult">
		select orderTemp.* from
		<foreach collection="tableNames" open="(" close=")" separator=" UNION ALL " item="orderTable">
			select count(1) cou, order_status 
	        from ${orderTable[0]} 
	        where 1=1 and delete_flag = 1 
	        <if test="orderType !=null and orderType !=''">
	        	<if test="orderType == 'integral'">
					and order_from = 0 
				</if>
				<if test="orderType == 'money'">
					and order_from = 1 
				</if>
			</if>
			<if test="isCurrentDay !=null and isCurrentDay !=''">
				and date(create_dt) = curdate()
			</if>
			group by order_status 
		</foreach>
		as orderTemp
	</select>

    <resultMap type="com.sibu.orderHelper.integral.vo.OrderCount" id="orderCountResult">
    	<id column="cou" property="cou"/>
        <result column="order_status" property="orderStatus" />
    </resultMap>
</mapper>