cloudroam
2024-09-09 08df1a408d57de206c8dfda3182d24f8e735c579
src/main/resources/mapper/flower/FlowerMapper.xml
@@ -234,6 +234,10 @@
    <select id="myCollect" resultType="com.mzl.flower.dto.response.flower.FlowerShowListDTO">
        SELECT f.*, s.name supplierName, st.name supplierType, fc.name categoryStr
        , (select sum(num) from t_cart ccc
        where ccc.flower_id = f.id
        and ccc.create_by = #{condition.userId}
        ) shopnum
        FROM t_collect_flower c
        left join t_flower f on c.flower_id = f.id
        left join t_supplier_info s on s.id = f.supplier_id
@@ -275,6 +279,10 @@
    <select id="myBrowseHistory" resultType="com.mzl.flower.dto.response.flower.FlowerShowListDTO">
        SELECT f.*, s.name supplierName, st.name supplierType, fc.name categoryStr
        , (select sum(num) from t_cart ccc
        where ccc.flower_id = f.id
        and ccc.create_by = #{condition.userId}
        ) shopnum
        FROM t_browse_his c
        left join t_flower f on c.flower_id = f.id
        left join t_supplier_info s on s.id = f.supplier_id
@@ -320,7 +328,7 @@
                </choose>
            </when>
            <otherwise>
                order by c.create_time desc
                order by c.update_time desc
            </otherwise>
        </choose>
    </select>
@@ -373,4 +381,15 @@
        </if>
        ORDER BY fzp.rank asc
    </select>
    <select id="searchInvalidHistory" resultType="java.lang.Long">
        SELECT c.id
        FROM t_browse_his c left join t_flower f on c.flower_id = f.id
        WHERE f.deleted = 0 and c.deleted = 0 and f.status != 'UP' and c.user_id = #{userId}
    </select>
    <update id="updateFlowerCategoryInfo">
        update t_flower f, t_flower_category fc
        set f.unit = fc.unit, f.color = fc.color
        where f.category = fc.id and fc.id = #{category}
    </update>
</mapper>