feat (farm): 远程API
- 生产计划-分页 - 生产计划-详情 - 数字驾驶舱-基地概要信息 - 数字驾驶舱-基地信息列表 - 数字驾驶舱-生产数据-产量对比 - 数字驾驶舱-生产数据-种植计划完成情况
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
<if test="id != null and id != ''">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -41,4 +41,45 @@
|
||||
</where>
|
||||
GROUP BY base_id
|
||||
</select>
|
||||
|
||||
<select id="getYieldComparisonChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.api.vo.YieldComparisonChartReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.api.vo.YieldComparisonChartRespVO">
|
||||
|
||||
SELECT
|
||||
YEAR(production_end_date) AS date,
|
||||
SUM(predicted_yields) AS predictedYields,
|
||||
SUM(practical_yields) AS practicalYields
|
||||
FROM farm_production_plan
|
||||
<where>
|
||||
plan_status = 3
|
||||
AND deleted = 0
|
||||
AND production_end_date IS NOT NULL
|
||||
<if test="tenantId != null and tenantId != ''">AND tenant_id = #{tenantId}</if>
|
||||
<if test="baseId != null and baseId != ''">AND base_id = #{baseId}</if>
|
||||
</where>
|
||||
GROUP BY YEAR(production_end_date)
|
||||
ORDER BY date
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getPlantingPlanCompletionChart"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.api.vo.PlantingPlanCompletionReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.api.vo.PlantingPlanCompletionRespVO">
|
||||
|
||||
SELECT
|
||||
ROUND(SUM(CASE WHEN plan_status = 1 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS notStartedRatio,
|
||||
ROUND(SUM(CASE WHEN plan_status = 2 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS inProgressRatio,
|
||||
ROUND(SUM(CASE WHEN plan_status = 3 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS completedRatio,
|
||||
ROUND(SUM(CASE WHEN plan_status = 4 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) AS overdueRatio
|
||||
FROM farm_production_plan
|
||||
<where>
|
||||
deleted = 0
|
||||
AND plan_status IN (1, 2, 3, 4)
|
||||
<if test="tenantId != null and tenantId != ''">AND tenant_id = #{tenantId}</if>
|
||||
<if test="baseId != null and baseId != ''">AND base_id = #{baseId}</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user