<?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.iotechn.unimall.data.mapper.OrderMapper">
|
|
|
<select id="selectOrderPage" resultType="com.iotechn.unimall.data.dto.order.OrderDTO">
|
SELECT
|
id,
|
order_no AS orderNo,
|
`status`,
|
actual_price AS actualPrice,
|
gmt_create AS gmtCreate
|
FROM
|
unimall_order
|
WHERE
|
user_id = #{userId}
|
<if test="status != null and status != 0">
|
AND `status` = #{status}
|
</if>
|
ORDER BY id DESC
|
LIMIT #{offset}, #{limit}
|
|
</select>
|
|
<select id="countOrder" resultType="java.lang.Long">
|
SELECT
|
count(1)
|
FROM
|
unimall_order
|
WHERE
|
user_id = #{userId}
|
<if test="status != null and status != 0">
|
AND `status` = #{status}
|
</if>
|
</select>
|
|
<select id="selectAreaStatistics" resultType="com.dobbinsoft.fw.support.model.KVModel">
|
SELECT
|
`province` AS `key`,
|
count( 1 ) AS `value`
|
FROM
|
unimall_order
|
WHERE
|
`province` IS NOT NULL
|
GROUP BY
|
`province`
|
</select>
|
|
<select id="selectChannelStatistics" resultType="com.dobbinsoft.fw.support.model.KVModel">
|
SELECT
|
`channel` AS `key`,
|
count( 1 ) AS `value`
|
FROM
|
unimall_order
|
GROUP BY
|
`channel`
|
</select>
|
|
<select id="selectOrderCountStatistics" resultType="com.dobbinsoft.fw.support.model.KVModel">
|
SELECT
|
DATE_FORMAT( gmt_create, '%Y-%m-%d' ) AS `key`,
|
count( 1 ) AS `value`
|
FROM
|
unimall_order AS u
|
WHERE
|
gmt_create > #{gmtStart}
|
GROUP BY
|
`key`;
|
</select>
|
|
<select id="selectOrderSumStatistics" resultType="com.dobbinsoft.fw.support.model.KVModel">
|
SELECT
|
DATE_FORMAT( gmt_create, '%Y-%m-%d' ) AS `key`,
|
sum( pay_price ) AS `value`
|
FROM
|
unimall_order AS u
|
WHERE
|
pay_price IS NOT NULL
|
AND gmt_create > #{gmtStart}
|
GROUP BY
|
`key`;
|
</select>
|
|
<select id="selectExpireOrderNos" resultType="com.iotechn.unimall.data.domain.OrderDO">
|
SELECT
|
id,
|
order_no as orderNo
|
FROM
|
unimall_order
|
WHERE
|
`status` = #{status}
|
AND gmt_update < #{time}
|
</select>
|
|
|
</mapper>
|