gongzuming
2024-09-20 35309b932b738d5a8537e53207d28004a8da0f89
src/main/resources/mapper/flower/FlowerMapper.xml
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.mzl.flower.mapper.flower.FlowerMapper">
    <delete id="deleteBatchPhysics">
        DELETE FROM t_flower
        WHERE id IN
        <foreach collection="list" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <select id="selectFlowerList" resultType="com.mzl.flower.dto.response.flower.FlowerListDTO">
        SELECT f.*, s.name supplierName, st.name supplierType, fc.name categoryStr
@@ -37,6 +44,12 @@
        </if>
        <if test="condition.recommend != null and !condition.recommend">
            AND (f.recommend = 0 or f.recommend is null)
        </if>
        <if test="condition.isLimited != null and condition.isLimited">
            AND f.limited > 0
        </if>
        <if test="condition.isLimited != null and !condition.isLimited">
            AND (f.limited = 0 or f.limited is null)
        </if>
        <if test="condition.statusList != null and condition.statusList.size > 0">
            and f.status in
@@ -328,7 +341,7 @@
                </choose>
            </when>
            <otherwise>
                order by c.create_time desc
                order by c.update_time desc
            </otherwise>
        </choose>
    </select>
@@ -386,10 +399,35 @@
        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>
    <select id="getDeletdFlowByIds" resultType="com.mzl.flower.entity.flower.Flower">
        select * from t_flower
        WHERE id IN
        <foreach collection="list" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </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>
    <update id="updateBatchTypeRank">
        <foreach collection="list" item="item" separator=";">
            UPDATE t_flower
            SET type_rank = #{item.typeRank}
            WHERE id = #{item.id}
        </foreach>
    </update>
    <update id="restoreFlowerBatch">
        update t_flower set deleted = 0
        WHERE id IN
        <foreach collection="list" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
    <update id="updateTypeRankNull">
        update t_flower set type_rank=null where category=#{category} and level=#{level}
    </update>
</mapper>