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
db969a15
Commit
db969a15
authored
Oct 26, 2018
by
Junling Bu
Browse files
专题代码微调
parent
b95e4ca7
Changes
7
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallBrandService.java
View file @
db969a15
...
...
@@ -17,16 +17,10 @@ public class LitemallBrandService {
private
LitemallBrandMapper
brandMapper
;
private
Column
[]
columns
=
new
Column
[]{
Column
.
id
,
Column
.
name
,
Column
.
desc
,
Column
.
picUrl
,
Column
.
floorPrice
};
public
List
<
LitemallBrand
>
query
(
int
offset
,
int
limit
)
{
LitemallBrandExample
example
=
new
LitemallBrandExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
PageHelper
.
startPage
(
offset
,
limit
);
return
brandMapper
.
selectByExample
(
example
);
}
public
List
<
LitemallBrand
>
queryVO
(
int
offset
,
int
limit
)
{
LitemallBrandExample
example
=
new
LitemallBrandExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
example
.
setOrderByClause
(
"add_time desc"
);
PageHelper
.
startPage
(
offset
,
limit
);
return
brandMapper
.
selectByExampleSelective
(
example
,
columns
);
}
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallTopicService.java
View file @
db969a15
...
...
@@ -18,8 +18,13 @@ public class LitemallTopicService {
private
Column
[]
columns
=
new
Column
[]{
Column
.
id
,
Column
.
title
,
Column
.
subtitle
,
Column
.
price
,
Column
.
picUrl
,
Column
.
readCount
};
public
List
<
LitemallTopic
>
queryList
(
int
offset
,
int
limit
)
{
return
queryList
(
offset
,
limit
,
"add_time"
,
"desc"
);
}
public
List
<
LitemallTopic
>
queryList
(
int
offset
,
int
limit
,
String
sort
,
String
order
)
{
LitemallTopicExample
example
=
new
LitemallTopicExample
();
example
.
or
().
andDeletedEqualTo
(
false
);
example
.
setOrderByClause
(
sort
+
" "
+
order
);
PageHelper
.
startPage
(
offset
,
limit
);
return
topicMapper
.
selectByExampleSelective
(
example
,
columns
);
}
...
...
@@ -41,7 +46,7 @@ public class LitemallTopicService {
example
.
or
().
andIdEqualTo
(
id
).
andDeletedEqualTo
(
false
);
List
<
LitemallTopic
>
topics
=
topicMapper
.
selectByExample
(
example
);
if
(
topics
.
size
()
==
0
)
{
return
queryList
(
offset
,
limit
);
return
queryList
(
offset
,
limit
,
"add_time"
,
"desc"
);
}
LitemallTopic
topic
=
topics
.
get
(
0
);
...
...
@@ -53,7 +58,7 @@ public class LitemallTopicService {
return
relateds
;
}
return
queryList
(
offset
,
limit
);
return
queryList
(
offset
,
limit
,
"add_time"
,
"desc"
);
}
public
List
<
LitemallTopic
>
querySelective
(
String
title
,
String
subtitle
,
Integer
page
,
Integer
limit
,
String
sort
,
String
order
)
{
...
...
@@ -94,7 +99,7 @@ public class LitemallTopicService {
public
int
updateById
(
LitemallTopic
topic
)
{
LitemallTopicExample
example
=
new
LitemallTopicExample
();
example
.
or
().
andIdEqualTo
(
topic
.
getId
());
return
topicMapper
.
updateByExample
WithBLOBs
(
topic
,
example
);
return
topicMapper
.
updateByExample
Selective
(
topic
,
example
);
}
public
void
deleteById
(
Integer
id
)
{
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxTopicController.java
View file @
db969a15
package
org.linlinjava.litemall.wx.web
;
import
org.linlinjava.litemall.core.validator.Order
;
import
org.linlinjava.litemall.core.validator.Sort
;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.LitemallTopic
;
import
org.linlinjava.litemall.db.service.LitemallGoodsService
;
...
...
@@ -47,8 +49,10 @@ public class WxTopicController {
*/
@GetMapping
(
"list"
)
public
Object
list
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
)
{
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
page
,
size
);
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
,
@Sort
@RequestParam
(
defaultValue
=
"add_time"
)
String
sort
,
@Order
@RequestParam
(
defaultValue
=
"desc"
)
String
order
)
{
List
<
LitemallTopic
>
topicList
=
topicService
.
queryList
(
page
,
size
,
sort
,
order
);
int
total
=
topicService
.
queryTotal
();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
data
.
put
(
"data"
,
topicList
);
...
...
litemall-wx/pages/topic/topic.js
View file @
db969a15
...
...
@@ -28,7 +28,7 @@ Page({
},
nextPage
:
function
(
event
)
{
var
that
=
this
;
if
(
this
.
data
.
page
+
1
>
that
.
data
.
count
/
that
.
data
.
size
)
{
if
(
this
.
data
.
page
>
that
.
data
.
count
/
that
.
data
.
size
)
{
return
true
;
}
...
...
litemall-wx/pages/topic/topic.wxml
View file @
db969a15
...
...
@@ -10,7 +10,7 @@
</navigator>
<view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page
+1
? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
<view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
renard-wx/pages/topic/topic.js
View file @
db969a15
...
...
@@ -28,7 +28,7 @@ Page({
},
nextPage
:
function
(
event
)
{
var
that
=
this
;
if
(
this
.
data
.
page
+
1
>
that
.
data
.
count
/
that
.
data
.
size
)
{
if
(
this
.
data
.
page
>
that
.
data
.
count
/
that
.
data
.
size
)
{
return
true
;
}
...
...
renard-wx/pages/topic/topic.wxml
View file @
db969a15
...
...
@@ -10,7 +10,7 @@
</navigator>
<view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page
+1
? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
<view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
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