Commit e0484809 authored by wulixian's avatar wulixian

Merge branch 'dev' into 'test'

修正目录搜索商品,修正分页 See merge request !7
parents 10c443c1 8d609c80
...@@ -29,7 +29,6 @@ public interface SpuMapper extends BaseMapper<Spu> { ...@@ -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 ;") @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); 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); Integer getByCategoryIdCount(@Param("categoryId") String categoryId);
@Select("select template_id from goods_spu where goods_id = #{goodsId}") @Select("select template_id from goods_spu where goods_id = #{goodsId}")
......
...@@ -28,7 +28,7 @@ public class FlashSaleServiceImpl extends ServiceImpl<FlashSaleMapper, FlashSale ...@@ -28,7 +28,7 @@ public class FlashSaleServiceImpl extends ServiceImpl<FlashSaleMapper, FlashSale
@Override @Override
public List<GoodsFlashVo> getlist(String merchantId, PageVo pageVo) { public List<GoodsFlashVo> getlist(String merchantId, PageVo pageVo) {
int start = (pageVo.getPage()-1)*pageVo.getSize(); 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); List<GoodsFlashVo> goodsFlashVos = flashSaleMapper.getList(merchantId,System.currentTimeMillis(),start,end);
return goodsFlashVos; return goodsFlashVos;
} }
......
...@@ -35,7 +35,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS ...@@ -35,7 +35,7 @@ public class SpuServiceImpl extends ServiceImpl<SpuMapper, Spu> implements ISpuS
@Override @Override
public List<GoodsVo> getByCategoryId(String categoryId, SearchVo searchVo) { public List<GoodsVo> getByCategoryId(String categoryId, SearchVo searchVo) {
int start = (searchVo.getPage()-1)*searchVo.getSize(); 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); return spuMapper.getByCategoryId(categoryId,searchVo.getPrice(),searchVo.getSale(),start,end);
} }
......
...@@ -16,4 +16,13 @@ ...@@ -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 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; where a.goods_id = #{goodsId} and a.status = 1;
</select> </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> </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