forked from Q-1515/reggie_parent
-
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
17 changed files
with
343 additions
and
18 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
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
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
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
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
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
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
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
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
53 changes: 53 additions & 0 deletions
53
reggie_server/src/main/java/com/reggie/controller/user/ShoppingCartController.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,53 @@ | ||
package com.reggie.controller.user; | ||
|
||
import com.reggie.dto.ShoppingCartDTO; | ||
import com.reggie.entity.ShoppingCart; | ||
import com.reggie.result.R; | ||
import com.reggie.service.ShoppingCartService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 购物车 | ||
*/ | ||
@RestController | ||
@RequestMapping("/user/shoppingCart") | ||
@Slf4j | ||
@Api(tags = "C端-购物车接口") | ||
public class ShoppingCartController { | ||
|
||
@Autowired | ||
private ShoppingCartService shoppingCartService; | ||
|
||
/** | ||
* 添加购物车 | ||
* | ||
* @param shoppingCartDTO 购物车(口味,菜品id,套餐id) | ||
* @return success | ||
*/ | ||
@PostMapping("/add") | ||
@ApiOperation("添加购物车接口") | ||
public R<String> add(@RequestBody ShoppingCartDTO shoppingCartDTO) { | ||
log.info("添加购物车,商品:{}", shoppingCartDTO); | ||
shoppingCartService.add(shoppingCartDTO); | ||
return R.success("购物车添加成功"); | ||
} | ||
|
||
|
||
/** | ||
* 查询购物车 | ||
* | ||
* @return 购物车信息 | ||
*/ | ||
@GetMapping("/list") | ||
public R<List<ShoppingCart>> list() { | ||
log.info("查询购物车"); | ||
List<ShoppingCart> shoppingCarts = shoppingCartService.list(); | ||
return R.success(shoppingCarts); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
reggie_server/src/main/java/com/reggie/mapper/ShoppingCartMapper.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,51 @@ | ||
package com.reggie.mapper; | ||
|
||
import com.reggie.entity.ShoppingCart; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import java.util.List; | ||
|
||
@Mapper | ||
public interface ShoppingCartMapper { | ||
/** | ||
* 条件查询 | ||
* | ||
* @param shoppingCart | ||
* @return | ||
*/ | ||
public List<ShoppingCart> list(ShoppingCart shoppingCart); | ||
|
||
/** | ||
* 更新商品数量 | ||
* | ||
* @param shoppingCart | ||
*/ | ||
public void updateNumberById(ShoppingCart shoppingCart); | ||
|
||
/** | ||
* 插入购物车数据 | ||
* | ||
* @param shoppingCart | ||
*/ | ||
public void insert(ShoppingCart shoppingCart); | ||
|
||
/** | ||
* 根据id删除购物车数据 | ||
* | ||
* @param id | ||
*/ | ||
public void deleteById(Long id); | ||
|
||
/** | ||
* 根据用户id删除购物车数据 | ||
* | ||
* @param userId | ||
*/ | ||
public void deleteByUserId(Long userId); | ||
|
||
/** | ||
* 批量插入购物车数据 | ||
* | ||
* @param shoppingCartList | ||
*/ | ||
public void insertBatch(List<ShoppingCart> shoppingCartList); | ||
} |
Oops, something went wrong.