fix: 充值相关

pull/2/head
tangqian 2023-05-25 14:48:29 +08:00
parent 9a5d6cc1cc
commit 270e45433e
3 changed files with 31 additions and 5 deletions

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.shop.request.product;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Title:DelectCartRequest
* @Description: TODO
* @author: tangqian
* @date: 2023/5/25 13:03
* @version: V1.0.0
*/
@Data
public class DeleteCartRequest implements Serializable {
private static final long serialVersionUID = 8471460222619043734L;
@Schema(description = "商品id")
private List<Long> ids;
}

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.shop.request.product.CartNumRequest;
import cn.iocoder.yudao.module.shop.request.product.CartRequest;
import cn.iocoder.yudao.module.shop.request.product.CartResetRequest;
import cn.iocoder.yudao.module.shop.request.product.DeleteCartRequest;
import cn.iocoder.yudao.module.shop.response.product.CartInfoResponse;
import cn.iocoder.yudao.module.shop.service.product.StoreCartService;
import com.github.pagehelper.PageInfo;
@ -78,12 +79,11 @@ public class CartController {
/**
*
* @param ids ids
*/
@Operation(summary = "删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
public CommonResult<String> delete(@RequestParam(value = "ids") List<Long> ids) {
if (storeCartService.deleteCartByIds(ids)) {
public CommonResult<String> delete(@RequestBody @Validated DeleteCartRequest request) {
if (storeCartService.deleteCartByIds(request.getIds())) {
return CommonResult.success("删除购物车成功");
} else {
return CommonResult.error(GlobalErrorCodeConstants.OPERATION_ERROR.getCode(), "删除购物车失败");

View File

@ -7,7 +7,10 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@ -70,11 +73,12 @@ public class PhoneRecordServiceImpl implements PhoneRecordService {
// 校验存在
validatePhoneRecordExists(id);
// 删除
phoneRecordMapper.deleteById(id);
phoneRecordMapper.delete(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId,id));
}
private void validatePhoneRecordExists(Long id) {
if (phoneRecordMapper.selectById(id) == null) {
PhoneRecordDO phoneRecordDO = phoneRecordMapper.selectOne(Wrappers.<PhoneRecordDO>lambdaQuery().eq(PhoneRecordDO::getRechargeOrderId, id));
if (phoneRecordDO == null) {
throw exception(PHONE_RECORD_NOT_EXISTS);
}
}