how2j.cn

下载区
文件名 文件大小
请先登录 445k
增值内容 445k
445k
使用站长秘制下载工具
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 我的订单页   
步骤 4 : OrderDAO   
步骤 5 : OrderService   
步骤 6 : bought.html   
步骤 7 : boughtPage.html   
步骤 8 : modal4deleteConfirm.html   
步骤 9 : ForeRESTController.bought()   

步骤 1 :

先运行,看到效果,再学习

edit
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
我的订单页
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package com.how2java.tmall.dao; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.how2java.tmall.pojo.Order; import com.how2java.tmall.pojo.User; public interface OrderDAO extends JpaRepository<Order,Integer>{ public List<Order> findByUserAndStatusNotOrderByIdDesc(User user, String status); }
package com.how2java.tmall.dao;
 
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;

import com.how2java.tmall.pojo.Order;
import com.how2java.tmall.pojo.User;

public interface OrderDAO extends JpaRepository<Order,Integer>{
    public List<Order> findByUserAndStatusNotOrderByIdDesc(User user, String status);
}
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package com.how2java.tmall.service; import com.how2java.tmall.dao.OrderDAO; import com.how2java.tmall.pojo.Order; import com.how2java.tmall.pojo.OrderItem; import com.how2java.tmall.pojo.User; import com.how2java.tmall.util.Page4Navigator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service public class OrderService { public static final String waitPay = "waitPay"; public static final String waitDelivery = "waitDelivery"; public static final String waitConfirm = "waitConfirm"; public static final String waitReview = "waitReview"; public static final String finish = "finish"; public static final String delete = "delete"; @Autowired OrderDAO orderDAO; @Autowired OrderItemService orderItemService; public Page4Navigator<Order> list(int start, int size, int navigatePages) { Sort sort = new Sort(Sort.Direction.DESC, "id"); Pageable pageable = new PageRequest(start, size,sort); Page pageFromJPA =orderDAO.findAll(pageable); return new Page4Navigator<>(pageFromJPA,navigatePages); } public void removeOrderFromOrderItem(List<Order> orders) { for (Order order : orders) { removeOrderFromOrderItem(order); } } private void removeOrderFromOrderItem(Order order) { List<OrderItem> orderItems= order.getOrderItems(); for (OrderItem orderItem : orderItems) { orderItem.setOrder(null); } } public Order get(int oid) { return orderDAO.findOne(oid); } public void update(Order bean) { orderDAO.save(bean); } @Transactional(propagation= Propagation.REQUIRED,rollbackForClassName="Exception") public float add(Order order, List<OrderItem> ois) { float total = 0; add(order); if(false) throw new RuntimeException(); for (OrderItem oi: ois) { oi.setOrder(order); orderItemService.update(oi); total+=oi.getProduct().getPromotePrice()*oi.getNumber(); } return total; } public void add(Order order) { orderDAO.save(order); } public List<Order> listByUserWithoutDelete(User user) { List<Order> orders = listByUserAndNotDeleted(user); orderItemService.fill(orders); return orders; } public List<Order> listByUserAndNotDeleted(User user) { return orderDAO.findByUserAndStatusNotOrderByIdDesc(user, OrderService.delete); } }
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
<!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/boughtPage::html" ></div> <div th:replace="include/fore/modal4deleteConfirm::html" ></div> <div th:replace="include/fore/footer::html" ></div> </div> </body> </html>
<!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/boughtPage::html" ></div>	
			<div th:replace="include/fore/modal4deleteConfirm::html" ></div>
			<div th:replace="include/fore/footer::html" ></div>	
		</div>
	</body>
</html>
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
boughtPage.html
<div th:fragment="html"> <script> $(function(){ var data4Vue = { uri:'forebought', orders:[] }; //ViewModel var vue = new Vue({ el: '#workingArea', data: data4Vue, mounted:function(){ //mounted 表示这个 Vue 对象加载成功了 this.load(); }, methods: { load:function(){ var url = this.uri; axios.get(url).then(function(response) { vue.orders = response.data; vue.$nextTick(function(){ linkDefaultActions(); orderPageRegisterListeners(); }) }); } } }); }) var deleteOrder = false; var deleteOrderid = 0; function orderPageRegisterListeners(){ $("a[orderStatus]").click(function(){ var orderStatus = $(this).attr("orderStatus"); if('all'==orderStatus){ $("table[orderStatus]").show(); } else{ $("table[orderStatus]").hide(); $("table[orderStatus="+orderStatus+"]").show(); } $("div.orderType div").removeClass("selectedOrderType"); $(this).parent("div").addClass("selectedOrderType"); }); $("a.deleteOrderLink").click(function(){ deleteOrderid = $(this).attr("oid"); deleteOrder = false; $("#deleteConfirmModal").modal("show"); }); $("button.deleteConfirmButton").click(function(){ deleteOrder = true; $("#deleteConfirmModal").modal('hide'); }); $('#deleteConfirmModal').on('hidden.bs.modal', function (e) { if(deleteOrder){ var uri = "foredeleteOrder?oid="+deleteOrderid; axios.put(uri).then(function(response){ if(0==response.data.code){ $("table.orderListItemTable[oid="+deleteOrderid+"]").hide(); } else{ location.href="login"; } }); } }) } </script> <div class="boughtDiv"> <div class="orderType"> <div class="selectedOrderType"><a orderStatus="all" href="#nowhere">所有订单</a></div> <div><a orderStatus="waitPay" href="#nowhere">待付款</a></div> <div><a orderStatus="waitDelivery" href="#nowhere">待发货</a></div> <div><a orderStatus="waitConfirm" href="#nowhere">待收货</a></div> <div><a orderStatus="waitReview" href="#nowhere" class="noRightborder">待评价</a></div> <div class="orderTypeLastOne"><a class="noRightborder"> </a></div> </div> <div style="clear:both"></div> <div class="orderListTitle"> <table class="orderListTitleTable"> <tr> <td>宝贝</td> <td width="100px">单价</td> <td width="100px">数量</td> <td width="120px">实付款</td> <td width="100px">交易操作</td> </tr> </table> </div> <div class="orderListItem"> <table v-for="o in orders" class="orderListItemTable" :orderStatus="o.status" :oid="o.id"> <tr class="orderListItemFirstTR"> <td colspan="2"> <b>{{o.createDate | formatDateFilter('YYYY-MM-DD') }}</b> <span>订单号: {{o.orderCode}} </span> </td> <td colspan="2"><img width="13px" src="img/site/orderItemTmall.png">天猫商场</td> <td colspan="1"> <a class="wangwanglink" href="#nowhere"> <div class="orderItemWangWangGif"></div> </a> </td> <td class="orderItemDeleteTD"> <a class="deleteOrderLink" :oid="o.id" href="#nowhere"> <span class="orderListItemDelete glyphicon glyphicon-trash"></span> </a> </td> </tr> <tr class="orderItemProductInfoPartTR" v-for="oi,index in o.orderItems" > <td class="orderItemProductInfoPartTD"><img width="80" height="80" :src="'img/productSingle_middle/'+oi.product.firstProductImage.id+'.jpg'"></td> <td class="orderItemProductInfoPartTD"> <div class="orderListItemProductLinkOutDiv"> <a :href="'product?pid='+oi.product.id">{{oi.product.name}}</a> <div class="orderListItemProductLinkInnerDiv"> <img src="img/site/creditcard.png" title="支持信用卡支付"> <img src="img/site/7day.png" title="消费者保障服务,承诺7天退货"> <img src="img/site/promise.png" title="消费者保障服务,承诺如实描述"> </div> </div> </td> <td class="orderItemProductInfoPartTD" width="100px"> <div class="orderListItemProductOriginalPrice">¥{{oi.product.originalPrice|formatMoneyFilter}}</div> <div class="orderListItemProductPrice">¥{{oi.product.promotePrice|formatMoneyFilter}}</div> </td> <template v-if="index==0"> <td valign="top" :rowspan="o.orderItems.length" class="orderListItemNumberTD orderItemOrderInfoPartTD" width="100px"> <span class="orderListItemNumber">{{o.totalNumber}}</span> </td> <td valign="top" :rowspan="o.orderItems.length" width="120px" class="orderListItemProductRealPriceTD orderItemOrderInfoPartTD"> <div class="orderListItemProductRealPrice">¥ {{o.total|formatMoneyFilter}}</div> <div class="orderListItemPriceWithTransport">(含运费:¥0.00)</div> </td> <td valign="top" :rowspan="o.orderItems.length" class="orderListItemButtonTD orderItemOrderInfoPartTD" width="100px"> <a v-if="o.status=='waitConfirm'" :href="'confirmPay?oid='+o.id"> <button class="orderListItemConfirm">确认收货</button> </a> <a v-if="o.status=='waitPay'" :href="'alipay?oid='+o.id+'&total='+o.total"> <button class="orderListItemConfirm">付款</button> </a> <div v-if="o.status=='waitDelivery'"> <span>待发货</span> </div> <a v-if="o.status=='waitReview'" :href="'review?oid='+o.id"> <button class="orderListItemReview">评价</button> </a> </td> </template> </tr> </table> </div> </div> </div>
步骤 8 :

modal4deleteConfirm.html

edit
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
<div th:fragment="html" > <div class="modal" id="deleteConfirmModal" tabindex="-1" role="dialog" > <div class="modal-dialog deleteConfirmModalDiv"> <div class="modal-content"> <div class="modal-header"> <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h4 class="modal-title">确认删除?</h4> </div> <div class="modal-footer"> <button data-dismiss="modal" class="btn btn-default" type="button">关闭</button> <button class="btn btn-primary deleteConfirmButton" id="submit" type="button">确认</button> </div> </div> </div> </div> </div>
<div th:fragment="html" >
	<div class="modal" id="deleteConfirmModal" tabindex="-1" role="dialog" >
			<div class="modal-dialog deleteConfirmModalDiv">
				<div class="modal-content">
					<div class="modal-header">
						<button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
						<h4 class="modal-title">确认删除?</h4>
					</div>
					<div class="modal-footer">
						<button data-dismiss="modal" class="btn btn-default" type="button">关闭</button>
						<button class="btn btn-primary deleteConfirmButton" id="submit" type="button">确认</button>
					</div>
				</div>
			</div>
		</div>
</div>
步骤 9 :

ForeRESTController.bought()

edit
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@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; }
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; } }


HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。


问答区域    
2019-02-24 boughtPage页面勘误
yohahahaha



商品的优惠价格Price少打一个e

							

							


1 个答案

how2j 答案时间:2019-02-25
哇,确实有这个问题呢,你是第一个发现的。 谢谢提醒,已经改正,下次上线就更新了。



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到





2019-01-20 我这里出现了问题,就是站长说的设置属性为null的问题
嗨heiheihei



以前productvalue productImage 把他相关的设置为null,没有报错,但是这里报了错,我按照这个页面所有流程都走了一片还是有问题,望站长帮忙看看!!
java.util.NoSuchElementException
	at java.util.ArrayList$Itr.next(ArrayList.java:854)
	at java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1042)
	at org.springframework.data.jpa.repository.query.CriteriaQueryParameterBinder.bind(CriteriaQueryParameterBinder.java:65)
	at org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:101)
	at org.springframework.data.jpa.repository.query.ParameterBinder.bindAndPrepare(ParameterBinder.java:161)
	at org.springframework.data.jpa.repository.query.ParameterBinder.bindAndPrepare(ParameterBinder.java:152)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.invokeBinding(PartTreeJpaQuery.java:236)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.createQuery(PartTreeJpaQuery.java:157)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.doCreateQuery(PartTreeJpaQuery.java:86)
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.createQuery(AbstractJpaQuery.java:190)
	at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:123)
	at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:87)
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:116)
	at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:106)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:499)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:477)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy103.findByOrderByIdDesc(Unknown Source)
	at com.how2java.tmall.service.OrderItemService.fill(OrderItemService.java:29)
	at com.how2java.tmall.service.OrderItemService.fill(OrderItemService.java:24)
	at com.how2java.tmall.service.OrderService.listByUserWithoutDelete(OrderService.java:79)
	at com.how2java.tmall.service.OrderService$$FastClassBySpringCGLIB$$d96d5723.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:669)
	at com.how2java.tmall.service.OrderService$$EnhancerBySpringCGLIB$$33b32b56.listByUserWithoutDelete(<generated>)
	at com.how2java.tmall.web.ForeRESTController.bought(ForeRESTController.java:278)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

							





回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到





2019-01-03 站长,TypeError: Cannot read property 'id' of null
2019-01-03 步骤4




提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-天猫整站Springboot-我的订单页 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 984886441
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: http://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图