| | |
| | | package com.oying.modules.pc.product.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.oying.exception.EntityNotFoundException; |
| | | import com.oying.modules.pc.product.domain.Product; |
| | | import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria; |
| | | import com.oying.modules.pc.product.mapper.ProductMapper; |
| | |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.PageUtil; |
| | | import com.oying.utils.SecurityUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author lzp |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Product getProduct(Long productId) { |
| | | Product existingProduct = getById(productId); |
| | | if (ObjUtil.isEmpty(existingProduct)) { |
| | | throw new EntityNotFoundException(Product.class, "id", Optional.ofNullable(productId).map(Object::toString).orElse("null")); |
| | | } |
| | | return existingProduct; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Product resources) { |
| | | resources.setCreateBy(SecurityUtils.getCurrentUserId()); |
| | | productMapper.insert(resources); |
| | | } |
| | | |
| | |
| | | public void update(Product resources) { |
| | | Product product = getById(resources.getProductId()); |
| | | product.copy(resources); |
| | | product.setUpdateBy(SecurityUtils.getCurrentUserId()); |
| | | productMapper.updateById(product); |
| | | } |
| | | |
| | |
| | | map.put("商品名称", product.getName()); |
| | | map.put("商品标题", product.getTitle()); |
| | | map.put("分类ID", product.getCategoryId()); |
| | | map.put("状态:1000-草稿 1001上架 1002下架", product.getStatus()); |
| | | map.put("主图片", product.getMainImage()); |
| | | map.put("详情图片", product.getDetailImage()); |
| | | map.put("状态", product.getStatus()); |
| | | map.put("主图片", product.getMainImageId()); |
| | | map.put("主图地址", product.getMainImageUrl()); |
| | | map.put("商品描述", product.getDescription()); |
| | | map.put("销售价格", product.getPrice()); |
| | | map.put("库存数量", product.getStockQuantity()); |