From 0939c615172f723635d04c58b0e6896fa43b5386 Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Tue, 23 Jan 2024 02:54:05 +0800
Subject: [PATCH] 接口调整
---
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallShoppingCartServiceImpl.java | 7 +
src/main/java/cc/mrbird/febs/mall/entity/MallShoppingCart.java | 2
src/main/java/cc/mrbird/febs/mall/dto/ApiXcxSaveInfoDto.java | 9 +++
src/main/java/cc/mrbird/febs/mall/service/IApiMallShoppingCartService.java | 2
src/main/java/cc/mrbird/febs/mall/dto/AddCartDto.java | 4 +
src/main/java/cc/mrbird/febs/mall/controller/ApiMallShoppingCartController.java | 4
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java | 12 +++
src/main/java/cc/mrbird/febs/mall/entity/MallMember.java | 5 +
src/main/java/cc/mrbird/febs/vip/service/impl/MallVipConfigServiceImpl.java | 9 +++
src/main/java/cc/mrbird/febs/vip/controller/ApiMallVipConfigController.java | 15 +++++
src/main/java/cc/mrbird/febs/vip/entity/MallVipConfig.java | 6 ++
src/main/resources/mapper/modules/MallShoppingCartMapper.xml | 2
src/main/java/cc/mrbird/febs/vip/service/IMallVipConfigService.java | 4 +
src/main/resources/mapper/modules/MallVipConfigMapper.xml | 54 ++++++++---------
src/main/java/cc/mrbird/febs/vip/mapper/MallVipConfigMapper.java | 4 +
src/main/java/cc/mrbird/febs/mall/mapper/MallShoppingCartMapper.java | 2
16 files changed, 103 insertions(+), 38 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallShoppingCartController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallShoppingCartController.java
index dd483e3..6d4a4ee 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallShoppingCartController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallShoppingCartController.java
@@ -38,8 +38,8 @@
@ApiResponse(code = 200, message = "success", response = ShoppingCartGoodsVo.class)
})
@PostMapping(value = "/findCartGoodsList")
- public FebsResponse findCartGoodsList() {
- return new FebsResponse().success().data(mallShoppingCartService.findCartGoodsList());
+ public FebsResponse findCartGoodsList(@RequestParam(required = false, value = "type") Integer type) {
+ return new FebsResponse().success().data(mallShoppingCartService.findCartGoodsList(type));
}
@ApiOperation(value = "添加商品到购物车", notes = "添加商品到购物车")
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AddCartDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AddCartDto.java
index 4e6f6ec..985e8d4 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/AddCartDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AddCartDto.java
@@ -21,4 +21,8 @@
@NotNull(message = "参数不能为空")
@ApiModelProperty(value = "数量")
private Integer cnt;
+
+ @NotNull(message = "类型不能为空")
+ @ApiModelProperty(value = "1-普通商品 2-积分商品")
+ private Integer type;
}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiXcxSaveInfoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiXcxSaveInfoDto.java
index 7922925..94a9d81 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/ApiXcxSaveInfoDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiXcxSaveInfoDto.java
@@ -4,6 +4,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.util.Date;
+
@Data
@ApiModel(value = "ApiXcxSaveInfoDto", description = "小程序接收用户数据")
public class ApiXcxSaveInfoDto {
@@ -22,4 +24,11 @@
@ApiModelProperty(value = "邀请码")
private String inviteId;
+
+ @ApiModelProperty(value = "生日")
+ private Date birthday;
+
+ @ApiModelProperty(value = "真实姓名")
+ private String realName;
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallMember.java b/src/main/java/cc/mrbird/febs/mall/entity/MallMember.java
index 2f6511b..9ca0af3 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallMember.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallMember.java
@@ -8,6 +8,7 @@
import lombok.Data;
import java.math.BigDecimal;
+import java.util.Date;
/**
* @author wzy
@@ -165,4 +166,8 @@
//优惠卷名称
@TableField(exist = false)
private Long couponId;
+
+ private Date birthday;
+
+ private String realName;
}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallShoppingCart.java b/src/main/java/cc/mrbird/febs/mall/entity/MallShoppingCart.java
index f23fc07..6ca894c 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallShoppingCart.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallShoppingCart.java
@@ -23,6 +23,8 @@
private Integer cnt;
+ private Integer type;
+
@TableField(exist = false)
private MallGoods goods;
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallShoppingCartMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallShoppingCartMapper.java
index c59ee88..3a646ad 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallShoppingCartMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallShoppingCartMapper.java
@@ -12,7 +12,7 @@
**/
public interface MallShoppingCartMapper extends BaseMapper<MallShoppingCart> {
- List<MallShoppingCart> selectCartGoodsList(@Param("memberId") Long memberId);
+ List<MallShoppingCart> selectCartGoodsList(@Param("memberId") Long memberId,@Param("type") Integer type);
MallShoppingCart selectCartGoodsBySkuId(@Param("skuId") Long skuId, @Param("memberId") Long memberId);
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallShoppingCartService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallShoppingCartService.java
index dfa0668..6a11757 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallShoppingCartService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallShoppingCartService.java
@@ -13,7 +13,7 @@
**/
public interface IApiMallShoppingCartService extends IService<MallShoppingCart> {
- List<ShoppingCartGoodsVo> findCartGoodsList();
+ List<ShoppingCartGoodsVo> findCartGoodsList(Integer type);
void addGoodsToCart(List<AddCartDto> addCartDto);
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
index 89b97fe..0e4af18 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -304,7 +304,7 @@
}
}
- List<MallShoppingCart> carts = mallShoppingCartMapper.selectCartGoodsList(id);
+ List<MallShoppingCart> carts = mallShoppingCartMapper.selectCartGoodsList(id, 1);
Map<String, Object> result = new HashMap<>();
result.put("order", orderCnt);
result.put("carts", carts.size());
@@ -703,7 +703,15 @@
if(StrUtil.isNotEmpty(avatarUrl)){
mallMember.setAvatar(avatarUrl);
}
-// mallMember.setSex(1 == apiXcxSaveInfoDto.getGender() ? "女" : "男");
+
+ if (StrUtil.isNotBlank(apiXcxSaveInfoDto.getRealName())) {
+ mallMember.setRealName(apiXcxSaveInfoDto.getRealName());
+ }
+
+ if (apiXcxSaveInfoDto.getBirthday() != null) {
+ mallMember.setBirthday(apiXcxSaveInfoDto.getBirthday());
+ }
+ mallMember.setSex(1 == apiXcxSaveInfoDto.getGender() ? "女" : "男");
this.baseMapper.updateById(mallMember);
return new FebsResponse().success();
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallShoppingCartServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallShoppingCartServiceImpl.java
index 73f3c5a..abfd858 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallShoppingCartServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallShoppingCartServiceImpl.java
@@ -30,9 +30,12 @@
private final MallGoodsSkuMapper mallGoodsSkuMapper;
@Override
- public List<ShoppingCartGoodsVo> findCartGoodsList() {
+ public List<ShoppingCartGoodsVo> findCartGoodsList(Integer type) {
+ if (type == null) {
+ type = 1;
+ }
Long memberId = LoginUserUtil.getLoginUser().getId();
- List<MallShoppingCart> carts = this.baseMapper.selectCartGoodsList(memberId);
+ List<MallShoppingCart> carts = this.baseMapper.selectCartGoodsList(memberId, type);
return MallShoppingCartConversion.INSTANCE.entityListToVoList(carts);
}
diff --git a/src/main/java/cc/mrbird/febs/vip/controller/ApiMallVipConfigController.java b/src/main/java/cc/mrbird/febs/vip/controller/ApiMallVipConfigController.java
index 8771bd2..9dc7912 100644
--- a/src/main/java/cc/mrbird/febs/vip/controller/ApiMallVipConfigController.java
+++ b/src/main/java/cc/mrbird/febs/vip/controller/ApiMallVipConfigController.java
@@ -2,9 +2,14 @@
import cc.mrbird.febs.common.controller.BaseController;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.vip.service.IMallVipConfigService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -14,5 +19,15 @@
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/api/vip/config")
+@Api(value = "ApiMallVipConfigController", tags = "会员等级接口类")
public class ApiMallVipConfigController extends BaseController {
+
+ private final IMallVipConfigService mallVipConfigService;
+
+
+ @ApiOperation(value = "获取会员等级列表")
+ @GetMapping(value = "/findVipList")
+ public FebsResponse findVipList() {
+ return new FebsResponse().success().data(mallVipConfigService.findConfigList());
+ }
}
diff --git a/src/main/java/cc/mrbird/febs/vip/entity/MallVipConfig.java b/src/main/java/cc/mrbird/febs/vip/entity/MallVipConfig.java
index dd665f1..9c64424 100644
--- a/src/main/java/cc/mrbird/febs/vip/entity/MallVipConfig.java
+++ b/src/main/java/cc/mrbird/febs/vip/entity/MallVipConfig.java
@@ -1,8 +1,11 @@
package cc.mrbird.febs.vip.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
+
+import java.util.List;
@Data
@TableName("mall_vip_config")
@@ -52,4 +55,7 @@
* 指定商品ID
*/
private Long targetId;
+
+ @TableField(exist = false)
+ private List<MallVipBenefits> benefits;
}
diff --git a/src/main/java/cc/mrbird/febs/vip/mapper/MallVipConfigMapper.java b/src/main/java/cc/mrbird/febs/vip/mapper/MallVipConfigMapper.java
index 22865f8..31553fb 100644
--- a/src/main/java/cc/mrbird/febs/vip/mapper/MallVipConfigMapper.java
+++ b/src/main/java/cc/mrbird/febs/vip/mapper/MallVipConfigMapper.java
@@ -4,7 +4,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
public interface MallVipConfigMapper extends BaseMapper<MallVipConfig> {
IPage<MallVipConfig> findVipConfigListInPage(IPage<MallVipConfig> page);
+
+ List<MallVipConfig> selectVipConfigList();
}
diff --git a/src/main/java/cc/mrbird/febs/vip/service/IMallVipConfigService.java b/src/main/java/cc/mrbird/febs/vip/service/IMallVipConfigService.java
index 6827271..5ca6e3b 100644
--- a/src/main/java/cc/mrbird/febs/vip/service/IMallVipConfigService.java
+++ b/src/main/java/cc/mrbird/febs/vip/service/IMallVipConfigService.java
@@ -5,7 +5,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
public interface IMallVipConfigService extends IService<MallVipConfig> {
IPage<MallVipConfig> vipConfigList(QueryRequest request);
+
+ List<MallVipConfig> findConfigList();
}
diff --git a/src/main/java/cc/mrbird/febs/vip/service/impl/MallVipConfigServiceImpl.java b/src/main/java/cc/mrbird/febs/vip/service/impl/MallVipConfigServiceImpl.java
index c694413..e35e9ad 100644
--- a/src/main/java/cc/mrbird/febs/vip/service/impl/MallVipConfigServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/vip/service/impl/MallVipConfigServiceImpl.java
@@ -4,12 +4,16 @@
import cc.mrbird.febs.vip.entity.MallVipConfig;
import cc.mrbird.febs.vip.mapper.MallVipConfigMapper;
import cc.mrbird.febs.vip.service.IMallVipConfigService;
+import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
@Slf4j
@Service
@@ -21,4 +25,9 @@
Page<MallVipConfig> page = new Page<>(request.getPageNum(), request.getPageNum());
return this.baseMapper.findVipConfigListInPage(page);
}
+
+ @Override
+ public List<MallVipConfig> findConfigList() {
+ return this.baseMapper.selectVipConfigList();
+ }
}
diff --git a/src/main/resources/mapper/modules/MallShoppingCartMapper.xml b/src/main/resources/mapper/modules/MallShoppingCartMapper.xml
index 3acd27d..ac1796e 100644
--- a/src/main/resources/mapper/modules/MallShoppingCartMapper.xml
+++ b/src/main/resources/mapper/modules/MallShoppingCartMapper.xml
@@ -13,7 +13,7 @@
</resultMap>
<select id="selectCartGoodsList" resultMap="ShoppingCartMap">
- select * from mall_shopping_cart where member_id=#{memberId}
+ select * from mall_shopping_cart where member_id=#{memberId} and type = #{type}
</select>
<select id="selectCartGoodsBySkuId" resultType="cc.mrbird.febs.mall.entity.MallShoppingCart">
diff --git a/src/main/resources/mapper/modules/MallVipConfigMapper.xml b/src/main/resources/mapper/modules/MallVipConfigMapper.xml
index 9a059ba..a68988d 100644
--- a/src/main/resources/mapper/modules/MallVipConfigMapper.xml
+++ b/src/main/resources/mapper/modules/MallVipConfigMapper.xml
@@ -2,41 +2,37 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.vip.mapper.MallVipConfigMapper">
- <resultMap id="VipBenefitsMap" type="cc.mrbird.febs.vip.entity.MallVipConfig">
-<!-- <id property="id" column="id" />-->
-<!-- <result property="name" column="name" />-->
-<!-- <result property="type" column="type" />-->
-<!-- <result property="gainType" column="gain_type" />-->
-<!-- <result property="icon" column="icon" />-->
-<!-- <result property="scoreMultiple" column="score_multiple" />-->
-<!-- <result property="remark" column="remark" />-->
+ <resultMap id="vipConfigMap" type="cc.mrbird.febs.vip.entity.MallVipConfig">
+ <id property="id" column="id" />
+ <result property="name" column="name" />
+ <result property="thumb" column="thumb" />
+ <result property="level" column="level" />
+ <result property="validTime" column="valid_time" />
+ <result property="validType" column="valid_time" />
+ <result property="type" column="type" />
+ <result property="amount" column="amount" />
+ <result property="times" column="times" />
+ <result property="targetId" column="target_id" />
-<!-- <collection property="details" ofType="cc.mrbird.febs.vip.entity.MallVipBenefitsDetails">-->
-<!-- <id property="id" column="c_id" />-->
-<!-- <result property="image" column="image" />-->
-<!-- <result property="isClick" column="is_click" />-->
-<!-- <result property="linkType" column="link_type" />-->
-<!-- <result property="content" column="content" />-->
-<!-- <result property="benefitsId" column="benefits_id" />-->
-<!-- <result property="seq" column="seq" />-->
-<!-- </collection>-->
+ <collection property="benefits" ofType="cc.mrbird.febs.vip.entity.MallVipBenefits">
+ <id property="id" column="c_id" />
+ <result property="name" column="c_name" />
+ <result property="icon" column="c_icon" />
+ </collection>
</resultMap>
- <select id="findVipConfigListInPage" resultType="cc.mrbird.febs.vip.entity.MallVipBenefits">
+ <select id="findVipConfigListInPage" resultType="cc.mrbird.febs.vip.entity.MallVipConfig">
select * from mall_vip_config
</select>
- <select id="selectVipBenefitsById" resultMap="VipBenefitsMap">
+ <select id="selectVipConfigList" resultMap="vipConfigMap">
select
- benefits.*,
- benefitsDetail.id c_id
- ,benefitsDetail.image
- ,benefitsDetail.is_click
- ,benefitsDetail.link_type
- ,benefitsDetail.content
- ,benefitsDetail.seq
- from mall_vip_benefits benefits
- inner join mall_vip_benefits_details benefitsDetail on benefits.id=benefitsDetail.benefits_id
- where benefits.id=#{id}
+ config.*
+ ,benefits.id c_id
+ ,benefits.name c_name
+ ,benefits.icon c_icon
+ from mall_vip_config config
+ inner join mall_vip_config_benefits configBenefits on config.id=configBenefits.config_id
+ inner join mall_vip_benefits benefits on configBenefits.benefits_id=benefits.id
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1