智慧农业后台管理
tangzy
2022-07-16 b3e4a07414be178705937f78e3deafd3536012bf
src/main/java/org/springblade/modules/farmplant/mapper/FarmProductStockMapper.xml
@@ -4,7 +4,7 @@
    <!--自定义查询农产品库存分页数据-->
    <select id="selectFarmProductStockPage" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO">
        select sfps.strain_id strainId,sfps.land_id,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        select sfps.id,sfps.strain_id strainId,sfps.land_id,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        sys_farm_product_stock sfps
        left join sys_strain ss on ss.id = sfps.strain_id
        where 1=1
@@ -26,7 +26,7 @@
        <if test="farmProductStock.tenantId!=null and farmProductStock.tenantId!=''">
            and sfps.tenant_id = #{farmProductStock.tenantId}
        </if>
        group by sfps.strain_id,ss.url,ss.strain_name,sfps.land_id
        group by sfps.id,sfps.strain_id,ss.url,ss.strain_name,sfps.land_id
    </select>
    <select id="selectFarmProductStockPages" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO">
@@ -58,7 +58,7 @@
    <!--查询农产品库存数据-->
    <select id="statisticsProduct" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO">
        select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        select sfps.id,sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        sys_farm_product_stock sfps
        left join sys_strain ss on ss.id = sfps.strain_id
        where 1=1
@@ -357,12 +357,12 @@
        FROM
            sys_farm_product_stock
        WHERE
            strain_id = #{id}
            id = #{id}
    </select>
    <!--减去对应库存-->
    <update id="stockReduce">
        UPDATE sys_farm_product_stock SET weight = weight - #{sale}
        WHERE
            strain_id = #{id}
            id = #{id}
    </update>
</mapper>