智慧农业后台管理
guoshilong
2022-11-08 72b971c98c46531064d74b68fc8fe8864ed0b544
src/main/java/org/springblade/modules/traceability/mapper/TraceabilityMapper.xml
@@ -4,7 +4,7 @@
    <!--自定义查询溯源码分页数据-->
    <select id="selectTraceabilityPage" resultType="org.springblade.modules.traceability.vo.TraceabilityVO">
        select st.* from sys_traceability st
        select st.*,sr.land_id landId from sys_traceability st
        left join sys_recovery sr on st.recovery_id = sr.id
        LEFT JOIN sys_land sl ON sl.id = sr.land_id
        where 1=1
@@ -17,6 +17,31 @@
        <if test="traceability.tenantId!=null and traceability.tenantId!=''">
            and st.tenant_id = #{traceability.tenantId}
        </if>
        <if test="traceability.deptId != null and traceability.deptId != ''">
            and st.dept_id = #{traceability.deptId}
        </if>
        <if test="traceability.bind !=null and traceability.bind !=''">
            and st.bind = #{traceability.bind}
        </if>
    </select>
    <!--自定义查询溯源码分页数据-->
    <select id="selectTraceabilityXcxPage" resultType="org.springblade.modules.traceability.vo.TraceabilityVO">
        select a.id,a.code,c.land_name as landName,c.id as landId,a.product_name productName,
               a.create_time createTime,d.url,d.strain_name AS strainName,b.create_time AS recoveryTime from sys_traceability a
        LEFT JOIN sys_recovery b ON a.recovery_id = b.id
        LEFT JOIN sys_land c ON b.land_id = c.id
        LEFT JOIN sys_strain d ON b.strain_id = d.id
        where 1=1
        <if test="traceability.code!=null and traceability.code!=''">
            and a.code like concat('%',#{traceability.code},'%')
        </if>
        <if test="traceability.farmId!=null and traceability.farmId!=''">
            and c.farm_id = #{traceability.farmId}
        </if>
        <if test="traceability.tenantId!=null and traceability.tenantId!=''">
            and a.tenant_id = #{traceability.tenantId}
        </if>
    </select>
    <!--自定义查询溯源码数据,不分页-->