src/main/java/com/byh/biyesheji/controller/ReviewController.java
(完整代码) 1KBpackage com.byh.biyesheji.controller;
import com.byh.biyesheji.pojo.Customer;
import com.byh.biyesheji.pojo.Review;
import com.byh.biyesheji.service.ProductService;
import com.byh.biyesheji.service.ReviewService;
import com.byh.biyesheji.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* 评论模块controller
*/
@Controller
@RequestMapping("/review")
public class ReviewController {
@Autowired
private ReviewService reviewService;
@Autowired
private ProductService productService;
@RequestMapping("/list")
public String list(Model model, Page page){
PageHelper.offsetPage(page.getStart(),page.getCount());//分页查询
List<Review> list= reviewService.list();
int total = (int) new PageInfo<>(list).getTotal();//总条数
page.setTotal(total);
model.addAttribute("totals",list.size());
model.addAttribute("list",list);
return "pinglunpage/pinglun";
}
@RequestMapping("/del")
public String del(int id){
reviewService.del(id);
return "redirect:list";
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。