Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
3abfeea8
Commit
3abfeea8
authored
Jul 08, 2018
by
Junling Bu
Browse files
修复商品排序问题
parent
d2a561f3
Changes
45
Show whitespace changes
Inline
Side-by-side
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java
View file @
3abfeea8
...
@@ -32,8 +32,6 @@ public class WxCartController {
...
@@ -32,8 +32,6 @@ public class WxCartController {
private
LitemallGoodsSpecificationService
goodsSpecificationService
;
private
LitemallGoodsSpecificationService
goodsSpecificationService
;
@Autowired
@Autowired
private
LitemallAddressService
addressService
;
private
LitemallAddressService
addressService
;
@Autowired
private
LitemallCouponService
apiCouponService
;
/**
/**
* 购物车
* 购物车
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCommentController.java
View file @
3abfeea8
...
@@ -3,7 +3,6 @@ package org.linlinjava.litemall.wx.web;
...
@@ -3,7 +3,6 @@ package org.linlinjava.litemall.wx.web;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.linlinjava.litemall.db.domain.LitemallComment
;
import
org.linlinjava.litemall.db.domain.LitemallComment
;
import
org.linlinjava.litemall.db.service.LitemallCommentService
;
import
org.linlinjava.litemall.db.service.LitemallCommentService
;
import
org.linlinjava.litemall.db.service.LitemallCouponService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.db.service.LitemallUserService
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
...
@@ -26,8 +25,6 @@ public class WxCommentController {
...
@@ -26,8 +25,6 @@ public class WxCommentController {
@Autowired
@Autowired
private
LitemallUserService
userService
;
private
LitemallUserService
userService
;
@Autowired
@Autowired
private
LitemallCouponService
couponService
;
@Autowired
private
UserInfoService
userInfoService
;
private
UserInfoService
userInfoService
;
/**
/**
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGoodsController.java
View file @
3abfeea8
...
@@ -5,7 +5,6 @@ import org.apache.commons.logging.Log;
...
@@ -5,7 +5,6 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.service.*
;
import
org.linlinjava.litemall.db.service.*
;
import
org.linlinjava.litemall.db.util.SortUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -48,8 +47,6 @@ public class WxGoodsController {
...
@@ -48,8 +47,6 @@ public class WxGoodsController {
@Autowired
@Autowired
private
LitemallSearchHistoryService
searchHistoryService
;
private
LitemallSearchHistoryService
searchHistoryService
;
@Autowired
@Autowired
private
LitemallCouponService
apiCouponService
;
@Autowired
private
LitemallCartService
cartService
;
private
LitemallCartService
cartService
;
@Autowired
@Autowired
private
LitemallGoodsSpecificationService
goodsSpecificationService
;
private
LitemallGoodsSpecificationService
goodsSpecificationService
;
...
@@ -229,14 +226,12 @@ public class WxGoodsController {
...
@@ -229,14 +226,12 @@ public class WxGoodsController {
* 失败则 { errno: XXX, errmsg: XXX }
* 失败则 { errno: XXX, errmsg: XXX }
*/
*/
@GetMapping
(
"list"
)
@GetMapping
(
"list"
)
public
Object
list
(
Integer
categoryId
,
Integer
brandId
,
String
keyword
,
Integer
isNew
,
Integer
isHot
,
public
Object
list
(
Integer
categoryId
,
Integer
brandId
,
String
keyword
,
Boolean
isNew
,
Boolean
isHot
,
@LoginUser
Integer
userId
,
@LoginUser
Integer
userId
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
Integer
size
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"10"
)
Integer
size
,
String
sort
,
String
order
)
{
String
sort
,
String
order
)
{
String
sortWithOrder
=
SortUtil
.
goodsSort
(
sort
,
order
);
//添加到搜索历史
//添加到搜索历史
if
(
userId
!=
null
&&
!
StringUtils
.
isNullOrEmpty
(
keyword
))
{
if
(
userId
!=
null
&&
!
StringUtils
.
isNullOrEmpty
(
keyword
))
{
LitemallSearchHistory
searchHistoryVo
=
new
LitemallSearchHistory
();
LitemallSearchHistory
searchHistoryVo
=
new
LitemallSearchHistory
();
...
@@ -248,8 +243,8 @@ public class WxGoodsController {
...
@@ -248,8 +243,8 @@ public class WxGoodsController {
}
}
//查询列表数据
//查询列表数据
List
<
LitemallGoods
>
goodsList
=
goodsService
.
querySelective
(
categoryId
,
brandId
,
keyword
,
isHot
,
isNew
,
page
,
size
,
sort
WithO
rder
);
List
<
LitemallGoods
>
goodsList
=
goodsService
.
querySelective
(
categoryId
,
brandId
,
keyword
,
isHot
,
isNew
,
page
,
size
,
sort
,
o
rder
);
int
total
=
goodsService
.
countSelective
(
categoryId
,
brandId
,
keyword
,
isHot
,
isNew
,
page
,
size
,
sort
WithO
rder
);
int
total
=
goodsService
.
countSelective
(
categoryId
,
brandId
,
keyword
,
isHot
,
isNew
,
page
,
size
,
sort
,
o
rder
);
// 查询商品所属类目列表。
// 查询商品所属类目列表。
List
<
Integer
>
goodsCatIds
=
goodsService
.
getCatIds
(
brandId
,
keyword
,
isHot
,
isNew
);
List
<
Integer
>
goodsCatIds
=
goodsService
.
getCatIds
(
brandId
,
keyword
,
isHot
,
isNew
);
...
...
litemall-wx/pages/hotGoods/hotGoods.js
View file @
3abfeea8
...
@@ -13,6 +13,7 @@ Page({
...
@@ -13,6 +13,7 @@ Page({
goodsList
:
[],
goodsList
:
[],
categoryId
:
0
,
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
page
:
1
,
size
:
100
size
:
100
...
@@ -42,7 +43,7 @@ Page({
...
@@ -42,7 +43,7 @@ Page({
getGoodsList
:
function
(){
getGoodsList
:
function
(){
var
that
=
this
;
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
isHot
:
1
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
Type
,
categoryId
:
that
.
data
.
categoryId
})
util
.
request
(
api
.
GoodsList
,
{
isHot
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
that
.
setData
({
...
@@ -80,7 +81,8 @@ Page({
...
@@ -80,7 +81,8 @@ Page({
this
.
setData
({
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSortType
:
'
category
'
,
currentSortOrder
:
'
asc
'
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
});
break
;
break
;
case
'
priceSort
'
:
case
'
priceSort
'
:
...
@@ -90,6 +92,7 @@ Page({
...
@@ -90,6 +92,7 @@ Page({
}
}
this
.
setData
({
this
.
setData
({
currentSortType
:
'
price
'
,
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
categoryFilter
:
false
});
});
...
@@ -100,6 +103,7 @@ Page({
...
@@ -100,6 +103,7 @@ Page({
//综合排序
//综合排序
this
.
setData
({
this
.
setData
({
currentSortType
:
'
default
'
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryFilter
:
false
,
categoryId
:
0
,
categoryId
:
0
,
...
...
litemall-wx/pages/newGoods/newGoods.js
View file @
3abfeea8
...
@@ -13,6 +13,7 @@ Page({
...
@@ -13,6 +13,7 @@ Page({
goodsList
:
[],
goodsList
:
[],
categoryId
:
0
,
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
page
:
1
,
size
:
100
size
:
100
...
@@ -30,7 +31,7 @@ Page({
...
@@ -30,7 +31,7 @@ Page({
getGoodsList
:
function
()
{
getGoodsList
:
function
()
{
var
that
=
this
;
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
isNew
:
1
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
Type
,
categoryId
:
that
.
data
.
categoryId
})
util
.
request
(
api
.
GoodsList
,
{
isNew
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
that
.
setData
({
...
@@ -67,7 +68,8 @@ Page({
...
@@ -67,7 +68,8 @@ Page({
this
.
setData
({
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSortType
:
'
category
'
,
currentSortOrder
:
'
asc
'
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
});
break
;
break
;
case
'
priceSort
'
:
case
'
priceSort
'
:
...
@@ -77,6 +79,7 @@ Page({
...
@@ -77,6 +79,7 @@ Page({
}
}
this
.
setData
({
this
.
setData
({
currentSortType
:
'
price
'
,
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
categoryFilter
:
false
});
});
...
@@ -87,6 +90,7 @@ Page({
...
@@ -87,6 +90,7 @@ Page({
//综合排序
//综合排序
this
.
setData
({
this
.
setData
({
currentSortType
:
'
default
'
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryFilter
:
false
,
categoryId
:
0
categoryId
:
0
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment