2026-02-07 15:55:56 +00:00
|
|
|
<?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.ruoyi.excel.wecom.mapper.DepartmentStatisticsDataMapper">
|
|
|
|
|
|
|
|
|
|
<!-- 根据日期查询统计数据 -->
|
|
|
|
|
<select id="selectByDate" resultType="com.ruoyi.excel.wecom.domain.DepartmentStatisticsData">
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM department_statistics_data
|
2026-02-08 12:32:01 +00:00
|
|
|
WHERE corp_id = #{corpId} and stat_date = #{date}
|
2026-02-07 15:55:56 +00:00
|
|
|
ORDER BY department_path, sort_no
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 根据部门路径和日期范围查询统计数据 -->
|
|
|
|
|
<select id="selectByDepartmentAndDateRange" resultType="com.ruoyi.excel.wecom.domain.DepartmentStatisticsData">
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM department_statistics_data
|
2026-02-08 12:32:01 +00:00
|
|
|
WHERE corp_id = #{corpId} and department_path = #{departmentPath}
|
2026-02-07 15:55:56 +00:00
|
|
|
<if test="startDate != null">
|
|
|
|
|
AND stat_date >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
AND stat_date <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY stat_date, sort_no
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询指定部门的历史累计数据(总承接数) -->
|
|
|
|
|
<select id="selectHistoricalAcceptSum" resultType="map">
|
|
|
|
|
SELECT
|
|
|
|
|
SUM(daily_total_accepted) as total_value,
|
|
|
|
|
COUNT(*) as record_count
|
|
|
|
|
FROM department_statistics_data
|
2026-02-08 12:32:01 +00:00
|
|
|
WHERE corp_id = #{corpId} and department_path = #{departmentPath}
|
2026-02-07 15:55:56 +00:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询指定部门的历史累计数据(总成单数) -->
|
|
|
|
|
<select id="selectHistoricalOrderSum" resultType="map">
|
|
|
|
|
SELECT
|
|
|
|
|
SUM(daily_total_orders) as total_value,
|
|
|
|
|
COUNT(*) as record_count
|
|
|
|
|
FROM department_statistics_data
|
2026-02-08 12:32:01 +00:00
|
|
|
WHERE corp_id = #{corpId} and department_path = #{departmentPath}
|
2026-02-07 15:55:56 +00:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询部门统计数据VO列表(用于导出) -->
|
|
|
|
|
<select id="selectDepartmentStatisticsDataVOList" resultType="com.ruoyi.excel.wecom.vo.DepartmentStatisticsDataVO">
|
|
|
|
|
SELECT
|
|
|
|
|
stat_date as statDate,
|
|
|
|
|
department_path as departmentPath,
|
|
|
|
|
daily_total_accepted as dailyTotalAccepted,
|
|
|
|
|
daily_total_orders as dailyTotalOrders,
|
|
|
|
|
daily_conversion_rate as dailyConversionRate,
|
|
|
|
|
daily_timely_order_ratio as dailyTimelyOrderRatio,
|
|
|
|
|
daily_non_timely_order_ratio as dailyNonTimelyOrderRatio,
|
|
|
|
|
sort_no as sortNo
|
|
|
|
|
FROM department_statistics_data
|
|
|
|
|
<where>
|
2026-02-08 15:40:44 +00:00
|
|
|
corp_id = #{corpId}
|
2026-02-07 15:55:56 +00:00
|
|
|
<if test="startDate != null">
|
|
|
|
|
AND stat_date >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
AND stat_date <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="departmentPath != null and departmentPath != ''">
|
|
|
|
|
AND department_path LIKE CONCAT(#{departmentPath}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY stat_date DESC, department_path, sort_no
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDepartmentStatisticsDataList"
|
|
|
|
|
resultType="com.ruoyi.excel.wecom.domain.DepartmentStatisticsData">
|
|
|
|
|
SELECT
|
|
|
|
|
stat_date as statDate,
|
|
|
|
|
department_path as departmentPath,
|
|
|
|
|
daily_total_accepted as dailyTotalAccepted,
|
|
|
|
|
daily_total_orders as dailyTotalOrders,
|
|
|
|
|
daily_conversion_rate as dailyConversionRate,
|
|
|
|
|
daily_timely_order_ratio as dailyTimelyOrderRatio,
|
|
|
|
|
daily_non_timely_order_ratio as dailyNonTimelyOrderRatio,
|
|
|
|
|
sort_no as sortNo
|
|
|
|
|
FROM department_statistics_data
|
|
|
|
|
<where>
|
2026-02-08 15:40:44 +00:00
|
|
|
corp_id = #{corpId}
|
2026-02-07 15:55:56 +00:00
|
|
|
<if test="startDate != null">
|
|
|
|
|
AND stat_date >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
AND stat_date <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="departmentPath != null and departmentPath != ''">
|
|
|
|
|
AND department_path LIKE CONCAT(#{departmentPath}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY stat_date DESC, department_path, sort_no
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSummary" resultType="java.util.Map">
|
|
|
|
|
select sum(daily_total_orders) as totalOrders,
|
2026-02-08 08:22:43 +00:00
|
|
|
sum(ifnull(daily_total_accepted,0)+ifnull(manager_accepted,0)) as totalIns
|
|
|
|
|
from department_statistics_data
|
2026-02-07 15:55:56 +00:00
|
|
|
<where>
|
2026-02-08 12:32:01 +00:00
|
|
|
corp_id = #{corpId}
|
2026-02-07 15:55:56 +00:00
|
|
|
<if test="startDate != null">
|
|
|
|
|
AND stat_date >= #{startDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate != null">
|
|
|
|
|
AND stat_date <= #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="departmentPath != null and departmentPath != ''">
|
|
|
|
|
AND department_path = #{departmentPath}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|