bug
This commit is contained in:
@@ -795,6 +795,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
courseCatalogueEntityMPJLambdaWrapper.selectAs(CourseEntity::getTitle,"courseTitle");
|
||||
courseCatalogueEntityMPJLambdaWrapper.selectAs(CourseCatalogueEntity::getTitle,"CourseCatalogueTitle");
|
||||
courseCatalogueEntityMPJLambdaWrapper.selectAs(CourseEntity::getImage,"image");
|
||||
courseCatalogueEntityMPJLambdaWrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseCatalogueEntity::getCourseId);
|
||||
courseCatalogueEntityMPJLambdaWrapper.in(CourseCatalogueEntity::getId,collect);
|
||||
List<CourseCatalogueVo> courseCatalogueVos = courseCatalogueDao.selectJoinList(CourseCatalogueVo.class, courseCatalogueEntityMPJLambdaWrapper);
|
||||
goodsResponseVo.setCourseCatalogueList(courseCatalogueVos);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ package com.peanut.modules.master.controller;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.BookEntity;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.common.vo.CourseCatalogueVo;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -11,6 +14,8 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -122,7 +127,6 @@ public class ShopProductController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/bindProductAndMedicineMarket")
|
||||
public R bindProductAndMedicineMarket(@RequestBody Map<String,String> map){
|
||||
String[] productIds = map.get("productId").split(",");
|
||||
@@ -137,15 +141,48 @@ public class ShopProductController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/getProductToLabel")
|
||||
public R getProductToLabel(@RequestBody Map<String,Integer> map){
|
||||
Map<String, Object> productId = shopProductService.getProductToLabel(map.get("productId"));
|
||||
return R.ok().put("data",productId);
|
||||
}
|
||||
|
||||
@RequestMapping("/getHasBindProductAndBook")
|
||||
public R getHasBindProductAndBook(@RequestBody Map<String,Integer> map){
|
||||
List<BookEntity> books = shopProductService.getHasBindProductAndBook(map.get("productId"));
|
||||
return R.ok().put("books",books);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCanBindProductAndBook")
|
||||
public R getCanBindProductAndBook(@RequestBody ParamTo param){
|
||||
Page<BookEntity> canBindProductAndBook = shopProductService.getCanBindProductAndBook(param);
|
||||
return R.ok().put("page",canBindProductAndBook);
|
||||
}
|
||||
|
||||
@RequestMapping("/bindProductAndBook")
|
||||
public R bindProductAndBook(@RequestBody Map<String,Integer> map){
|
||||
return shopProductService.bindProductAndBook(map.get("productId"),map.get("bookId"));
|
||||
}
|
||||
|
||||
@RequestMapping("/unbindProductAndBook")
|
||||
public R unbindProductAndBook(@RequestBody Map<String,Integer> map){
|
||||
shopProductService.unbindProductAndBook(map.get("productId"),map.get("bookId"));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/getHasBindProductAndCourse")
|
||||
public R getHasBindProductAndCourse(@RequestBody Map<String,Integer> map){
|
||||
List<CourseCatalogueVo> productId = shopProductService.getHasBindProductAndCourse(map.get("productId"));
|
||||
return R.ok().put("course",productId);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCanBindProductAndCourse")
|
||||
public R getCanBindProductAndCourse(@RequestBody ParamTo param){
|
||||
Page<CourseCatalogueVo> canBindProductAndCourse = shopProductService.getCanBindProductAndCourse(param);
|
||||
return R.ok().put("page",canBindProductAndCourse);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.BookEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.common.vo.CourseCatalogueVo;
|
||||
|
||||
import java.awt.print.Book;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ShopProductService extends IService<ShopProduct> {
|
||||
@@ -34,4 +43,16 @@ public interface ShopProductService extends IService<ShopProduct> {
|
||||
void bindProductAndMedicineMarket(String[] productId,int marketId);
|
||||
|
||||
void unbindProductAndMedicineMarket(int productId,int marketId);
|
||||
|
||||
List<BookEntity> getHasBindProductAndBook(int productId);
|
||||
|
||||
Page<BookEntity> getCanBindProductAndBook(ParamTo p);
|
||||
|
||||
R bindProductAndBook(int productId,int bookId);
|
||||
|
||||
void unbindProductAndBook(int productId,int bookId);
|
||||
|
||||
List<CourseCatalogueVo> getHasBindProductAndCourse(int productId);
|
||||
|
||||
Page<CourseCatalogueVo> getCanBindProductAndCourse(ParamTo param);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,15 @@ package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
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.common.utils.R;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.common.vo.CourseCatalogueVo;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -42,6 +48,14 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
private ShopProductToSociologyMarketDao shopProductToSociologyMarketDao;
|
||||
@Autowired
|
||||
private ShopProductSociologyMarketDao shopProductSociologyMarketDao;
|
||||
@Autowired
|
||||
private ShopProductBookDao shopProductBookDao;
|
||||
@Autowired
|
||||
private BookDao bookDao;
|
||||
@Autowired
|
||||
private ShopProductCourseDao shopProductCourseDao;
|
||||
@Autowired
|
||||
private CourseCatalogueDao courseCatalogueDao;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProductDetail(Integer productId) {
|
||||
@@ -168,6 +182,77 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
shopProductToMedicineMarketDao.delete(new LambdaQueryWrapper<ShopProductToMedicineMarket>().eq(ShopProductToMedicineMarket::getMedicineMarketId,marketId).eq(ShopProductToMedicineMarket::getProductId,productId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookEntity> getHasBindProductAndBook(int productId) {
|
||||
MPJLambdaWrapper<ShopProductBookEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(BookEntity.class,BookEntity::getId,ShopProductBookEntity::getBookId);
|
||||
wrapper.selectAll(BookEntity.class);
|
||||
wrapper.eq(ShopProductBookEntity::getProductId,productId);
|
||||
List<BookEntity> bookEntities = shopProductBookDao.selectJoinList(BookEntity.class, wrapper);
|
||||
return bookEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BookEntity> getCanBindProductAndBook(ParamTo p) {
|
||||
List<Integer> ids = shopProductBookDao.selectList(new LambdaQueryWrapper<ShopProductBookEntity>().eq(ShopProductBookEntity::getProductId, p.getId())).stream().map(ShopProductBookEntity::getBookId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(p.getKeywords()),BookEntity::getTitle,p.getKeywords());
|
||||
wrapper.notIn(ids.size()>0,BookEntity::getId,ids);
|
||||
wrapper.eq(BookEntity::getState,1);
|
||||
Page<BookEntity> bookEntityPage = bookDao.selectPage(new Page<BookEntity>(p.getPage(), p.getLimit()), wrapper);
|
||||
return bookEntityPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R bindProductAndBook(int productId, int bookId) {
|
||||
Integer integer = shopProductBookDao.selectCount(new LambdaQueryWrapper<ShopProductBookEntity>().eq(ShopProductBookEntity::getProductId, productId).eq(ShopProductBookEntity::getBookId, bookId));
|
||||
if(integer>0){
|
||||
return R.error("重复绑定");
|
||||
}
|
||||
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
|
||||
shopProductBookEntity.setBookId(bookId);
|
||||
shopProductBookEntity.setProductId(productId);
|
||||
shopProductBookDao.insert(shopProductBookEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbindProductAndBook(int productId, int bookId) {
|
||||
shopProductBookDao.delete(new LambdaQueryWrapper<ShopProductBookEntity>().eq(ShopProductBookEntity::getProductId,productId).eq(ShopProductBookEntity::getBookId,bookId));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CourseCatalogueVo> getHasBindProductAndCourse(int productId) {
|
||||
MPJLambdaWrapper<ShopProductCourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAs(CourseEntity::getTitle,"courseTitle");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getTitle,"CourseCatalogueTitle");
|
||||
wrapper.select(CourseEntity::getImage);
|
||||
wrapper.selectAs(CourseEntity::getId,"courseId");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
|
||||
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getId,ShopProductCourseEntity::getCatalogueId);
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,ShopProductCourseEntity::getCourseId);
|
||||
wrapper.eq(ShopProductCourseEntity::getProductId,productId);
|
||||
List<CourseCatalogueVo> courseCatalogueVos = shopProductCourseDao.selectJoinList(CourseCatalogueVo.class, wrapper);
|
||||
return courseCatalogueVos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CourseCatalogueVo> getCanBindProductAndCourse(ParamTo param) {
|
||||
List<Integer> catalogueIds = shopProductCourseDao.selectList(new LambdaQueryWrapper<ShopProductCourseEntity>().eq(ShopProductCourseEntity::getProductId, param.getId())).stream().map(ShopProductCourseEntity::getCatalogueId).collect(Collectors.toList());
|
||||
MPJLambdaWrapper<CourseCatalogueEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseCatalogueEntity::getCourseId);
|
||||
wrapper.notIn(catalogueIds.size()>0,CourseCatalogueEntity::getId,catalogueIds);
|
||||
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||
wrapper.selectAs(CourseEntity::getTitle,"courseTitle");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getTitle,"CourseCatalogueTitle");
|
||||
wrapper.select(CourseEntity::getImage);
|
||||
wrapper.selectAs(CourseEntity::getId,"courseId");
|
||||
wrapper.selectAs(CourseCatalogueEntity::getId,"catalogueId");
|
||||
Page<CourseCatalogueVo> courseCatalogueVoPage = courseCatalogueDao.selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseCatalogueVo.class, wrapper);
|
||||
return courseCatalogueVoPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProductToLabel(Integer productId) {
|
||||
HashMap<String, Object> flag = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user