Merge remote-tracking branch 'origin/zcc'

This commit is contained in:
wangjinlei
2024-04-22 14:34:27 +08:00
8 changed files with 185 additions and 53 deletions

View File

@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.ShopProduct;
import com.peanut.modules.common.to.ParamTo;
import java.util.List;
public interface ShopProductService extends IService<ShopProduct> {
Page getMarketProductList(ParamTo param);
List<ShopProduct> getProductListForCourse(Integer CatalogueId);
}

View File

@@ -3,17 +3,24 @@ package com.peanut.modules.sociology.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.ShopProductCourseDao;
import com.peanut.modules.common.dao.ShopProductDao;
import com.peanut.modules.common.entity.ShopProduct;
import com.peanut.modules.common.entity.ShopProductCourseEntity;
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.sociology.service.ShopProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service("sociologyShopProduct")
public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProduct> implements ShopProductService {
@Autowired
private ShopProductCourseDao shopProductCourseDao;
@Override
public Page getMarketProductList(ParamTo param) {
@@ -24,4 +31,16 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
Page<ShopProduct> shopProductPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), ShopProduct.class, wrapper);
return shopProductPage;
}
@Override
public List<ShopProduct> getProductListForCourse(Integer catalogueId) {
MPJLambdaWrapper<ShopProductCourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(ShopProduct.class);
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductCourseEntity::getProductId);
wrapper.eq(ShopProductCourseEntity::getCatalogueId,catalogueId);
wrapper.orderByAsc(ShopProduct::getPrice);
List<ShopProduct> shopProducts = shopProductCourseDao.selectJoinList(ShopProduct.class, wrapper);
return shopProducts;
}
}