步骤 2 : 模仿和排错 步骤 3 : 界面效果 步骤 4 : 评价产品页面 步骤 5 : 提交评价
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,565个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,565个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,565个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,565个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@GetMapping("forereview")
public Object review(int oid) {
Order o = orderService.get(oid);
orderItemService.fill(o);
orderService.removeOrderFromOrderItem(o);
Product p = o.getOrderItems().get(0).getProduct();
List<Review> reviews = reviewService.list(p);
productService.setSaleAndReviewNumber(p);
Map<String,Object> map = new HashMap<>();
map.put("p", p);
map.put("o", o);
map.put("reviews", reviews);
return Result.success(map);
}
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/fore/header::html" ></head>
<body>
<div id="workingArea">
<div th:replace="include/fore/top::html" ></div>
<div th:replace="include/fore/simpleSearch::html" ></div>
<div th:replace="include/fore/cart/reviewPage::html" ></div>
<div th:replace="include/fore/footer::html" ></div>
</div>
</body>
</html>
<div th:fragment="html">
<script>
$(function(){
var oid = getUrlParms("oid");
var data4Vue = {
uri:'forereview',
orders:[],
p:'',
o:null,
reviews:[],
showReviews:false,
content:''
};
//ViewModel
var vue = new Vue({
el: '#workingArea',
data: data4Vue,
mounted:function(){ //mounted 表示这个 Vue 对象加载成功了
this.load();
},
methods: {
load:function(){
var url = this.uri+"?oid="+oid;
axios.get(url).then(function(response) {
var result = response.data;
vue.p = result.data.p;
vue.o = result.data.o;
vue.reviews = result.data.reviews;
vue.$nextTick(function(){
linkDefaultActions();
})
});
},
doreview:function(){
var url = "foredoreview?oid="+vue.o.id+"&pid="+vue.p.id+"&content="+vue.content;
axios.post(url).then(function(response) {
var result = response.data;
vue.showReviews = true;
vue.load();
});
}
}
});
})
</script>
<div class="reviewDiv">
<div class="reviewProductInfoDiv">
<div class="reviewProductInfoImg"><img v-if="null!=p.firstProductImage" width="400px" height="400px" :src="'img/productSingle/'+p.firstProductImage.id+'.jpg'"></div>
<div class="reviewProductInfoRightDiv">
<div class="reviewProductInfoRightText">
{{p.name}}
</div>
<table class="reviewProductInfoTable">
<tr>
<td width="75px">价格:</td>
<td><span class="reviewProductInfoTablePrice">¥{{p.originalPrice|formatMoneyFilter}}</span> 元 </td>
</tr>
<tr>
<td>配送</td>
<td>快递: 0.00</td>
</tr>
<tr>
<td>月销量:</td>
<td><span class="reviewProductInfoTableSellNumber">{{p.saleCount}}</span> 件</td>
</tr>
</table>
<div class="reviewProductInfoRightBelowDiv">
<span class="reviewProductInfoRightBelowImg"><img1 src="img/site/reviewLight.png"></span>
<span v-if="null!=o" class="reviewProductInfoRightBelowText" >现在查看的是 您所购买商品的信息
于 {{o.createDate | formatDateFilter('YYYY-MM-DD')}} 下单购买了此商品 </span>
</div>
</div>
<div style="clear:both"></div>
</div>
<div class="reviewStasticsDiv">
<div class="reviewStasticsLeft">
<div class="reviewStasticsLeftTop"></div>
<div class="reviewStasticsLeftContent">累计评价 <span class="reviewStasticsNumber"> {{p.reviewCount}}</span></div>
<div class="reviewStasticsLeftFoot"></div>
</div>
<div class="reviewStasticsRight">
<div class="reviewStasticsRightEmpty"></div>
<div class="reviewStasticsFoot"></div>
</div>
</div>
<div v-show="showReviews" class="reviewDivlistReviews">
<div v-for="r in reviews" class="reviewDivlistReviewsEach">
<div class="reviewDate">{{r.createDate| formatDateFilter}}</div>
<div class="reviewContent">{{r.content}}</div>
<div class="reviewUserInfo pull-right">{{r.user.anonymousName}}<span class="reviewUserInfoAnonymous">(匿名)</span></div>
</div>
</div>
<div v-show="!showReviews" class="makeReviewDiv">
<div class="makeReviewText">其他买家,需要你的建议哦!</div>
<table class="makeReviewTable">
<tr>
<td class="makeReviewTableFirstTD">评价商品</td>
<td><textarea v-model="content"></textarea></td>
</tr>
</table>
<div class="makeReviewButtonDiv">
<button @click="doreview" type="submit">提交评价</button>
</div>
</div>
</div>
</div>
package com.how2java.tmall.web;
import com.how2java.tmall.comparator.*;
import com.how2java.tmall.pojo.*;
import com.how2java.tmall.service.*;
import com.how2java.tmall.util.Result;
import org.apache.commons.lang.math.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.HtmlUtils;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
public class ForeRESTController {
@Autowired
CategoryService categoryService;
@Autowired
ProductService productService;
@Autowired
UserService userService;
@Autowired
ProductImageService productImageService;
@Autowired
PropertyValueService propertyValueService;
@Autowired
OrderItemService orderItemService;
@Autowired
ReviewService reviewService;
@Autowired
OrderService orderService;
@GetMapping("/forehome")
public Object home() {
List<Category> cs= categoryService.list();
productService.fill(cs);
productService.fillByRow(cs);
categoryService.removeCategoryFromProduct(cs);
return cs;
}
@PostMapping("/foreregister")
public Object register(@RequestBody User user) {
String name = user.getName();
String password = user.getPassword();
name = HtmlUtils.htmlEscape(name);
user.setName(name);
boolean exist = userService.isExist(name);
if(exist){
String message ="用户名已经被使用,不能使用";
return Result.fail(message);
}
user.setPassword(password);
userService.add(user);
return Result.success();
}
@PostMapping("/forelogin")
public Object login(@RequestBody User userParam, HttpSession session) {
String name = userParam.getName();
name = HtmlUtils.htmlEscape(name);
User user =userService.get(name,userParam.getPassword());
if(null==user){
String message ="账号密码错误";
return Result.fail(message);
}
else{
session.setAttribute("user", user);
return Result.success();
}
}
@GetMapping("/foreproduct/{pid}")
public Object product(@PathVariable("pid") int pid) {
Product product = productService.get(pid);
List<ProductImage> productSingleImages = productImageService.listSingleProductImages(product);
List<ProductImage> productDetailImages = productImageService.listDetailProductImages(product);
product.setProductSingleImages(productSingleImages);
product.setProductDetailImages(productDetailImages);
List<PropertyValue> pvs = propertyValueService.list(product);
List<Review> reviews = reviewService.list(product);
productService.setSaleAndReviewNumber(product);
productImageService.setFirstProdutImage(product);
Map<String,Object> map= new HashMap<>();
map.put("product", product);
map.put("pvs", pvs);
map.put("reviews", reviews);
return Result.success(map);
}
@GetMapping("forecheckLogin")
public Object checkLogin( HttpSession session) {
User user =(User) session.getAttribute("user");
if(null!=user)
return Result.success();
return Result.fail("未登录");
}
@GetMapping("forecategory/{cid}")
public Object category(@PathVariable int cid,String sort) {
Category c = categoryService.get(cid);
productService.fill(c);
productService.setSaleAndReviewNumber(c.getProducts());
categoryService.removeCategoryFromProduct(c);
if(null!=sort){
switch(sort){
case "review":
Collections.sort(c.getProducts(),new ProductReviewComparator());
break;
case "date" :
Collections.sort(c.getProducts(),new ProductDateComparator());
break;
case "saleCount" :
Collections.sort(c.getProducts(),new ProductSaleCountComparator());
break;
case "price":
Collections.sort(c.getProducts(),new ProductPriceComparator());
break;
case "all":
Collections.sort(c.getProducts(),new ProductAllComparator());
break;
}
}
return c;
}
@PostMapping("foresearch")
public Object search( String keyword){
if(null==keyword)
keyword = "";
List<Product> ps= productService.search(keyword,0,20);
productImageService.setFirstProdutImages(ps);
productService.setSaleAndReviewNumber(ps);
return ps;
}
@GetMapping("forebuyone")
public Object buyone(int pid, int num, HttpSession session) {
return buyoneAndAddCart(pid,num,session);
}
private int buyoneAndAddCart(int pid, int num, HttpSession session) {
Product product = productService.get(pid);
int oiid = 0;
User user =(User) session.getAttribute("user");
boolean found = false;
List<OrderItem> ois = orderItemService.listByUser(user);
for (OrderItem oi : ois) {
if(oi.getProduct().getId()==product.getId()){
oi.setNumber(oi.getNumber()+num);
orderItemService.update(oi);
found = true;
oiid = oi.getId();
break;
}
}
if(!found){
OrderItem oi = new OrderItem();
oi.setUser(user);
oi.setProduct(product);
oi.setNumber(num);
orderItemService.add(oi);
oiid = oi.getId();
}
return oiid;
}
@GetMapping("forebuy")
public Object buy(String[] oiid,HttpSession session){
List<OrderItem> orderItems = new ArrayList<>();
float total = 0;
for (String strid : oiid) {
int id = Integer.parseInt(strid);
OrderItem oi= orderItemService.get(id);
total +=oi.getProduct().getPromotePrice()*oi.getNumber();
orderItems.add(oi);
}
productImageService.setFirstProdutImagesOnOrderItems(orderItems);
session.setAttribute("ois", orderItems);
Map<String,Object> map = new HashMap<>();
map.put("orderItems", orderItems);
map.put("total", total);
return Result.success(map);
}
@GetMapping("foreaddCart")
public Object addCart(int pid, int num, HttpSession session) {
buyoneAndAddCart(pid,num,session);
return Result.success();
}
@GetMapping("forecart")
public Object cart(HttpSession session) {
User user =(User) session.getAttribute("user");
List<OrderItem> ois = orderItemService.listByUser(user);
productImageService.setFirstProdutImagesOnOrderItems(ois);
return ois;
}
@GetMapping("forechangeOrderItem")
public Object changeOrderItem( HttpSession session, int pid, int num) {
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
List<OrderItem> ois = orderItemService.listByUser(user);
for (OrderItem oi : ois) {
if(oi.getProduct().getId()==pid){
oi.setNumber(num);
orderItemService.update(oi);
break;
}
}
return Result.success();
}
@GetMapping("foredeleteOrderItem")
public Object deleteOrderItem(HttpSession session,int oiid){
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
orderItemService.delete(oiid);
return Result.success();
}
@PostMapping("forecreateOrder")
public Object createOrder(@RequestBody Order order,HttpSession session){
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000);
order.setOrderCode(orderCode);
order.setCreateDate(new Date());
order.setUser(user);
order.setStatus(OrderService.waitPay);
List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois");
float total =orderService.add(order,ois);
Map<String,Object> map = new HashMap<>();
map.put("oid", order.getId());
map.put("total", total);
return Result.success(map);
}
@GetMapping("forepayed")
public Object payed(int oid) {
Order order = orderService.get(oid);
order.setStatus(OrderService.waitDelivery);
order.setPayDate(new Date());
orderService.update(order);
return order;
}
@GetMapping("forebought")
public Object bought(HttpSession session) {
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
List<Order> os= orderService.listByUserWithoutDelete(user);
orderService.removeOrderFromOrderItem(os);
return os;
}
@GetMapping("foreconfirmPay")
public Object confirmPay(int oid) {
Order o = orderService.get(oid);
orderItemService.fill(o);
orderService.cacl(o);
orderService.removeOrderFromOrderItem(o);
return o;
}
@GetMapping("foreorderConfirmed")
public Object orderConfirmed( int oid) {
Order o = orderService.get(oid);
o.setStatus(OrderService.waitReview);
o.setConfirmDate(new Date());
orderService.update(o);
return Result.success();
}
@PutMapping("foredeleteOrder")
public Object deleteOrder(int oid){
Order o = orderService.get(oid);
o.setStatus(OrderService.delete);
orderService.update(o);
return Result.success();
}
@GetMapping("forereview")
public Object review(int oid) {
Order o = orderService.get(oid);
orderItemService.fill(o);
orderService.removeOrderFromOrderItem(o);
Product p = o.getOrderItems().get(0).getProduct();
List<Review> reviews = reviewService.list(p);
productService.setSaleAndReviewNumber(p);
Map<String,Object> map = new HashMap<>();
map.put("p", p);
map.put("o", o);
map.put("reviews", reviews);
return Result.success(map);
}
}
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,565个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@PostMapping("foredoreview")
public Object doreview( HttpSession session,int oid,int pid,String content) {
Order o = orderService.get(oid);
o.setStatus(OrderService.finish);
orderService.update(o);
Product p = productService.get(pid);
content = HtmlUtils.htmlEscape(content);
User user =(User) session.getAttribute("user");
Review review = new Review();
review.setContent(content);
review.setProduct(p);
review.setCreateDate(new Date());
review.setUser(user);
reviewService.add(review);
return Result.success();
}
doreview:function(){
var url = "foredoreview?oid="+vue.o.id+"&pid="+vue.p.id+"&content="+vue.content;
axios.post(url).then(function(response) {
var result = response.data;
vue.showReviews = true;
vue.load();
});
}
package com.how2java.tmall.web;
import com.how2java.tmall.comparator.*;
import com.how2java.tmall.pojo.*;
import com.how2java.tmall.service.*;
import com.how2java.tmall.util.Result;
import org.apache.commons.lang.math.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.HtmlUtils;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
public class ForeRESTController {
@Autowired
CategoryService categoryService;
@Autowired
ProductService productService;
@Autowired
UserService userService;
@Autowired
ProductImageService productImageService;
@Autowired
PropertyValueService propertyValueService;
@Autowired
OrderItemService orderItemService;
@Autowired
ReviewService reviewService;
@Autowired
OrderService orderService;
@GetMapping("/forehome")
public Object home() {
List<Category> cs= categoryService.list();
productService.fill(cs);
productService.fillByRow(cs);
categoryService.removeCategoryFromProduct(cs);
return cs;
}
@PostMapping("/foreregister")
public Object register(@RequestBody User user) {
String name = user.getName();
String password = user.getPassword();
name = HtmlUtils.htmlEscape(name);
user.setName(name);
boolean exist = userService.isExist(name);
if(exist){
String message ="用户名已经被使用,不能使用";
return Result.fail(message);
}
user.setPassword(password);
userService.add(user);
return Result.success();
}
@PostMapping("/forelogin")
public Object login(@RequestBody User userParam, HttpSession session) {
String name = userParam.getName();
name = HtmlUtils.htmlEscape(name);
User user =userService.get(name,userParam.getPassword());
if(null==user){
String message ="账号密码错误";
return Result.fail(message);
}
else{
session.setAttribute("user", user);
return Result.success();
}
}
@GetMapping("/foreproduct/{pid}")
public Object product(@PathVariable("pid") int pid) {
Product product = productService.get(pid);
List<ProductImage> productSingleImages = productImageService.listSingleProductImages(product);
List<ProductImage> productDetailImages = productImageService.listDetailProductImages(product);
product.setProductSingleImages(productSingleImages);
product.setProductDetailImages(productDetailImages);
List<PropertyValue> pvs = propertyValueService.list(product);
List<Review> reviews = reviewService.list(product);
productService.setSaleAndReviewNumber(product);
productImageService.setFirstProdutImage(product);
Map<String,Object> map= new HashMap<>();
map.put("product", product);
map.put("pvs", pvs);
map.put("reviews", reviews);
return Result.success(map);
}
@GetMapping("forecheckLogin")
public Object checkLogin( HttpSession session) {
User user =(User) session.getAttribute("user");
if(null!=user)
return Result.success();
return Result.fail("未登录");
}
@GetMapping("forecategory/{cid}")
public Object category(@PathVariable int cid,String sort) {
Category c = categoryService.get(cid);
productService.fill(c);
productService.setSaleAndReviewNumber(c.getProducts());
categoryService.removeCategoryFromProduct(c);
if(null!=sort){
switch(sort){
case "review":
Collections.sort(c.getProducts(),new ProductReviewComparator());
break;
case "date" :
Collections.sort(c.getProducts(),new ProductDateComparator());
break;
case "saleCount" :
Collections.sort(c.getProducts(),new ProductSaleCountComparator());
break;
case "price":
Collections.sort(c.getProducts(),new ProductPriceComparator());
break;
case "all":
Collections.sort(c.getProducts(),new ProductAllComparator());
break;
}
}
return c;
}
@PostMapping("foresearch")
public Object search( String keyword){
if(null==keyword)
keyword = "";
List<Product> ps= productService.search(keyword,0,20);
productImageService.setFirstProdutImages(ps);
productService.setSaleAndReviewNumber(ps);
return ps;
}
@GetMapping("forebuyone")
public Object buyone(int pid, int num, HttpSession session) {
return buyoneAndAddCart(pid,num,session);
}
private int buyoneAndAddCart(int pid, int num, HttpSession session) {
Product product = productService.get(pid);
int oiid = 0;
User user =(User) session.getAttribute("user");
boolean found = false;
List<OrderItem> ois = orderItemService.listByUser(user);
for (OrderItem oi : ois) {
if(oi.getProduct().getId()==product.getId()){
oi.setNumber(oi.getNumber()+num);
orderItemService.update(oi);
found = true;
oiid = oi.getId();
break;
}
}
if(!found){
OrderItem oi = new OrderItem();
oi.setUser(user);
oi.setProduct(product);
oi.setNumber(num);
orderItemService.add(oi);
oiid = oi.getId();
}
return oiid;
}
@GetMapping("forebuy")
public Object buy(String[] oiid,HttpSession session){
List<OrderItem> orderItems = new ArrayList<>();
float total = 0;
for (String strid : oiid) {
int id = Integer.parseInt(strid);
OrderItem oi= orderItemService.get(id);
total +=oi.getProduct().getPromotePrice()*oi.getNumber();
orderItems.add(oi);
}
productImageService.setFirstProdutImagesOnOrderItems(orderItems);
session.setAttribute("ois", orderItems);
Map<String,Object> map = new HashMap<>();
map.put("orderItems", orderItems);
map.put("total", total);
return Result.success(map);
}
@GetMapping("foreaddCart")
public Object addCart(int pid, int num, HttpSession session) {
buyoneAndAddCart(pid,num,session);
return Result.success();
}
@GetMapping("forecart")
public Object cart(HttpSession session) {
User user =(User) session.getAttribute("user");
List<OrderItem> ois = orderItemService.listByUser(user);
productImageService.setFirstProdutImagesOnOrderItems(ois);
return ois;
}
@GetMapping("forechangeOrderItem")
public Object changeOrderItem( HttpSession session, int pid, int num) {
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
List<OrderItem> ois = orderItemService.listByUser(user);
for (OrderItem oi : ois) {
if(oi.getProduct().getId()==pid){
oi.setNumber(num);
orderItemService.update(oi);
break;
}
}
return Result.success();
}
@GetMapping("foredeleteOrderItem")
public Object deleteOrderItem(HttpSession session,int oiid){
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
orderItemService.delete(oiid);
return Result.success();
}
@PostMapping("forecreateOrder")
public Object createOrder(@RequestBody Order order,HttpSession session){
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000);
order.setOrderCode(orderCode);
order.setCreateDate(new Date());
order.setUser(user);
order.setStatus(OrderService.waitPay);
List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois");
float total =orderService.add(order,ois);
Map<String,Object> map = new HashMap<>();
map.put("oid", order.getId());
map.put("total", total);
return Result.success(map);
}
@GetMapping("forepayed")
public Object payed(int oid) {
Order order = orderService.get(oid);
order.setStatus(OrderService.waitDelivery);
order.setPayDate(new Date());
orderService.update(order);
return order;
}
@GetMapping("forebought")
public Object bought(HttpSession session) {
User user =(User) session.getAttribute("user");
if(null==user)
return Result.fail("未登录");
List<Order> os= orderService.listByUserWithoutDelete(user);
orderService.removeOrderFromOrderItem(os);
return os;
}
@GetMapping("foreconfirmPay")
public Object confirmPay(int oid) {
Order o = orderService.get(oid);
orderItemService.fill(o);
orderService.cacl(o);
orderService.removeOrderFromOrderItem(o);
return o;
}
@GetMapping("foreorderConfirmed")
public Object orderConfirmed( int oid) {
Order o = orderService.get(oid);
o.setStatus(OrderService.waitReview);
o.setConfirmDate(new Date());
orderService.update(o);
return Result.success();
}
@PutMapping("foredeleteOrder")
public Object deleteOrder(int oid){
Order o = orderService.get(oid);
o.setStatus(OrderService.delete);
orderService.update(o);
return Result.success();
}
@GetMapping("forereview")
public Object review(int oid) {
Order o = orderService.get(oid);
orderItemService.fill(o);
orderService.removeOrderFromOrderItem(o);
Product p = o.getOrderItems().get(0).getProduct();
List<Review> reviews = reviewService.list(p);
productService.setSaleAndReviewNumber(p);
Map<String,Object> map = new HashMap<>();
map.put("p", p);
map.put("o", o);
map.put("reviews", reviews);
return Result.success(map);
}
@PostMapping("foredoreview")
public Object doreview( HttpSession session,int oid,int pid,String content) {
Order o = orderService.get(oid);
o.setStatus(OrderService.finish);
orderService.update(o);
Product p = productService.get(pid);
content = HtmlUtils.htmlEscape(content);
User user =(User) session.getAttribute("user");
Review review = new Review();
review.setContent(content);
review.setProduct(p);
review.setCreateDate(new Date());
review.setUser(user);
reviewService.add(review);
return Result.success();
}
}
HOW2J公众号,关注后实时获知最新的教程和优惠活动,谢谢。
问答区域
2024-06-04
添加评价,为何不使用事务??
回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
2021-07-13
大佬大佬我问个基础的知识点
1 个答案
how2j 跳转到问题位置 答案时间:2021-07-27 这个知识点是jquery的选择器:https://how2j.cn/k/jquery/jquery-selector/468.html#step976
+ 是字符串连接符
回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
2021-03-10
评论类里面有user对象,会不会把密码还有盐也一同封装返回去了。例如 r.user.getPassword
2021-02-18
有一个bug
2020-08-24
关于打包成jar fontawesome图标不显示的问题
提问太多,页面渲染太慢,为了加快渲染速度,本页最多只显示几条提问。还有 15 条以前的提问,请 点击查看
提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
|