Files
FTC25009/ruoyi-admin/src/main/resources/mapper/kpi/KpiMapper.xml
2026-06-10 10:03:08 +08:00

76 lines
3.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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.kpi.mapper.KpiMapper">
<!-- 入库趋势:in_or_out < 20,按日期+仓库分组 -->
<select id="selectInboundTrend" parameterType="com.ruoyi.kpi.domain.KpiQuery" resultType="map">
SELECT
CONVERT(varchar(10), finish_time, 23) AS date,
ISNULL(warehouse_name, '未分配') AS warehouseName,
COUNT(*) AS quantity
FROM mydo_job_finish
<where>
in_or_out &lt; 20
AND finish_time IS NOT NULL
AND finish_time != ''
<if test="warehouseId != null and warehouseId != ''">
AND warehouse_id = #{warehouseId}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
AND CONVERT(varchar(10), finish_time, 23) &gt;= #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
AND CONVERT(varchar(10), finish_time, 23) &lt;= #{params.endDate}
</if>
</where>
GROUP BY CONVERT(varchar(10), finish_time, 23), warehouse_name
ORDER BY CONVERT(varchar(10), finish_time, 23)
</select>
<!-- 出库趋势:in_or_out >= 20,按日期+仓库分组 -->
<select id="selectOutboundTrend" parameterType="com.ruoyi.kpi.domain.KpiQuery" resultType="map">
SELECT
CONVERT(varchar(10), finish_time, 23) AS date,
ISNULL(warehouse_name, '未分配') AS warehouseName,
COUNT(*) AS quantity
FROM mydo_job_finish
<where>
in_or_out &gt;= 20
AND finish_time IS NOT NULL
AND finish_time != ''
<if test="warehouseId != null and warehouseId != ''">
AND warehouse_id = #{warehouseId}
</if>
<if test="params.beginDate != null and params.beginDate != ''">
AND CONVERT(varchar(10), finish_time, 23) &gt;= #{params.beginDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
AND CONVERT(varchar(10), finish_time, 23) &lt;= #{params.endDate}
</if>
</where>
GROUP BY CONVERT(varchar(10), finish_time, 23), warehouse_name
ORDER BY CONVERT(varchar(10), finish_time, 23)
</select>
<!-- 货位平面图:按仓库+巷道+排筛选 -->
<select id="selectCargoSpacePlan" resultType="map">
SELECT
the_platoon AS thePlatoon,
the_column AS theColumn,
the_floor AS theFloor,
status,
locked,
tray_code AS trayCode,
cargo_space_id AS cargoSpaceId,
cargo_space_name AS cargoSpaceName
FROM bas_cargo_space
WHERE warehouse_id = #{warehouseId}
AND roadway_id = #{roadwayId}
AND the_platoon = #{thePlatoon}
ORDER BY the_floor, the_column
</select>
</mapper>