Skip to content

Commit

Permalink
商城首页:渲染一级、二级和三级分类数据
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmoswong committed May 13, 2020
1 parent 741d493 commit 9808533
Show file tree
Hide file tree
Showing 672 changed files with 11,214 additions and 299 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@

![谷粒商城-微服务架构图.jpg](doc/images/谷粒商城-微服务架构图.jpg)

项目微服务:

![image-20200512182015906](doc/images/image-20200512182015906.png)



项目的前端页面:

![image-20200511010829465](doc/images/image-20200511010829465.png)

后台管理
后台管理页面

![image-20200511010920710](doc/images/image-20200511010920710.png)

Expand Down Expand Up @@ -48,3 +52,13 @@

### 2、[SPU管理中,修改商品规格,显示400错误状态码](https://shimo.im/docs/wpTxdcHpYRRV3dc6/)



### 笔记

#### 1)分布式基础

#### 2)[分布式高级](https://shimo.im/docs/WWhRX8trqVtRckGj/ )

#### 3)集群

Binary file added doc/images/image-20200512182015906.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions gulimall-product/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@

<dependencies>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<groupId>com.bigdata.gulimall</groupId>
<artifactId>gulimall-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bigdata.gulimall.product.controller;
package com.bigdata.gulimall.product.app;

import com.bigdata.common.utils.PageUtils;
import com.bigdata.common.utils.R;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.bigdata.gulimall.product.controller;
package com.bigdata.gulimall.product.app;

import com.bigdata.common.utils.PageUtils;
import com.bigdata.common.utils.R;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,166 +1,166 @@
package com.bigdata.gulimall.product.controller;

import com.bigdata.common.utils.PageUtils;
import com.bigdata.common.utils.R;
import com.bigdata.gulimall.product.entity.AttrEntity;
import com.bigdata.gulimall.product.entity.AttrGroupEntity;
import com.bigdata.gulimall.product.service.AttrAttrgroupRelationService;
import com.bigdata.gulimall.product.service.AttrGroupService;
import com.bigdata.gulimall.product.service.AttrService;
import com.bigdata.gulimall.product.service.CategoryService;
import com.bigdata.gulimall.product.vo.AttrGroupRelationVo;
import com.bigdata.gulimall.product.vo.AttrGroupWithAttrVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;



/**
* 属性分组
*
* @author cosmoswong
* @email [email protected]
* @date 2020-04-23 21:08:55
*/
@RestController
@RequestMapping("product/attrgroup")
public class AttrGroupController {
@Autowired
private AttrGroupService attrGroupService;

@Autowired
CategoryService categoryService;

@Autowired
AttrService attrService;

@Autowired
AttrAttrgroupRelationService relationService;

/**
* 功能描述:获取分类下所有分组&关联属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/6JM6txHf
*/
@GetMapping("{catelogId}/withattr")
public R getAttrGroupWithAttr(@PathVariable("catelogId") Long catelogId){
List<AttrGroupWithAttrVo> vos=attrGroupService.getAttrGroupWithAttrsByCatelogId(catelogId);
return R.ok().put("data",vos);
}

/**功能:添加属性和属性分组的关联关系
* API:<https://easydoc.xyz/doc/75716633/ZUqEdvA4/VhgnaedC
* @param relationVo
* @return
*/
@PostMapping("/attr/relation")
public R saveAttrRelation(@RequestBody List<AttrGroupRelationVo> relationVo){

relationService.saveAttrRelations(relationVo);


return R.ok();
}

/**
* 获取属性分组中,没有关联被其他属性分组和自身所关联的其他属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/d3EezLdO
* /product/attrgroup/{attrgroupId}/noattr/relation
* @param attrgroupId
* @param params
* @return
*/
@GetMapping("/{attrgroupId}/noattr/relation")
public R attrNoRelation(@PathVariable("attrgroupId") Long attrgroupId,@RequestParam Map<String, Object> params){
PageUtils page = attrService.getNoRelationAttr(attrgroupId,params);

return R.ok().put("page",page);
}



/**
* 删除属性与分组的关联关系
* API: https://easydoc.xyz/doc/75716633/ZUqEdvA4/qn7A2Fht
* @param attrGroupRelationVos
* @return
*/
///product/attrgroup/attr/relation/delete
@PostMapping("/attr/relation/delete")
public R delAttrRelation(@RequestBody AttrGroupRelationVo[] attrGroupRelationVos){
attrService.deleteRelation(attrGroupRelationVos);

return R.ok();
}

/**
* 获取属性分组的关联的所有属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/LnjzZHPj
* //product/attrgroup/{attrgroupId}/attr/relation
* @param attrgroupId 分组ID
* @return
*/
@GetMapping("{attrgroupId}/attr/relation")
public R attrRelation(@PathVariable("attrgroupId") Long attrgroupId){
List<AttrEntity> entityList = attrService.getRelationAtr(attrgroupId);
return R.ok().put("data",entityList);
}

/**
* 列表
*/
@RequestMapping("/list/{cateLogId}")
public R list(@RequestParam Map<String, Object> params,@PathVariable("cateLogId") Long cateLogId){
// PageUtils page = attrGroupService.queryPage(params);
PageUtils page =attrGroupService.queryPage(params,cateLogId);
return R.ok().put("page", page);
}


/**
* 信息
*/
@RequestMapping("/info/{attrGroupId}")
public R info(@PathVariable("attrGroupId") Long attrGroupId){
AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId);
Long catelogId = attrGroup.getCatelogId();
Long[] path=categoryService.findCatelogPath(catelogId);

attrGroup.setCatelogPath(path);
return R.ok().put("attrGroup", attrGroup);
}

/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.save(attrGroup);

return R.ok();
}

/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.updateById(attrGroup);

return R.ok();
}

/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] attrGroupIds){
attrGroupService.removeByIds(Arrays.asList(attrGroupIds));

return R.ok();
}

}
package com.bigdata.gulimall.product.app;

import com.bigdata.common.utils.PageUtils;
import com.bigdata.common.utils.R;
import com.bigdata.gulimall.product.entity.AttrEntity;
import com.bigdata.gulimall.product.entity.AttrGroupEntity;
import com.bigdata.gulimall.product.service.AttrAttrgroupRelationService;
import com.bigdata.gulimall.product.service.AttrGroupService;
import com.bigdata.gulimall.product.service.AttrService;
import com.bigdata.gulimall.product.service.CategoryService;
import com.bigdata.gulimall.product.vo.AttrGroupRelationVo;
import com.bigdata.gulimall.product.vo.AttrGroupWithAttrVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;



/**
* 属性分组
*
* @author cosmoswong
* @email [email protected]
* @date 2020-04-23 21:08:55
*/
@RestController
@RequestMapping("product/attrgroup")
public class AttrGroupController {
@Autowired
private AttrGroupService attrGroupService;

@Autowired
CategoryService categoryService;

@Autowired
AttrService attrService;

@Autowired
AttrAttrgroupRelationService relationService;

/**
* 功能描述:获取分类下所有分组&关联属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/6JM6txHf
*/
@GetMapping("{catelogId}/withattr")
public R getAttrGroupWithAttr(@PathVariable("catelogId") Long catelogId){
List<AttrGroupWithAttrVo> vos=attrGroupService.getAttrGroupWithAttrsByCatelogId(catelogId);
return R.ok().put("data",vos);
}

/**功能:添加属性和属性分组的关联关系
* API:<https://easydoc.xyz/doc/75716633/ZUqEdvA4/VhgnaedC
* @param relationVo
* @return
*/
@PostMapping("/attr/relation")
public R saveAttrRelation(@RequestBody List<AttrGroupRelationVo> relationVo){

relationService.saveAttrRelations(relationVo);


return R.ok();
}

/**
* 获取属性分组中,没有关联被其他属性分组和自身所关联的其他属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/d3EezLdO
* /product/attrgroup/{attrgroupId}/noattr/relation
* @param attrgroupId
* @param params
* @return
*/
@GetMapping("/{attrgroupId}/noattr/relation")
public R attrNoRelation(@PathVariable("attrgroupId") Long attrgroupId,@RequestParam Map<String, Object> params){
PageUtils page = attrService.getNoRelationAttr(attrgroupId,params);

return R.ok().put("page",page);
}



/**
* 删除属性与分组的关联关系
* API: https://easydoc.xyz/doc/75716633/ZUqEdvA4/qn7A2Fht
* @param attrGroupRelationVos
* @return
*/
///product/attrgroup/attr/relation/delete
@PostMapping("/attr/relation/delete")
public R delAttrRelation(@RequestBody AttrGroupRelationVo[] attrGroupRelationVos){
attrService.deleteRelation(attrGroupRelationVos);

return R.ok();
}

/**
* 获取属性分组的关联的所有属性
* API:https://easydoc.xyz/doc/75716633/ZUqEdvA4/LnjzZHPj
* //product/attrgroup/{attrgroupId}/attr/relation
* @param attrgroupId 分组ID
* @return
*/
@GetMapping("{attrgroupId}/attr/relation")
public R attrRelation(@PathVariable("attrgroupId") Long attrgroupId){
List<AttrEntity> entityList = attrService.getRelationAtr(attrgroupId);
return R.ok().put("data",entityList);
}

/**
* 列表
*/
@RequestMapping("/list/{cateLogId}")
public R list(@RequestParam Map<String, Object> params,@PathVariable("cateLogId") Long cateLogId){
// PageUtils page = attrGroupService.queryPage(params);
PageUtils page =attrGroupService.queryPage(params,cateLogId);
return R.ok().put("page", page);
}


/**
* 信息
*/
@RequestMapping("/info/{attrGroupId}")
public R info(@PathVariable("attrGroupId") Long attrGroupId){
AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId);
Long catelogId = attrGroup.getCatelogId();
Long[] path=categoryService.findCatelogPath(catelogId);

attrGroup.setCatelogPath(path);
return R.ok().put("attrGroup", attrGroup);
}

/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.save(attrGroup);

return R.ok();
}

/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.updateById(attrGroup);

return R.ok();
}

/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] attrGroupIds){
attrGroupService.removeByIds(Arrays.asList(attrGroupIds));

return R.ok();
}

}
Loading

0 comments on commit 9808533

Please sign in to comment.