| | |
| | | <if test="farmingRecord.farmId!=null and farmingRecord.farmId!=''"> |
| | | and sl.farm_id = #{farmingRecord.farmId} |
| | | </if> |
| | | ORDER BY sfr.create_time DESC |
| | | </select> |
| | | |
| | | <!--自定义查询农事记录分页数据--> |
| | | <select id="selectFarmingRecordPageByNz" resultType="org.springblade.modules.farm.vo.FarmingRecordVO"> |
| | | SELECT |
| | | sfr.*, |
| | | sl.land_name landName, |
| | | user.real_name, |
| | | strain.strain_name, |
| | | sf.factory_name |
| | | FROM |
| | | sys_farming_record sfr |
| | | LEFT JOIN sys_land sl ON sl.id = sfr.land_id |
| | | LEFT JOIN blade_user user on sfr.operator = user.id |
| | | LEFT JOIN sys_strain strain on sfr.strain_id = strain.id |
| | | LEFT JOIN sys_stockfactory sf on sf.id = sfr.stock_id |
| | | WHERE |
| | | 1 =1 AND sfr.stock_id IS NOT NULL |
| | | <if test="farmingRecord.landId!=null and farmingRecord.landId!=''"> |
| | | and sfr.land_id = #{farmingRecord.landId} |
| | | </if> |
| | | <if test="farmingRecord.type!=null and farmingRecord.type!=''"> |
| | | and sfr.type = #{farmingRecord.type} |
| | | </if> |
| | | <if test="farmingRecord.stockId!=null and farmingRecord.stockId!=''"> |
| | | and sfr.stock_id = #{farmingRecord.stockId} |
| | | </if> |
| | | <if test="farmingRecord.jobWay!=null and farmingRecord.jobWay!=''"> |
| | | and sfr.job_way = #{farmingRecord.jobWay} |
| | | </if> |
| | | <if test="farmingRecord.operator!=null and farmingRecord.operator!=''"> |
| | | and sfr.operator = #{farmingRecord.operator} |
| | | </if> |
| | | <if test="farmingRecord.deptId!=null and farmingRecord.deptId!=''"> |
| | | and sfr.dept_id = #{farmingRecord.deptId} |
| | | </if> |
| | | <if test="farmingRecord.tenantId!=null and farmingRecord.tenantId!=''"> |
| | | and sfr.tenant_id = #{farmingRecord.tenantId} |
| | | </if> |
| | | <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 = #{farmingRecord.farmId} |
| | | </if> |
| | | ORDER BY sfr.create_time DESC |
| | | </select> |
| | | |
| | | <select id="selectFarmingRecordPages" resultType="org.springblade.modules.farm.vo.FarmingRecordVO"> |
| | |
| | | left join sys_land sl on sl.id = sfr.land_id |
| | | WHERE |
| | | YEAR(sfr.time) = YEAR(NOW()) |
| | | AND sfr.stock_id != NULL |
| | | AND sfr.stock_id != "" |
| | | and sl.farm_id=#{farmId} |
| | | </select> |
| | | <!--去年农资使用量--> |
| | |
| | | <if test="farm.strainId!=null and farm.strainId!=''"> |
| | | and sfr.strain_id = #{farm.strainId} |
| | | </if> |
| | | <if test="farm.startTime!=null and farm.startTime!=''"> |
| | | and sfr.create_time >= #{farm.startTime} |
| | | </if> |
| | | <if test="farm.endTime!=null and farm.endTime!=''"> |
| | | and sfr.create_time <= #{farm.endTime} |
| | | </if> |
| | | order by sfr.time desc,sfr.create_time desc |
| | | </select> |
| | | <select id="getDetails" resultType="org.springblade.modules.farm.vo.FarmingRecordVO"> |
| | | SELECT sfr.*,land.land_name, |
| | | bdb.dict_value AS typeName, |
| | | strain.strain_name AS strainName, |
| | | stock.agriculturalType, |
| | | stock.agricultural_name, |
| | | bu.name AS realName |
| | | FROM sys_farming_record sfr |
| | | LEFT JOIN sys_land land ON land.id = sfr.land_id |
| | | LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sfr.type |
| | | LEFT JOIN sys_strain strain ON strain.id = sfr.strain_id |
| | | LEFT JOIN ( |
| | | SELECT stf.id,stf.agricultural_name,bdb1.dict_value AS agriculturalType |
| | | FROM sys_stockfactory stf |
| | | LEFT JOIN blade_dict_biz bdb1 ON stf.type = bdb1.dict_key |
| | | WHERE bdb1.code = "stockType" GROUP BY stf.id,stf.agricultural_name,bdb1.dict_value |
| | | ) stock ON sfr.stock_id = stock.id |
| | | LEFT JOIN blade_user bu ON bu.id = sfr.operator |
| | | WHERE bdb.code = "farmingType" AND sfr.id = #{FarmingRecordVO.id} |
| | | </select> |
| | | </mapper> |