src/main/java/service/ProductService.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package service;

import mapper.*;
import model.*;
import model.Propertyvalue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService implements ProductInt {
    @Autowired
    ProductMapper productMapper;
    @Autowired
    ProductimageMapper productimageMapper;
    @Autowired
    OrderitemMapper orderitemMapper;
    @Autowired
    OrderMapper orderMapper;
    @Autowired
    ReviewMapper reviewMapper;
    @Autowired
    UserMapper userMapper;
    @Autowired
    PropertyMapper propertyMapper;
    @Autowired
    CategoryMapper categoryMapper;
    @Autowired
    PropertyvalueMapper propertyvalueMapper;
    @Override
    public Product getProduct(Integer id){
        List<Productimage> productSingleImages = productimageMapper.list(id, "type_single");
        List<Productimage> productDetailImages = productimageMapper.list(id, "type_detail");
        Product p = productMapper.selectByPrimaryKey(id);
        p.setProductSingleImages(productSingleImages);
        p.setProductDetailImages(productDetailImages);
        p.setReviewCount(reviewMapper.countByPid(id));
        p.setSaleCount(orderitemMapper.countByPid(id));
        p.setFirstProductImage(productimageMapper.selectOneByPid(id));
        p.setReviewCount(reviewMapper.countByPid(p.getId()));
        p.setCategory(categoryMapper.selectByPrimaryKey(p.getCid()));
        return p;
    }
    @Override
    public void update(Product product){
        productMapper.updateByPrimaryKey(product);
    }
    @Override
    public void insert(Product product){
        productMapper.insert(product);
    }
    @Override
    public void delete(int id){
        productMapper.deleteByPrimaryKey(id);
    }
    @Override
    public List<Product> listProducts(int cid){
        List<Product> ps = productMapper.selectByCid(cid);
        return getProducts(ps);
后面还有 55 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。