智慧农业后台管理
Administrator
2022-05-19 30c3d4510aa688dbcaa8797517b6bcd06c61aaaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?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="org.springblade.modules.farm.mapper.FarmingRecordMapper">
 
    <!--自定义查询农事记录分页数据-->
    <select id="selectFarmingRecordPage" resultType="org.springblade.modules.farm.vo.FarmingRecordVO">
        select sfr.*,sl.land_name landName from sys_farming_record sfr
        left join sys_land sl on sl.id = sfr.land_id
        where 1=1
        <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>
    </select>
 
    <!--查询统计本年农事记录操作总数-->
    <select id="getFarmingCount" resultType="java.lang.Integer">
        select ifnull(count(*),0) count from sys_farming_record
        where 1=1
        and YEAR(time)=YEAR(NOW())
    </select>
</mapper>