Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.CourseMarketEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CourseMarketDao extends MPJBaseMapper<CourseMarketEntity> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.CourseToMarketEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CourseToMarketDao extends MPJBaseMapper<CourseToMarketEntity> {
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.peanut.modules.common.dao;
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.peanut.modules.common.entity.ShopProduct;
|
import com.peanut.modules.common.entity.ShopProduct;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -14,7 +15,7 @@ import java.util.List;
|
|||||||
* @date 2022-10-28 09:43:14
|
* @date 2022-10-28 09:43:14
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ShopProductDao extends BaseMapper<ShopProduct> {
|
public interface ShopProductDao extends MPJBaseMapper<ShopProduct> {
|
||||||
|
|
||||||
List<ShopProduct> appGetCategoryList(Integer catId);
|
List<ShopProduct> appGetCategoryList(Integer catId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.UserCourseBuyEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserCourseBuyDao extends MPJBaseMapper<UserCourseBuyEntity> {
|
||||||
|
}
|
||||||
@@ -30,4 +30,6 @@ public class CourseEntity {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<CourseCatalogueEntity> courseCatalogueEntityList;
|
private List<CourseCatalogueEntity> courseCatalogueEntityList;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer bindId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("course_market")
|
||||||
|
public class CourseMarketEntity {
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer pid;
|
||||||
|
|
||||||
|
private Integer isLast;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("course_to_market")
|
||||||
|
public class CourseToMarketEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer courseId;
|
||||||
|
|
||||||
|
private Integer sociologyId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("user_course_buy")
|
||||||
|
public class UserCourseBuyEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private Integer courseId;
|
||||||
|
|
||||||
|
private Integer catalogueId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Integer days;
|
||||||
|
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,18 +18,10 @@ public class UserToCourseEntity {
|
|||||||
|
|
||||||
private Integer courseId;
|
private Integer courseId;
|
||||||
|
|
||||||
private Integer catalogueId;
|
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
private Integer days;
|
|
||||||
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
private Date startTime;
|
|
||||||
|
|
||||||
private Date endTime;
|
|
||||||
|
|
||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class CourseSociologyController {
|
|||||||
@RequestMapping("/addCourseSociology")
|
@RequestMapping("/addCourseSociology")
|
||||||
public R addCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
public R addCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
||||||
courseSociologyService.save(courseSociologyEntity);
|
courseSociologyService.save(courseSociologyEntity);
|
||||||
return R.ok();
|
return R.ok().put("sociology",courseSociologyEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/delCourseSociology")
|
@RequestMapping("/delCourseSociology")
|
||||||
@@ -47,8 +47,7 @@ public class CourseSociologyController {
|
|||||||
|
|
||||||
@RequestMapping("/editCourseSociology")
|
@RequestMapping("/editCourseSociology")
|
||||||
public R editCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
public R editCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
||||||
courseSociologyService.editCourseSociology(courseSociologyEntity);
|
return courseSociologyService.editCourseSociology(courseSociologyEntity);
|
||||||
return R.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/getCourseListForSociology")
|
@RequestMapping("/getCourseListForSociology")
|
||||||
@@ -70,8 +69,12 @@ public class CourseSociologyController {
|
|||||||
|
|
||||||
@RequestMapping("/unbindCourseAndSociology")
|
@RequestMapping("/unbindCourseAndSociology")
|
||||||
public R unbindCourseAndSociology(@RequestBody CourseToSociologyEntity courseToSociologyEntity){
|
public R unbindCourseAndSociology(@RequestBody CourseToSociologyEntity courseToSociologyEntity){
|
||||||
courseToSociologyService.removeById(courseToSociologyEntity.getId());
|
boolean b = courseToSociologyService.removeById(courseToSociologyEntity.getId());
|
||||||
return R.ok();
|
if(b){
|
||||||
|
return R.ok();
|
||||||
|
}else {
|
||||||
|
return R.error("error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CourseCatalogueChapterDao courseCatalogueChapterDao;
|
private CourseCatalogueChapterDao courseCatalogueChapterDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserToCourseDao userToCourseDao;
|
private UserCourseBuyDao userCourseBuyDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopProductCourseDao shopProductCourseDao;
|
private ShopProductCourseDao shopProductCourseDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -42,10 +42,10 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
if(integer>0){
|
if(integer>0){
|
||||||
return R.error(502,"删除失败,请先清空章节");
|
return R.error(502,"删除失败,请先清空章节");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<UserToCourseEntity> userToCourseEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserCourseBuyEntity> userCourseBuyEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
userToCourseEntityLambdaQueryWrapper.eq(UserToCourseEntity::getCatalogueId,id);
|
userCourseBuyEntityLambdaQueryWrapper.eq(UserCourseBuyEntity::getCatalogueId,id);
|
||||||
userToCourseEntityLambdaQueryWrapper.gt(UserToCourseEntity::getEndTime,new Date());
|
userCourseBuyEntityLambdaQueryWrapper.gt(UserCourseBuyEntity::getEndTime,new Date());
|
||||||
Integer integer1 = userToCourseDao.selectCount(userToCourseEntityLambdaQueryWrapper);
|
Integer integer1 = userCourseBuyDao.selectCount(userCourseBuyEntityLambdaQueryWrapper);
|
||||||
if(integer1>0){
|
if(integer1>0){
|
||||||
return R.error(502,"删除失败,有人已购买此课程");
|
return R.error(502,"删除失败,有人已购买此课程");
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public class CourseCatalogueServiceImpl extends ServiceImpl<CourseCatalogueDao,
|
|||||||
@Override
|
@Override
|
||||||
public void addCourseCatalogue(CourseCatalogueEntity courseCatalogue) {
|
public void addCourseCatalogue(CourseCatalogueEntity courseCatalogue) {
|
||||||
this.save(courseCatalogue);
|
this.save(courseCatalogue);
|
||||||
if(courseCatalogue.getNeedCreate()==1){
|
if(courseCatalogue.getNeedCreate()!=null&&courseCatalogue.getNeedCreate()==1){
|
||||||
this.createProduct(courseCatalogue);
|
this.createProduct(courseCatalogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R delCourse(int id) {
|
public R delCourse(int id) {
|
||||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectOne(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, id));
|
Integer integer = courseCatalogueDao.selectCount(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, id));
|
||||||
if (courseCatalogueEntity!=null){
|
if (integer>0){
|
||||||
return R.error(501,"请先删除目录后再删除!");
|
return R.error(501,"请先删除目录后再删除!");
|
||||||
}
|
}
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
@@ -98,6 +98,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
public List<CourseEntity> getCourseListForSociology(int sociologyId) {
|
public List<CourseEntity> getCourseListForSociology(int sociologyId) {
|
||||||
MPJLambdaWrapper<CourseToSociologyEntity> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<CourseToSociologyEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.selectAll(CourseEntity.class);
|
wrapper.selectAll(CourseEntity.class);
|
||||||
|
wrapper.selectAs(CourseToSociologyEntity::getId,"bindId");
|
||||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyEntity::getCourseId);
|
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyEntity::getCourseId);
|
||||||
wrapper.eq(CourseToSociologyEntity::getSociologyId,sociologyId);
|
wrapper.eq(CourseToSociologyEntity::getSociologyId,sociologyId);
|
||||||
List<CourseEntity> courseEntities = courseToSociologyDao.selectJoinList(CourseEntity.class, wrapper);
|
List<CourseEntity> courseEntities = courseToSociologyDao.selectJoinList(CourseEntity.class, wrapper);
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ public class CourseSociologyServiceImpl extends ServiceImpl<CourseSociologyDao,
|
|||||||
@Override
|
@Override
|
||||||
public R delCourseSociology(int id) {
|
public R delCourseSociology(int id) {
|
||||||
//查看下一级是否存在
|
//查看下一级是否存在
|
||||||
CourseSociologyEntity one = this.getOne(new LambdaQueryWrapper<CourseSociologyEntity>().eq(CourseSociologyEntity::getPid, id));
|
int count = this.count(new LambdaQueryWrapper<CourseSociologyEntity>().eq(CourseSociologyEntity::getPid, id));
|
||||||
if(one!=null){
|
if(count>0){
|
||||||
return R.error(501,"删除失败,请先删除子项目后再尝试");
|
return R.error(501,"删除失败,请先删除子项目后再尝试");
|
||||||
}
|
}
|
||||||
//查看绑定关系是否存在
|
//查看绑定关系是否存在
|
||||||
CourseToSociologyEntity courseToSociologyEntity = courseToSociologyDao.selectOne(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, id));
|
Integer integer = courseToSociologyDao.selectCount(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, id));
|
||||||
if(courseToSociologyEntity!=null){
|
if(integer>0){
|
||||||
return R.error(502,"删除失败,请先解绑课程与国学标签的绑定关系");
|
return R.error(502,"删除失败,请先解绑课程与国学标签的绑定关系");
|
||||||
}
|
}
|
||||||
this.removeById(id);
|
this.removeById(id);
|
||||||
@@ -60,7 +60,7 @@ public class CourseSociologyServiceImpl extends ServiceImpl<CourseSociologyDao,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateById(courseSociologyEntity);
|
this.updateById(courseSociologyEntity);
|
||||||
return R.ok();
|
return R.ok().put("sociology",courseSociologyEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CourseSociologyEntity> sociologys(int id){
|
private List<CourseSociologyEntity> sociologys(int id){
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.peanut.modules.sociology.controller;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.common.utils.ShiroUtils;
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.common.entity.CourseEntity;
|
||||||
import com.peanut.modules.common.to.ParamTo;
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
import com.peanut.modules.sociology.service.CourseService;
|
import com.peanut.modules.sociology.service.CourseService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,6 +20,11 @@ public class CourseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CourseService courseService;
|
private CourseService courseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户最近学习课程列表
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/getUserLateCourseList")
|
@RequestMapping("/getUserLateCourseList")
|
||||||
public R getUserLateCourseList(@RequestBody ParamTo param){
|
public R getUserLateCourseList(@RequestBody ParamTo param){
|
||||||
Integer userId = ShiroUtils.getUId();
|
Integer userId = ShiroUtils.getUId();
|
||||||
@@ -27,4 +33,26 @@ public class CourseController {
|
|||||||
return R.ok().put("page",userLateCourseList);
|
return R.ok().put("page",userLateCourseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营销标签下的课程列表
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getMarketCourseList")
|
||||||
|
public R getMarketCourseList(@RequestBody ParamTo param){
|
||||||
|
Page<CourseEntity> marketCourseList = courseService.getMarketCourseList(param);
|
||||||
|
return R.ok().put("courseList",marketCourseList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取国学标签下的课程列表
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getSociologyCourseList")
|
||||||
|
public R getSociologyCourseList(@RequestBody ParamTo param){
|
||||||
|
Page sociologyCourseList = courseService.getSociologyCourseList(param);
|
||||||
|
return R.ok().put("courses",sociologyCourseList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,19 +33,16 @@ public class HomeController {
|
|||||||
return R.ok().put("myCourse",courseList);
|
return R.ok().put("myCourse",courseList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取国学标签列表
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@RequestMapping("/getSociologyLabels")
|
@RequestMapping("/getSociologyLabels")
|
||||||
public R getSociologyLabels(@RequestBody ParamTo param){
|
public R getSociologyLabels(@RequestBody ParamTo param){
|
||||||
List<CourseSociologyEntity> sociologyLabels = courseSociologyService.getSociologyLabels(param.getId());
|
List<CourseSociologyEntity> sociologyLabels = courseSociologyService.getSociologyLabels(param.getId());
|
||||||
return R.ok().put("labels",sociologyLabels);
|
return R.ok().put("labels",sociologyLabels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/getSociologyCourseList")
|
|
||||||
public R getSociologyCourseList(@RequestBody ParamTo param){
|
|
||||||
Page sociologyCourseList = courseService.getSociologyCourseList(param);
|
|
||||||
return R.ok().put("courses",sociologyCourseList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.peanut.modules.sociology.controller;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RestController("sociologyProduct")
|
|
||||||
@RequestMapping("sociology/product")
|
|
||||||
public class ProductController {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.peanut.modules.sociology.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
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.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController("sociologyProduct")
|
||||||
|
@RequestMapping("sociology/product")
|
||||||
|
public class ShopProductController {
|
||||||
|
@Autowired
|
||||||
|
private ShopProductService shopProductService;
|
||||||
|
|
||||||
|
@RequestMapping("/getMarketProductList")
|
||||||
|
public R getMarketProductList(@RequestBody ParamTo param){
|
||||||
|
Page marketProductList = shopProductService.getMarketProductList(param);
|
||||||
|
return R.ok().put("products",marketProductList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,4 +17,6 @@ public interface CourseService extends IService<CourseEntity> {
|
|||||||
|
|
||||||
Page<CourseEntity> getUserLateCourseList(ParamTo param);
|
Page<CourseEntity> getUserLateCourseList(ParamTo param);
|
||||||
|
|
||||||
|
Page<CourseEntity> getMarketCourseList(ParamTo param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.peanut.modules.common.dao.CourseDao;
|
|||||||
import com.peanut.modules.common.dao.CourseToSociologyDao;
|
import com.peanut.modules.common.dao.CourseToSociologyDao;
|
||||||
import com.peanut.modules.common.dao.UserToCourseDao;
|
import com.peanut.modules.common.dao.UserToCourseDao;
|
||||||
import com.peanut.modules.common.entity.CourseEntity;
|
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.CourseToSociologyEntity;
|
||||||
import com.peanut.modules.common.entity.UserToCourseEntity;
|
import com.peanut.modules.common.entity.UserToCourseEntity;
|
||||||
import com.peanut.modules.common.to.ParamTo;
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
@@ -65,6 +66,17 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
wrapper.selectAll(CourseEntity.class);
|
wrapper.selectAll(CourseEntity.class);
|
||||||
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
|
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
|
||||||
wrapper.eq(UserToCourseEntity::getUserId,param.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);
|
Page<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
|
||||||
return courseEntityPage;
|
return courseEntityPage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user