|
|
|
@ -46,11 +46,6 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
// 节假日mapper
|
|
|
|
@Autowired |
|
|
|
private FestivalsMapper festivalsMapper; |
|
|
|
/** |
|
|
|
* springboot 自带事务 |
|
|
|
*/ |
|
|
|
@Autowired |
|
|
|
private PlatformTransactionManager platformTransactionManager; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Goods> getGoodsList(int page) { |
|
|
|
@ -457,13 +452,15 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
* @param type |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public int ranksort(String goodsIsli, int type) { |
|
|
|
//去除排序列表
|
|
|
|
String where="is_deleted=0 and is_recommend=1"; |
|
|
|
List<Goods> tmpRanklist = goodsMapper.getGoodsByCondition(where, 8, "recommend_sort", "DESC"); |
|
|
|
//String where="is_deleted=0 and is_recommend=1";
|
|
|
|
//List<Goods> tmpRanklist = goodsMapper.getGoodsByCondition(where, 8, "recommend_sort", "DESC");
|
|
|
|
List<Goods> tmpRanklist = queryRankList(); |
|
|
|
int ret = 0; |
|
|
|
for(int i=0;i<tmpRanklist.size()-1;i++){ |
|
|
|
for(int i=0;i<tmpRanklist.size();i++){ |
|
|
|
if(goodsIsli.equals(tmpRanklist.get(i).getGoodsIslicode()) ){ |
|
|
|
// 当前项目sort
|
|
|
|
int curSort = tmpRanklist.get(i).getRecommendSort(); |
|
|
|
@ -475,6 +472,7 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
//前序sort
|
|
|
|
int frontSort = tmpRanklist.get(i-1).getRecommendSort(); |
|
|
|
int afterSort= (frontSort==curSort)?curSort+1:frontSort; |
|
|
|
log.info("更新后的sort:"+afterSort); |
|
|
|
// 前序变更recommend sort
|
|
|
|
goodsMapper.updateRecommend(tmpRanklist.get(i-1).getGoodsIslicode(),curSort); |
|
|
|
ret = goodsMapper.updateRecommend(tmpRanklist.get(i).getGoodsIslicode(),afterSort); |
|
|
|
@ -511,6 +509,16 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
return opGoodsInfo(jsonObject); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* query rank list |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<Goods> queryRankList(){ |
|
|
|
String where="is_deleted=0 and is_recommend=1"; |
|
|
|
List<Goods> tmpRanklist = goodsMapper.getGoodsByCondition(where, 8, "recommend_sort", "DESC"); |
|
|
|
return tmpRanklist; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 操作商品信息 |
|
|
|
* |
|
|
|
|