Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
Overview
Details
Activity
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
吴迪
gs1-office-web-sit
Commits
fd0b17b8
Commit
fd0b17b8
authored
Nov 04, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】活动报道列表接口
parent
5f0db7bc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
20 deletions
+141
-20
TopicnewsController.java
...office/modules/manage/controller/TopicnewsController.java
+39
-18
TopicnewsDao.java
src/main/java/io/office/modules/manage/dao/TopicnewsDao.java
+8
-1
TopicnewsService.java
...va/io/office/modules/manage/service/TopicnewsService.java
+11
-0
TopicnewsServiceImpl.java
...ice/modules/manage/service/impl/TopicnewsServiceImpl.java
+56
-0
TopicnewsDao.xml
src/main/resources/mapper/manage/TopicnewsDao.xml
+27
-1
No files found.
src/main/java/io/office/modules/manage/controller/TopicnewsController.java
View file @
fd0b17b8
package
io
.
office
.
modules
.
manage
.
controller
;
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.manage.service.TopicnewsService
;
import
io.office.modules.manage.service.TopicnewsService
;
import
io.office.modules.sys.controller.AbstractController
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
...
@@ -40,10 +37,11 @@ public class TopicnewsController extends AbstractController {
...
@@ -40,10 +37,11 @@ public class TopicnewsController extends AbstractController {
*/
*/
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
// @RequiresPermissions("generator:topicnews:list")
// @RequiresPermissions("generator:topicnews:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
R
list
(
@RequestBody
NewsParams
newsParams
){
PageUtils
page
=
topicnewsService
.
queryPage
(
params
);
Page
<
NewsEntity
>
page
=
this
.
topicnewsService
.
selectTopicList
(
newsParams
,
new
Page
(
newsParams
.
getPage
(),
newsParams
.
getLimit
()));
return
R
.
ok
().
put
(
"page"
,
page
);
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
}
...
@@ -78,10 +76,14 @@ public class TopicnewsController extends AbstractController {
...
@@ -78,10 +76,14 @@ public class TopicnewsController extends AbstractController {
*/
*/
@RequestMapping
(
"/update"
)
@RequestMapping
(
"/update"
)
// @RequiresPermissions("generator:topicnews:update")
// @RequiresPermissions("generator:topicnews:update")
public
R
update
(
@RequestBody
TopicnewsEntity
topicnews
){
public
R
update
(
@RequestBody
NewsEntity
news
){
topicnewsService
.
updateById
(
topicnews
);
try
{
R
r
=
this
.
topicnewsService
.
updateHdbd
(
news
,
getUser
());
return
R
.
ok
();
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"update error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
/**
/**
...
@@ -89,10 +91,29 @@ public class TopicnewsController extends AbstractController {
...
@@ -89,10 +91,29 @@ public class TopicnewsController extends AbstractController {
*/
*/
@RequestMapping
(
"/delete"
)
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("generator:topicnews:delete")
// @RequiresPermissions("generator:topicnews:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
topicnewsService
.
removeByIds
(
Arrays
.
asList
(
ids
));
try
{
R
r
=
this
.
topicnewsService
.
deleteHdbd
(
ids
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
return
R
.
ok
();
/**
* 审核
*/
@PostMapping
(
"/verifyTopic"
)
// @RequiresPermissions("manage:news:verify")
public
R
verify
(
@RequestBody
NewsEntity
news
)
{
try
{
R
r
=
this
.
topicnewsService
.
verifyTopic
(
news
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"verifyTopic error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
}
}
src/main/java/io/office/modules/manage/dao/TopicnewsDao.java
View file @
fd0b17b8
package
io
.
office
.
modules
.
manage
.
dao
;
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* ${comments}
* ${comments}
...
@@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
TopicnewsDao
extends
BaseMapper
<
TopicnewsEntity
>
{
public
interface
TopicnewsDao
extends
BaseMapper
<
TopicnewsEntity
>
{
List
<
NewsEntity
>
selectTopicList
(
@Param
(
"newsParams"
)
NewsParams
newsParams
,
Page
page
);
}
}
src/main/java/io/office/modules/manage/service/TopicnewsService.java
View file @
fd0b17b8
package
io
.
office
.
modules
.
manage
.
service
;
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -21,5 +24,13 @@ public interface TopicnewsService extends IService<TopicnewsEntity> {
...
@@ -21,5 +24,13 @@ public interface TopicnewsService extends IService<TopicnewsEntity> {
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
insertHdbd
(
NewsEntity
news
,
SysUserEntity
user
);
R
insertHdbd
(
NewsEntity
news
,
SysUserEntity
user
);
R
updateHdbd
(
NewsEntity
news
,
SysUserEntity
user
);
R
deleteHdbd
(
List
<
Long
>
ids
,
SysUserEntity
user
);
R
verifyTopic
(
NewsEntity
news
,
SysUserEntity
user
);
Page
<
NewsEntity
>
selectTopicList
(
NewsParams
newsParams
,
Page
page
);
}
}
src/main/java/io/office/modules/manage/service/impl/TopicnewsServiceImpl.java
View file @
fd0b17b8
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.R
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.dao.NewsDao
;
import
io.office.modules.manage.dao.TopicnewsDao
;
import
io.office.modules.manage.dao.TopicnewsDao
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.TopicnewsEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.manage.service.NewsService
;
import
io.office.modules.manage.service.NewsService
;
import
io.office.modules.manage.service.TopicnewsService
;
import
io.office.modules.manage.service.TopicnewsService
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
...
@@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -22,6 +26,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -22,6 +26,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
(
"topicnewsService"
)
@Service
(
"topicnewsService"
)
public
class
TopicnewsServiceImpl
extends
ServiceImpl
<
TopicnewsDao
,
TopicnewsEntity
>
implements
TopicnewsService
{
public
class
TopicnewsServiceImpl
extends
ServiceImpl
<
TopicnewsDao
,
TopicnewsEntity
>
implements
TopicnewsService
{
@Autowired
private
NewsDao
newsDao
;
@Autowired
private
TopicnewsDao
topicnewsDao
;
@Override
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
TopicnewsEntity
>
page
=
this
.
page
(
IPage
<
TopicnewsEntity
>
page
=
this
.
page
(
...
@@ -47,4 +57,49 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
...
@@ -47,4 +57,49 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
return
R
.
ok
(
"新增成功!"
);
return
R
.
ok
(
"新增成功!"
);
}
}
@Override
public
R
updateHdbd
(
NewsEntity
news
,
SysUserEntity
user
)
{
QueryWrapper
<
NewsEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
news
.
getId
());
news
.
setEditor
(
user
.
getUsername
());
news
.
setLasteditor
(
user
.
getUsername
());
newsDao
.
update
(
news
,
newsEntityQueryWrapper
);
QueryWrapper
<
TopicnewsEntity
>
topicnewsEntityQueryWrapper
=
new
QueryWrapper
<>();
topicnewsEntityQueryWrapper
.
eq
(
"NewsId"
,
news
.
getId
());
TopicnewsEntity
topicnewsEntity
=
new
TopicnewsEntity
();
topicnewsEntity
.
setNewslevels
(
news
.
getLevels
());
topicnewsEntity
.
setTime
(
new
Date
());
baseMapper
.
update
(
topicnewsEntity
,
topicnewsEntityQueryWrapper
);
return
R
.
ok
(
"修改成功!"
);
}
@Override
public
R
deleteHdbd
(
List
<
Long
>
ids
,
SysUserEntity
user
)
{
NewsEntity
news
=
new
NewsEntity
();
news
.
setLevels
(
0
);
QueryWrapper
<
NewsEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
in
(
"id"
,
ids
);
newsDao
.
update
(
news
,
newsEntityQueryWrapper
);
return
R
.
ok
(
"删除成功!"
);
}
@Override
public
R
verifyTopic
(
NewsEntity
news
,
SysUserEntity
user
)
{
news
.
setAuditor
(
user
.
getUsername
());
news
.
setCheckdate
(
new
Date
());
news
.
setLasteditor
(
user
.
getUsername
());
QueryWrapper
<
NewsEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
news
.
getId
());
newsDao
.
update
(
news
,
newsEntityQueryWrapper
);
return
R
.
ok
(
"审核成功!"
);
}
@Override
public
Page
<
NewsEntity
>
selectTopicList
(
NewsParams
newsParams
,
Page
page
)
{
List
<
NewsEntity
>
newsList
=
this
.
topicnewsDao
.
selectTopicList
(
newsParams
,
page
);
page
.
setRecords
(
newsList
);
return
page
;
}
}
}
\ No newline at end of file
src/main/resources/mapper/manage/TopicnewsDao.xml
View file @
fd0b17b8
...
@@ -12,5 +12,30 @@
...
@@ -12,5 +12,30 @@
<result
property=
"time"
column=
"time"
/>
<result
property=
"time"
column=
"time"
/>
</resultMap>
</resultMap>
<select
id=
"selectTopicList"
resultType=
"io.office.modules.manage.entity.NewsEntity"
>
SELECT
a.classid,
a.newsid id,
b.title,
b.author,
b.showtime,
b.startdate,
b.keyword,
b.editor,
b.lasteditor,
b.auditor,
b.status,
b.levels,
b.releasedate,
b.updatedate
FROM
TopIcNews AS a
LEFT JOIN news AS b ON a.newsid = b.id
WHERE
a.classid = 428
AND levels > 0
ORDER BY
levels DESC,
releasedate DESC
</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