智慧农业后台管理
guoshilong
2022-09-01 cd7beee3c18d5875a556cb9da86d805ff2045618
src/main/java/org/springblade/modules/processInv/mapper/ProcessInvMapper.xml
@@ -56,7 +56,7 @@
        SELECT
            CASE
                WHEN
                    product_inventory_num > #{saleNum} THEN
                    product_inventory_num >= #{saleNum} THEN
                    TRUE ELSE FALSE
                END result
        FROM
@@ -84,4 +84,23 @@
            AND inv.id = #{processInv.id}
        </if>
    </select>
    <select id="findById" resultType="org.springblade.modules.processInv.entity.ProcessInv">
        SELECT id,strain_id,product_id,product_inventory_num,create_time,update_user,update_time,status,is_deleted
        FROM sys_process_inv
        WHERE is_deleted = 0 AND id = #{prodId}
    </select>
    <select id="statisticsStock" resultType="java.lang.Double">
        SELECT SUM(inv.product_inventory_num) as sum
        FROM sys_process_inv inv
        LEFT JOIN sys_farm_product_stock sfps ON sfps.id = inv.fps_id
        LEFT JOIN sys_land land ON land.id = sfps.land_id
        WHERE 1=1 AND inv.is_deleted = 0
        <if test="year!=null and year!=''">
            and YEAR ( inv.create_time ) = #{year}
        </if>
        <if test="farmId!=null and farmId!=''">
            and land.farm_id = #{farmId}
        </if>
    </select>
</mapper>