This commit is contained in:
wangjinlei
2024-04-11 17:33:14 +08:00
parent 0806ae7220
commit ce4355d2b1
13 changed files with 185 additions and 23 deletions

View File

@@ -17,4 +17,6 @@ public interface CourseService extends IService<CourseEntity> {
Page<CourseEntity> getUserLateCourseList(ParamTo param);
Page<CourseEntity> getMarketCourseList(ParamTo param);
}

View File

@@ -0,0 +1,11 @@
package com.peanut.modules.sociology.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.ShopProduct;
import com.peanut.modules.common.to.ParamTo;
public interface ShopProductService extends IService<ShopProduct> {
Page getMarketProductList(ParamTo param);
}

View File

@@ -8,6 +8,7 @@ import com.peanut.modules.common.dao.CourseDao;
import com.peanut.modules.common.dao.CourseToSociologyDao;
import com.peanut.modules.common.dao.UserToCourseDao;
import com.peanut.modules.common.entity.CourseEntity;
import com.peanut.modules.common.entity.CourseToMarketEntity;
import com.peanut.modules.common.entity.CourseToSociologyEntity;
import com.peanut.modules.common.entity.UserToCourseEntity;
import com.peanut.modules.common.to.ParamTo;
@@ -65,6 +66,17 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
wrapper.eq(UserToCourseEntity::getUserId,param.getId());
wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;
}
@Override
public Page<CourseEntity> getMarketCourseList(ParamTo param) {
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToMarketEntity.class,CourseToMarketEntity::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToMarketEntity::getId,param.getId());
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
return courseEntityPage;
}

View File

@@ -0,0 +1,27 @@
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.ShopProductDao;
import com.peanut.modules.common.entity.ShopProduct;
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.stereotype.Service;
@Slf4j
@Service("sociologyShopProduct")
public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProduct> implements ShopProductService {
@Override
public Page getMarketProductList(ParamTo param) {
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(ShopProduct.class);
wrapper.leftJoin(ShopProductToSociologyMarket.class,ShopProductToSociologyMarket::getProductId,ShopProduct::getProductId);
wrapper.eq(ShopProductToSociologyMarket::getSociologyMarketId,param.getId());
Page<ShopProduct> shopProductPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), ShopProduct.class, wrapper);
return shopProductPage;
}
}