-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
110 changed files
with
4,565 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...oduct/ShoppingmallProductApplication.java → ...oduct/ShoppingmallProductApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
shoppingmall_product/src/main/java/com/bill/shoppingmall/product/config/MyBatisConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.bill.shoppingmall.product.config; | ||
|
||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; | ||
import org.mybatis.spring.annotation.MapperScan; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
@Configuration | ||
@EnableTransactionManagement | ||
@MapperScan("com.bill.shoppingmall.product.dao") | ||
public class MyBatisConfig { | ||
|
||
//引入分页插件 | ||
@Bean | ||
public PaginationInterceptor paginationInterceptor() { | ||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); | ||
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false | ||
paginationInterceptor.setOverflow(true); | ||
// 设置最大单页限制数量,默认 500 条,-1 不受限制 | ||
paginationInterceptor.setLimit(1000); | ||
return paginationInterceptor; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...c/main/java/com/bill/shoppingmall/product/controller/AttrAttrgroupRelationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.bill.shoppingmall.product.controller; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.bill.shoppingmall.product.entity.AttrAttrgroupRelationEntity; | ||
import com.bill.shoppingmall.product.service.AttrAttrgroupRelationService; | ||
import com.bill.common.utils.PageUtils; | ||
import com.bill.common.utils.R; | ||
|
||
|
||
|
||
@RestController | ||
@RequestMapping("product/attrattrgrouprelation") | ||
public class AttrAttrgroupRelationController { | ||
@Autowired | ||
private AttrAttrgroupRelationService attrAttrgroupRelationService; | ||
|
||
/** | ||
* 列表 | ||
*/ | ||
@RequestMapping("/list") | ||
//@RequiresPermissions("product:attrattrgrouprelation:list") | ||
public R list(@RequestParam Map<String, Object> params){ | ||
PageUtils page = attrAttrgroupRelationService.queryPage(params); | ||
|
||
return R.ok().put("page", page); | ||
} | ||
|
||
|
||
/** | ||
* 信息 | ||
*/ | ||
@RequestMapping("/info/{id}") | ||
//@RequiresPermissions("product:attrattrgrouprelation:info") | ||
public R info(@PathVariable("id") Long id){ | ||
AttrAttrgroupRelationEntity attrAttrgroupRelation = attrAttrgroupRelationService.getById(id); | ||
|
||
return R.ok().put("attrAttrgroupRelation", attrAttrgroupRelation); | ||
} | ||
|
||
/** | ||
* 保存 | ||
*/ | ||
@RequestMapping("/save") | ||
//@RequiresPermissions("product:attrattrgrouprelation:save") | ||
public R save(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){ | ||
attrAttrgroupRelationService.save(attrAttrgroupRelation); | ||
|
||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 修改 | ||
*/ | ||
@RequestMapping("/update") | ||
//@RequiresPermissions("product:attrattrgrouprelation:update") | ||
public R update(@RequestBody AttrAttrgroupRelationEntity attrAttrgroupRelation){ | ||
attrAttrgroupRelationService.updateById(attrAttrgroupRelation); | ||
|
||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 删除 | ||
*/ | ||
@RequestMapping("/delete") | ||
//@RequiresPermissions("product:attrattrgrouprelation:delete") | ||
public R delete(@RequestBody Long[] ids){ | ||
attrAttrgroupRelationService.removeByIds(Arrays.asList(ids)); | ||
|
||
return R.ok(); | ||
} | ||
|
||
} |
120 changes: 120 additions & 0 deletions
120
...ngmall_product/src/main/java/com/bill/shoppingmall/product/controller/AttrController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package com.bill.shoppingmall.product.controller; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.bill.shoppingmall.product.entity.ProductAttrValueEntity; | ||
import com.bill.shoppingmall.product.service.ProductAttrValueService; | ||
import com.bill.shoppingmall.product.vo.AttrRespVo; | ||
import com.bill.shoppingmall.product.vo.AttrVo; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import com.bill.shoppingmall.product.service.AttrService; | ||
import com.bill.common.utils.PageUtils; | ||
import com.bill.common.utils.R; | ||
|
||
|
||
@RestController | ||
@RequestMapping("product/attr") | ||
public class AttrController { | ||
@Autowired | ||
private AttrService attrService; | ||
|
||
@Autowired | ||
ProductAttrValueService productAttrValueService; | ||
|
||
///product/attr/info/{attrId} | ||
|
||
// /product/attr/base/listforspu/{spuId} | ||
@GetMapping("/base/listforspu/{spuId}") | ||
public R baseAttrlistforspu(@PathVariable("spuId") Long spuId){ | ||
|
||
List<ProductAttrValueEntity> entities = productAttrValueService.baseAttrlistforspu(spuId); | ||
|
||
return R.ok().put("data",entities); | ||
} | ||
|
||
//product/attr/sale/list/0? | ||
///product/attr/base/list/{catelogId} | ||
@GetMapping("/{attrType}/list/{catelogId}") | ||
public R baseAttrList(@RequestParam Map<String, Object> params, | ||
@PathVariable("catelogId") Long catelogId, | ||
@PathVariable("attrType")String type){ | ||
|
||
PageUtils page = attrService.queryBaseAttrPage(params,catelogId,type); | ||
return R.ok().put("page", page); | ||
} | ||
|
||
/** | ||
* 列表 | ||
*/ | ||
@RequestMapping("/list") | ||
//@RequiresPermissions("product:attr:list") | ||
public R list(@RequestParam Map<String, Object> params){ | ||
PageUtils page = attrService.queryPage(params); | ||
|
||
return R.ok().put("page", page); | ||
} | ||
|
||
|
||
/** | ||
* 信息 | ||
*/ | ||
@RequestMapping("/info/{attrId}") | ||
//@RequiresPermissions("product:attr:info") | ||
public R info(@PathVariable("attrId") Long attrId){ | ||
//AttrEntity attr = attrService.getById(attrId); | ||
AttrRespVo respVo = attrService.getAttrInfo(attrId); | ||
|
||
return R.ok().put("attr", respVo); | ||
} | ||
|
||
/** | ||
* 保存 | ||
*/ | ||
@RequestMapping("/save") | ||
//@RequiresPermissions("product:attr:save") | ||
public R save(@RequestBody AttrVo attr){ | ||
attrService.saveAttr(attr); | ||
|
||
return R.ok(); | ||
} | ||
|
||
///product/attrgroup/attr/relation/delete | ||
|
||
|
||
/** | ||
* 修改 | ||
*/ | ||
@RequestMapping("/update") | ||
//@RequiresPermissions("product:attr:update") | ||
public R update(@RequestBody AttrVo attr){ | ||
attrService.updateAttr(attr); | ||
|
||
return R.ok(); | ||
} | ||
|
||
///product/attr/update/{spuId} | ||
@PostMapping("/update/{spuId}") | ||
public R updateSpuAttr(@PathVariable("spuId") Long spuId, | ||
@RequestBody List<ProductAttrValueEntity> entities){ | ||
|
||
productAttrValueService.updateSpuAttr(spuId,entities); | ||
|
||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 删除 | ||
*/ | ||
@RequestMapping("/delete") | ||
//@RequiresPermissions("product:attr:delete") | ||
public R delete(@RequestBody Long[] attrIds){ | ||
attrService.removeByIds(Arrays.asList(attrIds)); | ||
|
||
return R.ok(); | ||
} | ||
|
||
} |
145 changes: 145 additions & 0 deletions
145
...l_product/src/main/java/com/bill/shoppingmall/product/controller/AttrGroupController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
package com.bill.shoppingmall.product.controller; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.bill.shoppingmall.product.entity.AttrEntity; | ||
import com.bill.shoppingmall.product.service.AttrAttrgroupRelationService; | ||
import com.bill.shoppingmall.product.service.AttrService; | ||
import com.bill.shoppingmall.product.service.CategoryService; | ||
import com.bill.shoppingmall.product.vo.AttrGroupRelationVo; | ||
import com.bill.shoppingmall.product.vo.AttrGroupWithAttrsVo; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import com.bill.shoppingmall.product.entity.AttrGroupEntity; | ||
import com.bill.shoppingmall.product.service.AttrGroupService; | ||
import com.bill.common.utils.PageUtils; | ||
import com.bill.common.utils.R; | ||
|
||
|
||
|
||
|
||
@RestController | ||
@RequestMapping("product/attrgroup") | ||
public class AttrGroupController { | ||
@Autowired | ||
private AttrGroupService attrGroupService; | ||
|
||
@Autowired | ||
private CategoryService categoryService; | ||
|
||
@Autowired | ||
AttrService attrService; | ||
|
||
@Autowired | ||
AttrAttrgroupRelationService relationService; | ||
|
||
///product/attrgroup/attr/relation | ||
@PostMapping("/attr/relation") | ||
public R addRelation(@RequestBody List<AttrGroupRelationVo> vos){ | ||
|
||
relationService.saveBatch(vos); | ||
return R.ok(); | ||
} | ||
|
||
///product/attrgroup/{catelogId}/withattr | ||
@GetMapping("/{catelogId}/withattr") | ||
public R getAttrGroupWithAttrs(@PathVariable("catelogId")Long catelogId){ | ||
|
||
//1、查出当前分类下的所有属性分组, | ||
//2、查出每个属性分组的所有属性 | ||
List<AttrGroupWithAttrsVo> vos = attrGroupService.getAttrGroupWithAttrsByCatelogId(catelogId); | ||
return R.ok().put("data",vos); | ||
} | ||
|
||
|
||
///product/attrgroup/{attrgroupId}/attr/relation | ||
@GetMapping("/{attrgroupId}/attr/relation") | ||
public R attrRelation(@PathVariable("attrgroupId") Long attrgroupId){ | ||
List<AttrEntity> entities = attrService.getRelationAttr(attrgroupId); | ||
return R.ok().put("data",entities); | ||
} | ||
|
||
///product/attrgroup/{attrgroupId}/noattr/relation | ||
@GetMapping("/{attrgroupId}/noattr/relation") | ||
public R attrNoRelation(@PathVariable("attrgroupId") Long attrgroupId, | ||
@RequestParam Map<String, Object> params){ | ||
PageUtils page = attrService.getNoRelationAttr(params,attrgroupId); | ||
return R.ok().put("page",page); | ||
} | ||
|
||
@PostMapping("/attr/relation/delete") | ||
public R deleteRelation(@RequestBody AttrGroupRelationVo[] vos){ | ||
attrService.deleteRelation(vos); | ||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 列表 | ||
*/ | ||
@RequestMapping("/list/{catelogId}") | ||
//@RequiresPermissions("product:attrgroup:list") | ||
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}") | ||
//@RequiresPermissions("product:attrgroup:info") | ||
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") | ||
//@RequiresPermissions("product:attrgroup:save") | ||
public R save(@RequestBody AttrGroupEntity attrGroup){ | ||
attrGroupService.save(attrGroup); | ||
|
||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 修改 | ||
*/ | ||
@RequestMapping("/update") | ||
//@RequiresPermissions("product:attrgroup:update") | ||
public R update(@RequestBody AttrGroupEntity attrGroup){ | ||
attrGroupService.updateById(attrGroup); | ||
|
||
return R.ok(); | ||
} | ||
|
||
/** | ||
* 删除 | ||
*/ | ||
@RequestMapping("/delete") | ||
//@RequiresPermissions("product:attrgroup:delete") | ||
public R delete(@RequestBody Long[] attrGroupIds){ | ||
attrGroupService.removeByIds(Arrays.asList(attrGroupIds)); | ||
|
||
return R.ok(); | ||
} | ||
|
||
} |
Oops, something went wrong.