Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.MainAdEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MainAdService extends IService<MainAdEntity> {
|
||||
|
||||
List<MainAdEntity> getMainAdList();
|
||||
|
||||
MainAdEntity getMainAdDetail(int id);
|
||||
}
|
||||
@@ -57,5 +57,7 @@ public interface ShopProductService extends IService<ShopProduct> {
|
||||
|
||||
R unbindProductAndCourse(int productId,int catalogueId);
|
||||
|
||||
Page<ShopProduct> getProductForApp(int type,int page,int limit,String keywords);
|
||||
|
||||
R delShopProduct(int productId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MainAdDao;
|
||||
import com.peanut.modules.common.dao.ShopProductDao;
|
||||
import com.peanut.modules.common.entity.MainAdEntity;
|
||||
import com.peanut.modules.master.service.MainAdService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterMainAdService")
|
||||
public class MainAdServiceImpl extends ServiceImpl<MainAdDao, MainAdEntity> implements MainAdService {
|
||||
|
||||
@Autowired
|
||||
private ShopProductDao shopProductDao;
|
||||
|
||||
@Override
|
||||
public List<MainAdEntity> getMainAdList() {
|
||||
List<MainAdEntity> list = this.list();
|
||||
for (MainAdEntity m :list){
|
||||
if (m.getType()==0){
|
||||
m.setShopProduct(shopProductDao.selectById(m.getRelationId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MainAdEntity getMainAdDetail(int id) {
|
||||
MainAdEntity info = this.getById(id);
|
||||
if(info.getType()==0){
|
||||
info.setShopProduct(shopProductDao.selectById(info.getRelationId()));
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@@ -300,6 +300,24 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopProduct> getProductForApp(int type, int page, int limit,String keywords) {
|
||||
String sql = "";
|
||||
if(type==0){//疯子读书
|
||||
sql = "select * from shop_product_to_book_market where product_id = shop_product.product_id";
|
||||
} else if (type==1) {//吴门医述
|
||||
sql = "select * from shop_product_to_medicine_market where product_id = shop_product.product_id";
|
||||
}else{
|
||||
sql = "select * from shop_product_to_sociology_market where product_id = shop_product.product_id";
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.exists(sql);
|
||||
wrapper.like(StringUtils.isNotBlank(keywords),ShopProduct::getProductName,keywords);
|
||||
Page<ShopProduct> shopProductPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
return shopProductPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProductToLabel(Integer productId) {
|
||||
HashMap<String, Object> flag = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user