java-mall/mall-shop/target/classes/mapper/analytics/AnalyticsStoreXml.xml
2024-10-26 10:01:40 +08:00

30 lines
1.0 KiB
XML

<?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.suisung.mall.shop.analytics.mapper.AnalyticsStoreDao">
<select id="getStoreNum" resultType="com.suisung.mall.common.pojo.vo.CommonNumVo">
SELECT
COUNT(1) AS num
FROM
shop_store_base
<where>
<if test="startTime!=null and endTime!=null">
AND store_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
<select id="getStoreTimeLine" resultType="com.suisung.mall.common.pojo.output.TimelineOutput">
SELECT
DATE_FORMAT(store_time, '%m-%d') AS time,
count(*) num
FROM
shop_store_base
<where>
<if test="startTime!=null and endTime!=null">
AND store_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
GROUP BY time
ORDER BY store_time
</select>
</mapper>