Helius
2021-09-17 1e9b91c0741c9b3005d523ca816d91622bf9759a
src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -2,4 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.mall.mapper.MallGoodsMapper">
    <select id="selectMallGoodsListQueryInPage" resultType="cc.mrbird.febs.mall.vo.MallGoodsListVo">
        select
            a.id,
            a.goods_name,
            a.goods_introdution,
            a.thumb,
            a.original_price,
            a.present_price,
            sum(b.sku_volume) saleVolume
        from mall_goods a
             inner join mall_goods_sku b on a.id=b.goods_id
             inner join mall_goods_category c on a.category_id=c.id
        <where>
            a.is_sale=1
            <if test="record != null">
                <if test="record.isHot != null and record.isHot != ''">
                    and a.is_hot = 1
                </if>
                <if test="record.categoryId != null and record.categoryId != ''">
                    and (c.category_id = #{record.categoryId} or c.parent_id=#{record.categoryId})
                </if>
                <if test="record.query != null and record.query != ''">
                    and a.goods_name like CONCAT('%', CONCAT(#{record.query}, '%'))
                </if>
            </if>
        </where>
        order by a.created_time desc
    </select>
</mapper>