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
ad97f753
Commit
ad97f753
authored
Aug 30, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改新闻接口
parent
0af95d09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
10 deletions
+26
-10
ArticleBiz.java
.../src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
+7
-4
ArticleMapper.java
...ain/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
+4
-2
ArticleController.java
...n/java/com/xxfc/platform/uccn/rest/ArticleController.java
+9
-4
ArticleMapper.xml
...x-uccn-server/src/main/resources/mapper/ArticleMapper.xml
+6
-0
No files found.
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/biz/ArticleBiz.java
View file @
ad97f753
...
...
@@ -44,7 +44,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
*/
public
PageInfo
getArticleList
(
Integer
page
,
Integer
limit
,
Integer
type
)
{
PageHelper
.
startPage
(
page
,
limit
);
List
articleList
=
mapper
.
getArticleList
(
type
,
null
);
List
articleList
=
mapper
.
getArticleList
(
type
,
null
,
null
);
return
PageInfo
.
of
(
articleList
);
}
...
...
@@ -71,12 +71,15 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
/**
* 随机获取三条连续的文章
*
*
*
* @param type
* @param id
* @return
*/
public
List
getThree
(
Integer
type
)
{
public
List
getThree
(
Integer
type
,
Integer
id
)
{
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
null
);
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
null
,
id
);
if
(!
Objects
.
isNull
(
articleList
))
{
int
size
=
articleList
.
size
();
if
(
RANDOM_NUMBER
>=
size
)
{
...
...
@@ -103,7 +106,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
* @return
*/
public
List
getHomePageArticle
(
Integer
type
)
{
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
HOME_PAGE_NUMBER
);
List
<
Article
>
articleList
=
mapper
.
getArticleList
(
type
,
HOME_PAGE_NUMBER
,
null
);
// if (Objects.isNull(articleList)) {
// return new ArrayList();
// } else {
...
...
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/mapper/ArticleMapper.java
View file @
ad97f753
...
...
@@ -11,9 +11,11 @@ import java.util.List;
*/
public
interface
ArticleMapper
extends
Mapper
<
Article
>
{
/**
*
根据网站类型查询文章
*
获取获取文章信息
* @param type
* @param limit 已使用分业插件传null值即可,不要重复传
* @param id 当前文章id ,无就传null
* @return
*/
List
<
Article
>
getArticleList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"limit"
)
Integer
limit
);
List
<
Article
>
getArticleList
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"limit"
)
Integer
limit
,
@Param
(
"id"
)
Integer
id
);
}
xx-uccn/xx-uccn-server/src/main/java/com/xxfc/platform/uccn/rest/ArticleController.java
View file @
ad97f753
...
...
@@ -36,11 +36,16 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
return
ObjectRestResponse
.
succ
(
baseBiz
.
getOne
(
id
,
urlType
));
}
@GetMapping
(
"/app/unauth/three/{type}"
)
/**
*
* @param type
* @param id 当前文章id
* @return
*/
@GetMapping
(
"/app/unauth/three/{type}/{id}"
)
@ApiOperation
(
value
=
"随机获取三条数据"
)
public
ObjectRestResponse
randomAccessToThreeData
(
@PathVariable
Integer
type
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
getThree
(
type
));
public
ObjectRestResponse
randomAccessToThreeData
(
@PathVariable
Integer
type
,
@PathVariable
Integer
id
){
return
ObjectRestResponse
.
succ
(
baseBiz
.
getThree
(
type
,
id
));
}
@GetMapping
(
"/app/unauth/homePage/{type}"
)
...
...
xx-uccn/xx-uccn-server/src/main/resources/mapper/ArticleMapper.xml
View file @
ad97f753
...
...
@@ -8,12 +8,18 @@
where
is_del=0
and status=1
<if
test=
"id != null"
>
and id != #{id}
</if>
and (type=#{type} or type=0)
order by
weight ASC ,add_time DESC
<if
test=
"limit != null"
>
limit #{limit}
</if>
</select>
</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