Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
1da7424b
Commit
1da7424b
authored
Aug 30, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改新闻接口
parent
ebd31ce4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
ArticleBiz.java
.../src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
+14
-11
ArticleMapper.java
...ain/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
+1
-1
ArticleMapper.xml
...x-uccn-server/src/main/resources/mapper/ArticleMapper.xml
+9
-1
No files found.
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
View file @
1da7424b
...
@@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
java.security.SecureRandom
;
import
java.util.*
;
import
java.util.*
;
...
@@ -31,6 +32,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
...
@@ -31,6 +32,8 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
private
final
Integer
HOME_PAGE_NUMBER
=
4
;
private
final
Integer
HOME_PAGE_NUMBER
=
4
;
/**
/**
* 文章列表
* 文章列表
*
*
...
@@ -41,7 +44,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
...
@@ -41,7 +44,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
*/
*/
public
PageInfo
getArticleList
(
Integer
page
,
Integer
limit
,
Integer
type
)
{
public
PageInfo
getArticleList
(
Integer
page
,
Integer
limit
,
Integer
type
)
{
PageHelper
.
startPage
(
page
,
limit
);
PageHelper
.
startPage
(
page
,
limit
);
List
articleList
=
mapper
.
getArticleList
(
type
);
List
articleList
=
mapper
.
getArticleList
(
type
,
null
);
return
PageInfo
.
of
(
articleList
);
return
PageInfo
.
of
(
articleList
);
}
}
...
@@ -73,7 +76,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
...
@@ -73,7 +76,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
*/
*/
public
List
getThree
(
Integer
type
)
{
public
List
getThree
(
Integer
type
)
{
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
);
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
null
);
if
(!
Objects
.
isNull
(
articleList
))
{
if
(!
Objects
.
isNull
(
articleList
))
{
int
size
=
articleList
.
size
();
int
size
=
articleList
.
size
();
if
(
RANDOM_NUMBER
>=
size
)
{
if
(
RANDOM_NUMBER
>=
size
)
{
...
@@ -100,16 +103,16 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
...
@@ -100,16 +103,16 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
* @return
* @return
*/
*/
public
List
getHomePageArticle
(
Integer
type
)
{
public
List
getHomePageArticle
(
Integer
type
)
{
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
);
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
HOME_PAGE_NUMBER
);
if
(
Objects
.
isNull
(
articleList
))
{
//
if (Objects.isNull(articleList)) {
return
new
ArrayList
();
//
return new ArrayList();
}
else
{
//
} else {
if
(
articleList
.
size
()
>
HOME_PAGE_NUMBER
)
{
//
if (articleList.size() > HOME_PAGE_NUMBER) {
return
articleList
.
subList
(
0
,
HOME_PAGE_NUMBER
);
//
return articleList.subList(0, HOME_PAGE_NUMBER);
}
else
{
//
} else {
return
articleList
;
return
articleList
;
}
//
}
}
//
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
View file @
1da7424b
...
@@ -15,5 +15,5 @@ public interface ArticleMapper extends Mapper<Article> {
...
@@ -15,5 +15,5 @@ public interface ArticleMapper extends Mapper<Article> {
* @param type
* @param type
* @return
* @return
*/
*/
List
<
Article
>
getArticleList
(
@Param
(
"type"
)
Integer
type
);
List
<
Article
>
getArticleList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"limit"
)
Integer
limit
);
}
}
xx-uccn/xx-uccn-server/src/main/resources/mapper/ArticleMapper.xml
View file @
1da7424b
...
@@ -5,7 +5,15 @@
...
@@ -5,7 +5,15 @@
<select
id=
"getArticleList"
resultType=
"com.xxfc.platform.uccn.entity.Article"
>
<select
id=
"getArticleList"
resultType=
"com.xxfc.platform.uccn.entity.Article"
>
select id, title,epitome,add_time,cover_image from article
select id, title,epitome,add_time,cover_image from article
where is_del=0 and status=1 and (type=#{type} or type=0) order by weight ASC ,add_time DESC
where
is_del=0
and status=1
and (type=#{type} or type=0)
order by
weight ASC ,add_time DESC
<if
test=
"limit != null"
>
limit #{limit}
</if>
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
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