Commit 88a823e4 authored by wlx@33.cn's avatar wlx@33.cn

修正目录搜索商品,修正分页

parent 42c0f42a
......@@ -29,7 +29,6 @@ public interface SpuMapper extends BaseMapper<Spu> {
@Select(" select count(*) from goods_spu a left join goods_count b on a.goods_id = b.goods_id left join merchant c on a.merchant_id = c.merchant_id where a.name like #{searchKey} and a.status = 1 ;")
Integer getSearchCount(@Param("searchKey") String searchKey);
@Select(" select count(*) from goods_spu a left join goods_count b on a.goods_id = b.goods_id left join merchant c on a.merchant_id = c.merchant_id where a.category_id = #{categoryId} and a.status = 1 ")
Integer getByCategoryIdCount(@Param("categoryId") String categoryId);
@Select("select template_id from goods_spu where goods_id = #{goodsId}")
......
......@@ -28,7 +28,7 @@ public class FlashSaleServiceImpl extends ServiceImpl<FlashSaleMapper, FlashSale
@Override
public List<GoodsFlashVo> getlist(String merchantId, PageVo pageVo) {
int start = (pageVo.getPage()-1)*pageVo.getSize();
int end = pageVo.getPage()* pageVo.getSize() -1;
int end = pageVo.getPage()* pageVo.getSize();
List<GoodsFlashVo> goodsFlashVos = flashSaleMapper.getList(merchantId,System.currentTimeMillis(),start,end);
return goodsFlashVos;
}
......
......@@ -35,7 +35,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
@Override
public List<GoodsVo> getByCategoryId(String categoryId, SearchVo searchVo) {
int start = (searchVo.getPage()-1)*searchVo.getSize();
int end = searchVo.getPage()* searchVo.getSize() -1;
int end = searchVo.getPage()* searchVo.getSize();
return spuMapper.getByCategoryId(categoryId,searchVo.getPrice(),searchVo.getSale(),start,end);
}
......
......@@ -16,4 +16,13 @@
select a.*,c.shop_name as merchantName,c.* from goods_spu a left join goods_count b on a.goods_id = b.goods_id left join shop c on a.merchant_id = c.merchant_id
where a.goods_id = #{goodsId} and a.status = 1;
</select>
<select id="getByCategoryIdCount" resultType="integer">
select count(*)
from goods_spu a
left join goods_count b on a.goods_id = b.goods_id
left join merchant c on a.merchant_id = c.merchant_id
left join goods_category_spu d on d.goods_id = a.goods_id
where d.category_id = #{categoryId} and a.status = 1
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment