perf(商城): 下单流程

代码优化
master
hequan_waynaqua 4 years ago
parent b9e01b2d1d
commit 75ad6be14e

@ -65,14 +65,10 @@ public class BaseController {
Page<T> tPage = new Page<>(pageNumber, pageSize); Page<T> tPage = new Page<>(pageNumber, pageSize);
if (StringUtils.isNotEmpty(sortName)) { if (StringUtils.isNotEmpty(sortName)) {
String[] split = sortName.split(","); String[] split = sortName.split(",");
for (int i = 0; i < split.length; i++) { for (String s : split) {
OrderItem orderItem = new OrderItem(); OrderItem orderItem = new OrderItem();
orderItem.setColumn(split[i].replaceAll("[A-Z]", "_$0").toLowerCase()); orderItem.setColumn(s.replaceAll("[A-Z]", "_$0").toLowerCase());
if (sortOrder != null && sortOrder.startsWith(Constants.ORDER_DESC)) { orderItem.setAsc(sortOrder == null || !sortOrder.startsWith(Constants.ORDER_DESC));
orderItem.setAsc(false);
} else {
orderItem.setAsc(true);
}
tPage.addOrder(orderItem); tPage.addOrder(orderItem);
} }
} }
@ -105,7 +101,7 @@ public class BaseController {
* @return * @return
*/ */
protected <T> Page<T> getPage(int pageNumber, int pageSize) { protected <T> Page<T> getPage(int pageNumber, int pageSize) {
return new Page<T>(pageNumber, pageSize); return new Page<>(pageNumber, pageSize);
} }
/** /**
@ -132,9 +128,7 @@ public class BaseController {
* @return * @return
*/ */
protected String redirectTo(String url) { protected String redirectTo(String url) {
StringBuffer rto = new StringBuffer("redirect:"); return "redirect:" + url;
rto.append(url);
return rto.toString();
} }
/** /**

Loading…
Cancel
Save