phpcjl
2024-11-28 e81d5ff655e0c5efc85d2e4b3803bc604baf59f1
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.other.service.impl;
import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.StringUtils;
@@ -8,8 +9,10 @@
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.enums.GoodsStatus;
import com.ruoyi.other.mapper.GoodsAreaMapper;
import com.ruoyi.other.mapper.GoodsMapper;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.GoodsVipService;
import com.ruoyi.other.service.VipSettingService;
import com.ruoyi.other.vo.GoodsVO;
import com.ruoyi.system.api.model.LoginUser;
@@ -36,6 +39,10 @@
    private TokenService tokenService;
    @Resource
    private VipSettingService vipSettingService;
    @Resource
    private GoodsAreaMapper goodsAreaMapper;
    @Resource
    private GoodsVipService goodsVipService;
    @Override
    public List<GoodsVO> goodsList(Goods search) {
@@ -55,10 +62,11 @@
    @Override
    public GoodsVO goodsDetail(Long goodsId) {
        // TODO 根据会员等级计算价格、积分
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid());
        // ...
        // TODO 根据会员等级计算价格、积分
        Goods goods = this.getById(goodsId);
        if (Objects.nonNull(goods)){
            GoodsVO goodsVO = new GoodsVO();
@@ -70,6 +78,11 @@
    @Override
    public List<Goods> getGoodsListByShopId(Integer shopId) {
        return goodsMapper.selectListByShopId(shopId);
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid());
        JSONArray array = new JSONArray();
        array.add(vipSetting.getId());
        return goodsMapper.selectListByShopId(shopId,array.toString());
    }
}