huanghongfa
2021-04-17 eb261d529b71f922cb78971ab0b329f6c323a9bf
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopGoodsDAO.java
@@ -3,10 +3,17 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO;
import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO;
import com.panzhihua.common.model.vos.shop.ComShopGoodsVO;
import com.panzhihua.common.model.vos.shop.ComShopStoreVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO;
import com.panzhihua.common.model.vos.shop.ComShopStoreVO;
import com.panzhihua.service_community.model.dos.ComShopGoodsDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
@@ -20,4 +27,44 @@
    @Select("select id,type_id,name,store_id,goods_pic,images,status,sale,original_price,price,unit,order,stock,details,remark,goods_describe,delivery_type,delete_status,create_at,update_at from com_shop_store")
    IPage<ComShopStoreVO> pageShopGoods(Page page, PageComShopGoodsDTO pageComShopGoodsDTO);
    /**
     * 根据店铺id查询商品列表
     * @param page  分页参数
     * @param pageComShopStoreDTO   请求参数
     * @return  分页商品列表
     */
    @Select("<script> " +
            "select id,`name`,store_id,goods_pic,images,`status`,sale,original_price,price" +
            ",unit,`order`,stock,details,delivery_type from com_shop_goods" +
            " where store_id = #{pageComShopStoreDTO.storeId} and delete_status = 1 and status = 1" +
            " order by sale desc,create_at desc "+
            "</script> ")
    IPage<ComShopGoodsVO> pageShopGoodsByStoreId(Page page, @Param("pageComShopStoreDTO") PageComShopStoreDTO pageComShopStoreDTO);
    /**
     * 分页查询商品列表
     * @param page  分页参数
     * @param comShopGoodsDTO   请求参数
     * @return  商品列表
     */
    @Select("<script> " +
            "select id,`name`,store_id,goods_pic,images,`status`,sale,original_price,price,unit" +
            ",`order`,stock,details,delivery_type from com_shop_goods as csg " +
            " where 1=1  and csg.delete_status = 1 and csg.status = 1" +
            "<if test='comShopGoodsDTO.name != null and comShopGoodsDTO.name !=&quot;&quot;'>" +
            " AND csg.`name` like concat('%',#{comShopGoodsDTO.name},'%') " +
            " </if> " +
            "<if test='comShopGoodsDTO.storeId != null '>" +
            " AND csg.store_id = #{comShopGoodsDTO.storeId} " +
            " </if> " +
            "<if test='comShopGoodsDTO.status != null '>" +
            " AND csg.status = #{comShopGoodsDTO.status} " +
            " </if> " +
            "<if test='comShopGoodsDTO.deliveryType != null '>" +
            " AND csg.delivery_type = #{comShopGoodsDTO.deliveryType} " +
            " </if> " +
            " order by sale desc,create_at desc " +
            " </script>")
    IPage<ComShopGoodsVO> pageShopGoods(Page page, @Param("comShopGoodsDTO") ComShopGoodsDTO comShopGoodsDTO);
}