feat (farm): 农事报表
- 农事任务分类统计 - 种植类信息 - 投入品分类统计/金额统计
This commit is contained in:
@@ -44,4 +44,49 @@
|
||||
ORDER BY usageAmount DESC
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getFarmReport"
|
||||
parameterType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.ChartCommonReqVO"
|
||||
resultType="cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.FarmingReport1RespVO">
|
||||
SELECT
|
||||
fpp.base_id AS baseId,
|
||||
fpp.base_name AS baseName,
|
||||
fpp.plan_number AS planNumber,
|
||||
ffr.task_start_date AS taskStartDate,
|
||||
ffr.task_end_date AS taskEndDate,
|
||||
DATEDIFF(ffr.task_end_date, ffr.task_start_date) AS intervalDays,
|
||||
fiur.input_id AS inputId,
|
||||
fiur.input_name AS inputName,
|
||||
fiur.total_price AS inputTotalPrice,
|
||||
fiur.usage_amount AS usageAmount,
|
||||
fiur.current_spec_type AS currentSpecType,
|
||||
CASE
|
||||
WHEN fiur.current_spec_type = 1 THEN fiur.unit
|
||||
WHEN fiur.current_spec_type = 2 THEN fiur.spec
|
||||
ELSE fiur.unit
|
||||
END AS unit
|
||||
FROM farm_input_usage_records fiur
|
||||
INNER JOIN farm_farming_record ffr ON fiur.farm_record_id = ffr.id
|
||||
INNER JOIN farm_production_plan fpp ON ffr.production_plan_id = fpp.id
|
||||
<where>
|
||||
fiur.deleted = 0
|
||||
<if test="tenantId != null">
|
||||
AND fiur.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="yearDate != null">
|
||||
AND YEAR(ffr.task_start_date) = #{yearDate}
|
||||
</if>
|
||||
<if test="baseId != null and baseId != ''">
|
||||
AND fiur.base_id = #{baseId}
|
||||
</if>
|
||||
<if test="plotId != null and plotId != ''">
|
||||
AND fiur.plot_id = #{plotId}
|
||||
</if>
|
||||
<if test="state != null and state != ''">
|
||||
AND fpp.plan_status = #{state}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ffr.task_start_date DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user