| | |
| | | <if test="farmingRecord.strainId!=null and farmingRecord.strainId!=''"> |
| | | and sfr.strain_id = #{farmingRecord.strainId} |
| | | </if> |
| | | <if test="farmingRecord.farmId!=null and farmingRecord.farmId!=''"> |
| | | and sl.farm_id = #{farm.farmId} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectFarmingRecordPages" resultType="org.springblade.modules.farm.vo.FarmingRecordVO"> |
| | |
| | | |
| | | <!--查询统计本年农事记录操作总数--> |
| | | <select id="getFarmingStatis" resultType="org.springblade.modules.farm.vo.FarmingStatisVO"> |
| | | select case |
| | | when type = 0 then '施肥' |
| | | select type,case when type = 0 then '施肥' |
| | | when type = 1 then '翻耕' |
| | | when type = 2 then '灌溉' |
| | | when type = 3 then '起垄' |
| | |
| | | |
| | | <!--今年农资使用量--> |
| | | <select id="selectJyCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS jynum |
| | | FROM sys_farming_record |
| | | SELECT IFNULL(SUM(census), 0) AS jynum FROM sys_farming_record sfr |
| | | left join sys_land sl on sl.id = sfr.land_id |
| | | WHERE |
| | | YEAR ( time ) = YEAR ( NOW( ) ) |
| | | AND stock_id != NULL |
| | | and dept_id=#{deptId} |
| | | YEAR(sfr.time) = YEAR(NOW()) |
| | | AND sfr.stock_id != NULL |
| | | and sl.farm_id=#{farmId} |
| | | </select> |
| | | <!--去年农资使用量--> |
| | | <select id="selectQyCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS qynum |
| | | FROM sys_farming_record |
| | | SELECT IFNULL(SUM(census), 0) AS qynum from sys_farming_record sfr |
| | | left join sys_land sl on sl.id = sfr.land_id |
| | | WHERE |
| | | YEAR (time) = YEAR ( date_sub(now() |
| | | YEAR (sfr.time) = YEAR ( date_sub(now() |
| | | , INTERVAL 1 YEAR)) |
| | | and dept_id=#{deptId} |
| | | and sl.farm_id=#{farmId} |
| | | </select> |
| | | |
| | | <!--本月农资使用量--> |
| | | <select id="selectByCount" resultType="java.lang.Double"> |
| | | SELECT IFNULL(SUM(census), 0) AS bynum |
| | | FROM sys_farming_record |
| | | WHERE DATE_FORMAT(time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | and dept_id = #{deptId} |
| | | SELECT IFNULL(SUM(census), 0) AS bynum from sys_farming_record sfr |
| | | left join sys_land sl on sl.id = sfr.land_id |
| | | WHERE DATE_FORMAT(sfr.time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | and sl.farm_id=#{farmId} |
| | | </select> |
| | | |
| | | <!--查询农事记录信息(种植开始起)--> |
| | |
| | | left join blade_user bu on bu.id = sfr.operator |
| | | left join sys_land sl on sl.id = sfr.land_id |
| | | left join sys_strain ss on ss.id = sfr.strain_id |
| | | where sl.farm_id = #{farm.farmId} |
| | | where 1=1 |
| | | <if test="farm.landId!=null and farm.landId!=''"> |
| | | and sfr.land_id = #{farm.landId} |
| | | </if> |
| | | <if test="farm.type!=null and farm.type!=''"> |
| | | and sfr.type = #{farm.type} |
| | | </if> |
| | | <if test="farm.stockId!=null and farm.stockId!=''"> |
| | | and sfr.stock_id = #{farm.stockId} |
| | | </if> |
| | | <if test="farm.jobWay!=null and farm.jobWay!=''"> |
| | | and sfr.job_way = #{farm.jobWay} |
| | | </if> |
| | | <if test="farm.operator!=null and farm.operator!=''"> |
| | | and sfr.operator = #{farm.operator} |
| | | </if> |
| | | <if test="farm.deptId!=null and farm.deptId!=''"> |
| | | and sfr.dept_id = #{farm.deptId} |
| | | </if> |
| | | <if test="farm.farmId!=null and farm.farmId!=''"> |
| | | and sl.farm_id = #{farm.farmId} |
| | | </if> |
| | | <if test="farm.strainId!=null and farm.strainId!=''"> |
| | | and sfr.strain_id = #{farm.strainId} |
| | | </if> |
| | | order by sfr.time desc,sfr.create_time desc |
| | | </select> |
| | | </mapper> |