src/main/java/com/byh/biyesheji/service/impl/ReviewServiceImpl.java
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.byh.biyesheji.service.impl;
import com.byh.biyesheji.dao.CustomerMapper;
import com.byh.biyesheji.dao.ProductMapper;
import com.byh.biyesheji.dao.ReviewMapper;
import com.byh.biyesheji.dao.UserMapper;
import com.byh.biyesheji.pojo.*;
import com.byh.biyesheji.service.ReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ReviewServiceImpl implements ReviewService {
@Autowired
private ReviewMapper reviewMapper;
@Autowired
private CustomerMapper customerMapper;
@Autowired
private ProductMapper productMapper;
@Override
public List<Review> list() {
List<Review> reviews = reviewMapper.selectByExample(null);
for (Review review:reviews){
Customer customer = customerMapper.selectByPrimaryKey(review.getCstid());
Product product = productMapper.selectByPrimaryKey(review.getPid());
review.setCustomer(customer);
review.setProduct(product);
}
return reviews;
}
@Override
public List<Review> getReviewListByPid(int id) {
ReviewExample example = new ReviewExample();
example.createCriteria().andPidEqualTo(id);
List<Review> reviews = reviewMapper.selectByExample(example);
for (Review review:reviews){
Customer customer = customerMapper.selectByPrimaryKey(review.getCstid());
review.setCustomer(customer);
}
return reviews;
}
@Override
public void del(int id) {
reviewMapper.deleteByPrimaryKey(id);
}
@Override
public Review get(int id) {
return reviewMapper.selectByPrimaryKey(id);
}
@Override
public void save(Review review) {
后面还有 3 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。