--精选商品标签分类
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.dao.ShopProductLabelDao;
|
||||
import com.peanut.modules.book.entity.ShopProductLabelEntity;
|
||||
@@ -82,6 +83,27 @@ public class ShopProductLabelController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = shopProductToLabelService.queryPageproductSales(params);
|
||||
return R.ok().put("page", page);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/mytest")
|
||||
public R mytest(){
|
||||
|
||||
|
||||
@@ -85,6 +85,10 @@ public class ShopProudictBookController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UserEbookBuyController {
|
||||
@RequestMapping("/appbooklist")
|
||||
|
||||
public R appbooklist(@RequestParam("userId") Integer userId) {
|
||||
String user = String.valueOf(userId);
|
||||
String user = String.valueOf(userId);
|
||||
ArrayList<Object> maplist = new ArrayList<>();
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
|
||||
@@ -109,8 +109,6 @@ public class UserEbookBuyController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return R.ok().put("resultlist",maplist).put("total",index);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_to_label")
|
||||
@@ -23,4 +25,15 @@ public class ShopProductToLabelEntity {
|
||||
@TableField("del_flag")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 不存入数据库,返回商品详情
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductEntity> shopproudicts;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Object> shopp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@ package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.book.entity.ShopProductToLabelEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ShopProductToLabelService extends IService<ShopProductToLabelEntity> {
|
||||
PageUtils queryPageproductSales(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.ShopProductEntity;
|
||||
import com.peanut.modules.book.service.ShopProductService;
|
||||
import com.peanut.modules.book.vo.ShopCartVo;
|
||||
@@ -51,35 +52,41 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
|
||||
Integer productId = orderCartEntity.getProductId();
|
||||
|
||||
ShopProductEntity productEntity = shopProductService.getById(productId);
|
||||
// shopProductService.getBaseMapper().selectList()
|
||||
ShopCartVo shopCartVo = new ShopCartVo();
|
||||
System.out.println("productEntity=============================="+productEntity);
|
||||
// if (productEntity == null) {
|
||||
// return null;
|
||||
// } else {
|
||||
// shopProductService.getBaseMapper().selectList()
|
||||
ShopCartVo shopCartVo = new ShopCartVo();
|
||||
|
||||
BeanUtils.copyProperties(orderCartEntity, shopCartVo);
|
||||
BeanUtils.copyProperties(orderCartEntity, shopCartVo);
|
||||
|
||||
shopCartVo.setImage(productEntity.getProductImages());
|
||||
shopCartVo.setImage(productEntity.getProductImages());
|
||||
|
||||
shopCartVo.setProductName(productEntity.getProductName());
|
||||
shopCartVo.setProductName(productEntity.getProductName());
|
||||
|
||||
shopCartVo.setWeight(productEntity.getWeight().doubleValue());
|
||||
shopCartVo.setWeight(productEntity.getWeight().doubleValue());
|
||||
|
||||
shopCartVo.setProductStock(productEntity.getProductStock());
|
||||
shopCartVo.setProductStock(productEntity.getProductStock());
|
||||
// shopCartVo.setProudictBook(Integer.valueOf(productEntity.getBookId()));
|
||||
|
||||
BigDecimal activityPrice = productEntity.getActivityPrice();
|
||||
BigDecimal big = new BigDecimal(0);
|
||||
BigDecimal price=null;
|
||||
//activityPrice等于0,则原价
|
||||
if (activityPrice == big) {
|
||||
price = productEntity.getPrice();
|
||||
BigDecimal activityPrice = productEntity.getActivityPrice();
|
||||
BigDecimal big = new BigDecimal(0);
|
||||
BigDecimal price = null;
|
||||
//activityPrice等于0,则原价
|
||||
if (activityPrice == big) {
|
||||
price = productEntity.getPrice();
|
||||
|
||||
}else {
|
||||
price = productEntity.getActivityPrice();
|
||||
} else {
|
||||
price = productEntity.getActivityPrice();
|
||||
}
|
||||
shopCartVo.setActivityPrice(price);
|
||||
cartList.add(shopCartVo);
|
||||
}
|
||||
shopCartVo.setActivityPrice(price);
|
||||
cartList.add(shopCartVo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// }
|
||||
return cartList;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,59 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.book.dao.ShopProductToLabelDao;
|
||||
import com.peanut.modules.book.entity.ShopProductEntity;
|
||||
import com.peanut.modules.book.entity.ShopProductToLabelEntity;
|
||||
import com.peanut.modules.book.service.ShopProductService;
|
||||
import com.peanut.modules.book.service.ShopProductToLabelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("ShopProductToLabelService")
|
||||
public class ShopProductToLabelServiceImpl extends ServiceImpl<ShopProductToLabelDao, ShopProductToLabelEntity> implements ShopProductToLabelService {
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPageproductSales(Map<String, Object> params) {
|
||||
String splId = (String) params.get("splId");
|
||||
IPage<ShopProductToLabelEntity> page = this.page(
|
||||
new Query<ShopProductToLabelEntity>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<ShopProductToLabelEntity>()
|
||||
.orderByDesc("ptl_id").eq("spl_id",splId)
|
||||
|
||||
);
|
||||
//从分页查询结果中取出每条数据
|
||||
List<ShopProductToLabelEntity> records = page.getRecords();
|
||||
|
||||
|
||||
List<Object> objects = new ArrayList<>();
|
||||
//循环遍历ToLable 表数据取出
|
||||
for (ShopProductToLabelEntity shopProductToLabelEntity :records) {
|
||||
|
||||
Integer ptlId = shopProductToLabelEntity.getProductId();
|
||||
//找到对应的商品信息,放在Tolable空字段中进行返回
|
||||
List<ShopProductEntity> ShopProduct = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProductEntity>()
|
||||
.eq("del_flag", 0)
|
||||
.eq("product_id",ptlId)
|
||||
);
|
||||
|
||||
shopProductToLabelEntity.setShopproudicts(ShopProduct);
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user