Merge branch 'feature-BI' into dev

This commit is contained in:
Lemon
2026-05-15 09:21:15 +08:00
19 changed files with 477 additions and 4 deletions

View File

@@ -338,4 +338,8 @@
t2.vin_code = #{vinCode,jdbcType=VARCHAR} or t2.vin_code = reverse(#{vinCode,jdbcType=VARCHAR})
)
</select>
<select id="countTotalMembers" resultType="java.lang.Long">
select count(*) from member_basic_info where del_flag = '0'
</select>
</mapper>

View File

@@ -3656,4 +3656,51 @@
#{orderCode}
</foreach>
</update>
<select id="getUsageTrendData" resultType="com.jsowell.pile.vo.web.UsageTrendVO">
select
DATE_FORMAT(t1.create_time, '%Y-%m-%d') as date,
count(*) as orderCount,
ifnull(sum(t2.total_used_electricity), 0) as electricity,
ifnull(sum(t2.total_order_amount), 0) as orderAmount
from order_basic_info t1
left join order_detail t2 on t1.order_code = t2.order_code
where t1.del_flag = '0'
and t1.order_status = '6'
<if test="dto.startTime != null and dto.startTime != ''">
and t1.create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null and dto.endTime != ''">
and t1.create_time &lt;= #{dto.endTime}
</if>
group by DATE_FORMAT(t1.create_time, '%Y-%m-%d')
order by date asc
</select>
<select id="countTotalOrders" resultType="java.lang.Long">
select count(*) from order_basic_info where del_flag = '0'
</select>
<select id="getTimeDistribution" resultType="com.jsowell.pile.vo.web.TimeDistributionVO">
SELECT
HOUR(t1.create_time) AS hour,
COUNT(*) AS orderCount
FROM order_basic_info t1
WHERE t1.del_flag = '0'
AND t1.order_status = '6'
<if test="dto.startTime != null and dto.startTime != ''">
AND t1.create_time &gt;= #{dto.startTime}
</if>
<if test="dto.endTime != null and dto.endTime != ''">
AND t1.create_time &lt;= #{dto.endTime}
</if>
<if test="dto.stationIdList != null and dto.stationIdList.size() > 0">
AND t1.station_id IN
<foreach item="sid" collection="dto.stationIdList" open="(" separator="," close=")">
#{sid}
</foreach>
</if>
GROUP BY HOUR(t1.create_time)
ORDER BY hour ASC
</select>
</mapper>

View File

@@ -754,4 +754,36 @@
#{merchantId,jdbcType=VARCHAR}
</foreach>
</select>
<select id="countTotalStations" resultType="java.lang.Long">
select count(*) from pile_station_info where del_flag = '0'
</select>
<select id="getStationMapData" resultType="com.jsowell.pile.vo.web.StationMapVO">
select station_name as stationName,
station_lng as stationLng,
station_lat as stationLat
from pile_station_info
where del_flag = '0'
and station_lng is not null
and station_lat is not null
and station_lng != ''
and station_lat != ''
</select>
<select id="getCityDeviceCount" resultType="com.jsowell.pile.vo.web.CityDeviceCountVO">
SELECT
CASE
WHEN address LIKE '%省%' AND address LIKE '%市%' THEN
CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(address, '省', -1), '市', 1), '市')
WHEN address LIKE '%市%' THEN
LEFT(SUBSTRING_INDEX(address, '市', 1), 3)
ELSE '其他'
END AS cityName,
COUNT(*) AS deviceCount
FROM pile_station_info
WHERE del_flag = '0' AND address IS NOT NULL AND address != ''
GROUP BY cityName
ORDER BY deviceCount DESC
</select>
</mapper>