记得上下班打卡 | git大法好,push需谨慎

Commit 01ee0a7e authored by zhengfuxin's avatar zhengfuxin

修改分类的东西

parent 814c120a
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "GoblinSelfGoodsCategoryVo", description = "平台分类信息")
@Data
public class GoblinCategoryzfVo implements Serializable, Cloneable {
private static final long serialVersionUID = -2342407105969740471L;
@ApiModelProperty(value = "传入的当前分类信息")
GoblinSelfGoodsCategoryVo goblinSelfGoodsCategoryVo;
@ApiModelProperty(value = "当前分类子信息")
List<GoblinSelfGoodsCategoryVo> list;
private static final GoblinCategoryzfVo obj = new GoblinCategoryzfVo();
public static GoblinCategoryzfVo getNew() {
try {
return (GoblinCategoryzfVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinCategoryzfVo();
}
}
}
......@@ -84,11 +84,18 @@ public class GoblinFrontController {
return ResponseDto.success( goblinFrontService.getCube());
}
@GetMapping("getCategoryList")
@ApiOperation("获取分类列表商品")
@ApiOperation("获取分类列表商品( 1、销量优先、2、新品优先、3、价格降序、4、价格升序)")
public ResponseDto<GoblinFrontCategoryListVo> getCategoryList(@RequestParam(name = "type", required = true) String type,@RequestParam(name = "categoryId", required = true)String categoryId,@RequestParam(name = "page", required = true)int page,@RequestParam(name = "pageSize", required = true)int pageSize) throws ParseException {
return ResponseDto.success( goblinFrontService.getCategoryList(type,categoryId,page,pageSize));
}
@GetMapping("getCategory")
@ApiOperation("获取分类子集")
public ResponseDto getCategory(@RequestParam(name = "categoryId", required = true)String categoryId) throws ParseException {
return ResponseDto.success( goblinFrontService.getCategory(categoryId));
}
......
......@@ -273,6 +273,36 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return goblinFrontCubeVo;
}
/**
* 找到分类
*/
public GoblinCategoryzfVo getCategory(String categoryId){
GoblinCategoryzfVo goblinCategoryzfVo=GoblinCategoryzfVo.getNew();
ArrayList<GoblinSelfGoodsCategoryVo> list1=ObjectUtil.getGoblinSelfGoodsCategoryVoArrayList();
//先找到 当前的分类id
GoblinSelfGoodsCategoryVo pa=null;
//获取到分类
List<GoblinSelfGoodsCategoryVo> list=goblinRedisUtils.getSelfGoodsCategoryVos();
for(GoblinSelfGoodsCategoryVo goblinSelfGoodsCategoryVo:list){
if (categoryId.equals(goblinSelfGoodsCategoryVo.getCateId())) {
goblinCategoryzfVo.setGoblinSelfGoodsCategoryVo(goblinSelfGoodsCategoryVo);
pa=goblinSelfGoodsCategoryVo;
}
}
//找到 该分类的子集
if(null!=pa){
for(GoblinSelfGoodsCategoryVo goblinSelfGoodsCategoryVo:list){
if(pa.getCateId().equals(goblinSelfGoodsCategoryVo.getCatePid())){
list1.add(goblinSelfGoodsCategoryVo);
}
}
}
goblinCategoryzfVo.setList(list1);
return goblinCategoryzfVo;
}
/**
* 获取分类列表
* 1、销量优先、2、新品优先、3、价格降序、4、价格升序
......
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