智慧农业后台管理
tangzy
2022-05-13 bb365068dd8ea2586106c4152e8e5f773ddd7f87
src/main/java/org/springblade/modules/stock/mapper/StrainService.xml
@@ -26,7 +26,41 @@
    <select id="selectStockPage" resultMap="stockResultMap">
        select * from sys_stock where is_deleted = 0
        select *
        from sys_stock
        where is_deleted = 0
    </select>
    <select id="selectLists" resultType="org.springblade.modules.stock.vo.StockVO">
        SELECT st.*,
        stf.agricultural_name AS factoryName,
        stf.type AS stype,
        d.dict_value AS dic1,
        c.dict_value AS dic2
        FROM sys_stock st
        LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id
        LEFT JOIN (SELECT dict_key, dict_value
        FROM blade_dict_biz
        WHERE CODE = 'stockSpecs1' AND is_deleted = 0) d ON d.dict_key = st.specs_value1
        LEFT JOIN (SELECT dict_key, dict_value
        FROM blade_dict_biz
        WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_value1
        WHERE st.is_deleted = 0
        <if test="stock.stype!=null and stock.stype != ''">
            and stf.type = #{stock.stype}
        </if>
        <if test="stock.specsValue1!=null and stock.specsValue1 != ''">
            and st.specs_value1 = #{stock.specsValue1}
        </if>
        <if test="stock.specsValue2!=null and stock.specsValue2 != ''">
            and st.specs_value2 = #{stock.specsValue2}
        </if>
        <if test="stock.state!=null and stock.state != ''">
            and st.state = #{stock.state}
        </if>
        <if test="stock.type!=null and stock.type != ''">
            and st.type = #{stock.type}
        </if>
    </select>
</mapper>