Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-platform
Commits
d1ff59e6
Commit
d1ff59e6
authored
Dec 04, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加新闻点赞记录表,增加取消点赞接口
parent
fb8c323c
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
2339 additions
and
8 deletions
+2339
-8
db/add.sql
db/add.sql
+20
-1
doc/企业服务平台 .docx
doc/企业服务平台 .docx
+0
-0
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/rsp/NewsListInfo.java
.../java/com/mortals/xhx/busiz/applets/rsp/NewsListInfo.java
+24
-1
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/NewsApiController.java
.../com/mortals/xhx/busiz/applets/web/NewsApiController.java
+27
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/news/dao/NewsUpDao.java
.../main/java/com/mortals/xhx/module/news/dao/NewsUpDao.java
+17
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/dao/ibatis/NewsUpDaoImpl.java
...com/mortals/xhx/module/news/dao/ibatis/NewsUpDaoImpl.java
+21
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/NewsUpEntity.java
.../java/com/mortals/xhx/module/news/model/NewsUpEntity.java
+71
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/NewsUpQuery.java
...n/java/com/mortals/xhx/module/news/model/NewsUpQuery.java
+1182
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/vo/NewsUpVo.java
...n/java/com/mortals/xhx/module/news/model/vo/NewsUpVo.java
+23
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/vo/NewsVo.java
...ain/java/com/mortals/xhx/module/news/model/vo/NewsVo.java
+8
-2
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/NewsService.java
...java/com/mortals/xhx/module/news/service/NewsService.java
+3
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/NewsUpService.java
...va/com/mortals/xhx/module/news/service/NewsUpService.java
+16
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/impl/NewsServiceImpl.java
...mortals/xhx/module/news/service/impl/NewsServiceImpl.java
+83
-2
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/impl/NewsUpServiceImpl.java
...rtals/xhx/module/news/service/impl/NewsUpServiceImpl.java
+23
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/news/web/NewsUpController.java
...ava/com/mortals/xhx/module/news/web/NewsUpController.java
+50
-0
enterprise-manager/src/main/resources/sqlmap/module/news/NewsUpMapper.xml
...er/src/main/resources/sqlmap/module/news/NewsUpMapper.xml
+771
-0
No files found.
db/add.sql
View file @
d1ff59e6
...
@@ -87,4 +87,23 @@ ALTER TABLE `mortals_xhx_user` ADD COLUMN `companyAdress` varchar(512) COMMENT
...
@@ -87,4 +87,23 @@ ALTER TABLE `mortals_xhx_user` ADD COLUMN `companyAdress` varchar(512) COMMENT
INSERT
INTO
`mortals_xhx_task`
(
`name`
,
`taskKey`
,
`status`
,
`excuteService`
,
`excuteParam`
,
`excuteHost`
,
`excuteStrategy`
,
`excuteDate`
,
`excuteTime`
,
`remark`
,
`lastExcuteHost`
,
`lastExcuteTime`
,
`interimExcuteStatus`
,
`createTime`
,
`createUserId`
,
`createUserName`
)
VALUES
(
'员工名片日访问数初始化'
,
'StaffViewsByDayInit'
,
'0'
,
'StaffViewsByDayInit'
,
NULL
,
NULL
,
'1'
,
'0'
,
'00:00'
,
NULL
,
NULL
,
NULL
,
'0'
,
NULL
,
'1'
,
'系统管理员'
);
INSERT
INTO
`mortals_xhx_task`
(
`name`
,
`taskKey`
,
`status`
,
`excuteService`
,
`excuteParam`
,
`excuteHost`
,
`excuteStrategy`
,
`excuteDate`
,
`excuteTime`
,
`remark`
,
`lastExcuteHost`
,
`lastExcuteTime`
,
`interimExcuteStatus`
,
`createTime`
,
`createUserId`
,
`createUserName`
)
VALUES
(
'员工名片日访问数初始化'
,
'StaffViewsByDayInit'
,
'0'
,
'StaffViewsByDayInit'
,
NULL
,
NULL
,
'1'
,
'0'
,
'00:00'
,
NULL
,
NULL
,
NULL
,
'0'
,
NULL
,
'1'
,
'系统管理员'
);
ALTER
TABLE
`mortals_xhx_bussinesscard`
ADD
COLUMN
`backdrop`
varchar
(
256
)
COMMENT
'名片背景'
;
ALTER
TABLE
`mortals_xhx_bussinesscard`
ADD
COLUMN
`backdrop`
varchar
(
256
)
COMMENT
'名片背景'
;
ALTER
TABLE
`mortals_xhx_news`
ADD
COLUMN
`upNums`
tinyint
(
4
)
NOT
NULL
DEFAULT
'0'
COMMENT
'点赞次数'
;
ALTER
TABLE
`mortals_xhx_news`
ADD
COLUMN
`upNums`
tinyint
(
4
)
NOT
NULL
DEFAULT
'0'
COMMENT
'点赞次数'
;
\ No newline at end of file
-- ----------------------------
-- 新闻点赞记录信息表
-- ----------------------------
DROP
TABLE
IF
EXISTS
`mortals_xhx_news_up`
;
CREATE
TABLE
mortals_xhx_news_up
(
`id`
bigint
(
20
)
AUTO_INCREMENT
COMMENT
'序号,主键,自增长'
,
`newsId`
bigint
(
20
)
COMMENT
'新闻ID'
,
`upId`
bigint
(
20
)
COMMENT
'点赞人ID'
,
`upName`
varchar
(
64
)
NOT
NULL
COMMENT
'点赞人名称'
,
`sumUp`
int
(
4
)
DEFAULT
'0'
COMMENT
'累计分享次数'
,
`remark`
varchar
(
255
)
COMMENT
'备注'
,
`upTime`
datetime
NOT
NULL
COMMENT
'点赞时间'
,
`createUserId`
bigint
(
20
)
NOT
NULL
COMMENT
'创建用户'
,
`createTime`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`updateUserId`
bigint
(
20
)
COMMENT
'更新用户'
,
`updateTime`
datetime
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
)
,
KEY
`upName`
(
`upName`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'新闻点赞记录信息'
;
doc/企业服务平台 .docx
View file @
d1ff59e6
No preview for this file type
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/rsp/NewsListInfo.java
View file @
d1ff59e6
...
@@ -26,7 +26,30 @@ public class NewsListInfo {
...
@@ -26,7 +26,30 @@ public class NewsListInfo {
* 发布时间
* 发布时间
*/
*/
private
Date
publishTime
;
private
Date
publishTime
;
/**
* 所属部门名称
*/
private
String
deptName
;
/**
* 声明
*/
private
String
statement
;
/**
* 文章来源
*/
private
String
source
;
/**
* 责任编辑
*/
private
String
editor
;
/**点赞状态**/
private
Integer
upStatus
;
/**分享状态**/
private
Integer
shareStatus
;
/**
* 头像地址
*/
private
String
photoPath
;
}
}
enterprise-manager/src/main/java/com/mortals/xhx/busiz/applets/web/NewsApiController.java
View file @
d1ff59e6
...
@@ -172,7 +172,33 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
...
@@ -172,7 +172,33 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
if
(
ObjectUtils
.
isEmpty
(
newsReq
.
getId
()))
{
if
(
ObjectUtils
.
isEmpty
(
newsReq
.
getId
()))
{
throw
new
AppException
(
"新闻id不能为空!"
);
throw
new
AppException
(
"新闻id不能为空!"
);
}
}
NewsEntity
newsEntity
=
newsService
.
upNews
(
newsReq
.
getId
());
NewsEntity
newsEntity
=
newsService
.
upNews
(
newsReq
.
getId
(),
context
,
1
);
rest
.
setData
(
newsEntity
);
this
.
init
(
model
,
context
);
rest
.
setDict
(
model
.
get
(
"dict"
));
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
busiDesc
,
e
);
rest
=
Rest
.
fail
(
super
.
convertException
(
e
));
}
return
rest
;
}
/**
* 新闻取消点赞
*/
@PostMapping
(
value
=
"cancelUp"
)
public
Rest
<
NewsEntity
>
cancelUpNews
(
@RequestBody
NewsReq
newsReq
)
{
String
busiDesc
=
"新闻点赞"
;
log
.
info
(
"【{}】【请求体】--> {}"
,
busiDesc
,
JSONObject
.
toJSONString
(
newsReq
));
Rest
<
NewsEntity
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
Context
context
=
this
.
getContext
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
try
{
if
(
ObjectUtils
.
isEmpty
(
newsReq
.
getId
()))
{
throw
new
AppException
(
"新闻id不能为空!"
);
}
NewsEntity
newsEntity
=
newsService
.
upNews
(
newsReq
.
getId
(),
context
,-
1
);
rest
.
setData
(
newsEntity
);
rest
.
setData
(
newsEntity
);
this
.
init
(
model
,
context
);
this
.
init
(
model
,
context
);
rest
.
setDict
(
model
.
get
(
"dict"
));
rest
.
setDict
(
model
.
get
(
"dict"
));
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/news/dao/NewsUpDao.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.dao
;
import
com.mortals.framework.dao.ICRUDDao
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
java.util.List
;
/**
* 新闻点赞记录信息Dao
* 新闻点赞记录信息 DAO接口
*
* @author zxfei
* @date 2024-12-04
*/
public
interface
NewsUpDao
extends
ICRUDDao
<
NewsUpEntity
,
Long
>{
}
enterprise-manager/src/main/java/com/mortals/xhx/module/news/dao/ibatis/NewsUpDaoImpl.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.dao.ibatis
;
import
org.springframework.stereotype.Repository
;
import
com.mortals.xhx.module.news.dao.NewsUpDao
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
java.util.Date
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
java.util.List
;
/**
* 新闻点赞记录信息DaoImpl DAO接口
*
* @author zxfei
* @date 2024-12-04
*/
@Repository
(
"newsUpDao"
)
public
class
NewsUpDaoImpl
extends
BaseCRUDDaoMybatis
<
NewsUpEntity
,
Long
>
implements
NewsUpDao
{
}
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/NewsUpEntity.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.model
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.ArrayList
;
import
java.math.BigDecimal
;
import
cn.hutool.core.date.DateUtil
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.news.model.vo.NewsUpVo
;
import
lombok.Data
;
/**
* 新闻点赞记录信息实体对象
*
* @author zxfei
* @date 2024-12-04
*/
@Data
public
class
NewsUpEntity
extends
NewsUpVo
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 新闻ID
*/
private
Long
newsId
;
/**
* 点赞人ID
*/
private
Long
upId
;
/**
* 点赞人名称
*/
private
String
upName
;
/**
* 累计分享次数
*/
private
Integer
sumUp
;
/**
* 备注
*/
private
String
remark
;
/**
* 点赞时间
*/
private
Date
upTime
;
@Override
public
int
hashCode
()
{
return
this
.
getId
().
hashCode
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
==
null
)
return
false
;
if
(
obj
instanceof
NewsUpEntity
)
{
NewsUpEntity
tmp
=
(
NewsUpEntity
)
obj
;
if
(
this
.
getId
()
==
tmp
.
getId
())
{
return
true
;
}
}
return
false
;
}
public
void
initAttrValue
(){
this
.
newsId
=
null
;
this
.
upId
=
null
;
this
.
upName
=
""
;
this
.
sumUp
=
0
;
this
.
remark
=
""
;
this
.
upTime
=
null
;
}
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/NewsUpQuery.java
0 → 100644
View file @
d1ff59e6
This diff is collapsed.
Click to expand it.
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/vo/NewsUpVo.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.model.vo
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
java.util.ArrayList
;
import
java.util.List
;
import
lombok.Data
;
import
com.mortals.framework.annotation.Excel
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 新闻点赞记录信息视图对象
*
* @author zxfei
* @date 2024-12-04
*/
@Data
public
class
NewsUpVo
extends
BaseEntityLong
{
/** 序号,主键,自增长列表 */
private
List
<
Long
>
idList
;
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/news/model/vo/NewsVo.java
View file @
d1ff59e6
...
@@ -23,6 +23,12 @@ public class NewsVo extends BaseEntityLong {
...
@@ -23,6 +23,12 @@ public class NewsVo extends BaseEntityLong {
* 分享次数
* 分享次数
*/
*/
private
Integer
shareNums
;
private
Integer
shareNums
;
/**点赞状态**/
private
Integer
upStatus
;
/**分享状态**/
private
Integer
shareStatus
;
/**
* 头像地址
*/
private
String
photoPath
;
}
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/NewsService.java
View file @
d1ff59e6
...
@@ -19,9 +19,11 @@ public interface NewsService extends ICRUDService<NewsEntity,Long>{
...
@@ -19,9 +19,11 @@ public interface NewsService extends ICRUDService<NewsEntity,Long>{
/**
/**
* 点赞
* 点赞
* @param id
* @param id
* @param context
* @param increment 点赞次数增减值
* @return
* @return
*/
*/
NewsEntity
upNews
(
Long
id
)
throws
AppException
;
NewsEntity
upNews
(
Long
id
,
Context
context
,
int
increment
)
throws
AppException
;
/**
/**
* 浏览新闻
* 浏览新闻
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/NewsUpService.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.service
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
com.mortals.xhx.module.news.dao.NewsUpDao
;
/**
* NewsUpService
*
* 新闻点赞记录信息 service接口
*
* @author zxfei
* @date 2024-12-04
*/
public
interface
NewsUpService
extends
ICRUDService
<
NewsUpEntity
,
Long
>{
NewsUpDao
getDao
();
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/impl/NewsServiceImpl.java
View file @
d1ff59e6
package
com.mortals.xhx.module.news.service.impl
;
package
com.mortals.xhx.module.news.service.impl
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.module.news.model.*
;
import
com.mortals.xhx.module.news.model.*
;
import
com.mortals.xhx.module.news.service.NewsRecordService
;
import
com.mortals.xhx.module.news.service.NewsRecordService
;
import
com.mortals.xhx.module.news.service.NewsShareService
;
import
com.mortals.xhx.module.news.service.NewsShareService
;
import
com.mortals.xhx.module.news.service.NewsUpService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
...
@@ -12,6 +18,10 @@ import com.mortals.xhx.module.news.service.NewsService;
...
@@ -12,6 +18,10 @@ import com.mortals.xhx.module.news.service.NewsService;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* NewsService
* NewsService
...
@@ -28,16 +38,87 @@ public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity
...
@@ -28,16 +38,87 @@ public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity
private
NewsShareService
newsShareService
;
private
NewsShareService
newsShareService
;
@Autowired
@Autowired
private
NewsRecordService
newsRecordService
;
private
NewsRecordService
newsRecordService
;
@Autowired
private
NewsUpService
newsUpService
;
@Autowired
private
UserService
userService
;
@Override
@Override
public
NewsEntity
upNews
(
Long
id
)
throws
AppException
{
protected
void
findAfter
(
NewsEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
NewsEntity
>
list
)
throws
AppException
{
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
List
<
Long
>
userIdList
=
list
.
stream
().
map
(
NewsEntity:
:
getCreateUserId
).
collect
(
Collectors
.
toList
());
List
<
UserEntity
>
userList
=
userService
.
find
(
new
UserQuery
().
idList
(
userIdList
));
Map
<
Long
,
UserEntity
>
userMap
=
userList
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
z
->
z
,
(
o
,
n
)
->
n
));
if
(
context
!=
null
&&
context
.
getUser
()!=
null
){
List
<
Long
>
newsIdList
=
list
.
stream
().
map
(
NewsEntity:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
NewsUpEntity
>
upList
=
newsUpService
.
find
(
new
NewsUpQuery
().
newsIdList
(
newsIdList
).
upId
(
context
.
getUser
().
getId
()));
Map
<
Long
,
NewsUpEntity
>
upMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
upList
)){
upMap
=
upList
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
z
->
z
,
(
o
,
n
)
->
n
));
}
List
<
NewsShareEntity
>
shareList
=
newsShareService
.
find
(
new
NewsShareQuery
().
newsIdList
(
newsIdList
).
createUserId
(
context
.
getUser
().
getId
()));
Map
<
Long
,
NewsShareEntity
>
shareMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
shareList
))
{
shareMap
=
shareList
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
(),
z
->
z
,
(
o
,
n
)
->
n
));
}
for
(
NewsEntity
item:
list
){
if
(
upMap
.
containsKey
(
item
.
getId
())){
item
.
setUpStatus
(
1
);
}
else
{
item
.
setUpStatus
(
0
);
}
if
(
shareMap
.
containsKey
(
item
.
getId
())){
item
.
setShareStatus
(
1
);
}
else
{
item
.
setShareStatus
(
0
);
}
UserEntity
userEntity
=
userMap
.
get
(
item
.
getCreateUserId
());
if
(
userEntity
!=
null
)
{
item
.
setPhotoPath
(
userEntity
.
getPhotoPath
());
}
}
}
}
}
@Override
public
NewsEntity
upNews
(
Long
id
,
Context
context
,
int
increment
)
throws
AppException
{
NewsEntity
news
=
this
.
get
(
id
);
NewsEntity
news
=
this
.
get
(
id
);
if
(
news
==
null
){
if
(
news
==
null
){
throw
new
AppException
(
"新闻不存在"
);
throw
new
AppException
(
"新闻不存在"
);
}
}
if
(
context
!=
null
&&
context
.
getUser
()!=
null
)
{
NewsUpEntity
newsUpEntity
=
newsUpService
.
selectOne
(
new
NewsUpQuery
().
newsId
(
id
).
upId
(
context
.
getUser
().
getId
()));
if
(
newsUpEntity
!=
null
){
if
(
increment
<
0
){
newsUpService
.
remove
(
newsUpEntity
.
getId
(),
context
);
}
else
{
NewsUpQuery
updateUp
=
new
NewsUpQuery
();
updateUp
.
setId
(
newsUpEntity
.
getId
());
updateUp
.
setSumUpIncrement
(
increment
);
updateUp
.
setUpTime
(
new
Date
());
updateUp
.
setUpdateTime
(
new
Date
());
updateUp
.
setUpdateUserId
(
context
.
getUser
().
getId
());
newsUpService
.
update
(
updateUp
);
}
}
else
{
if
(
increment
>
0
)
{
newsUpEntity
=
new
NewsUpEntity
();
newsUpEntity
.
initAttrValue
();
newsUpEntity
.
setNewsId
(
id
);
newsUpEntity
.
setUpId
(
context
.
getUser
().
getId
());
newsUpEntity
.
setUpName
(
context
.
getUser
().
getRealName
());
newsUpEntity
.
setUpTime
(
new
Date
());
newsUpEntity
.
setCreateTime
(
new
Date
());
newsUpEntity
.
setCreateUserId
(
context
.
getUser
().
getId
());
newsUpEntity
.
setSumUp
(
increment
);
newsUpService
.
save
(
newsUpEntity
);
}
}
}
NewsQuery
update
=
new
NewsQuery
();
NewsQuery
update
=
new
NewsQuery
();
update
.
setId
(
id
);
update
.
setId
(
id
);
update
.
setUpNumsIncrement
(
1
);
update
.
setUpNumsIncrement
(
increment
);
return
this
.
update
(
update
);
return
this
.
update
(
update
);
}
}
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/news/service/impl/NewsUpServiceImpl.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.service.impl
;
import
org.springframework.beans.BeanUtils
;
import
java.util.function.Function
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.news.dao.NewsUpDao
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
com.mortals.xhx.module.news.service.NewsUpService
;
import
lombok.extern.slf4j.Slf4j
;
/**
* NewsUpService
* 新闻点赞记录信息 service实现
*
* @author zxfei
* @date 2024-12-04
*/
@Service
(
"newsUpService"
)
@Slf4j
public
class
NewsUpServiceImpl
extends
AbstractCRUDServiceImpl
<
NewsUpDao
,
NewsUpEntity
,
Long
>
implements
NewsUpService
{
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/news/web/NewsUpController.java
0 → 100644
View file @
d1ff59e6
package
com.mortals.xhx.module.news.web
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.news.model.NewsUpEntity
;
import
com.mortals.xhx.module.news.service.NewsUpService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
import
com.mortals.xhx.common.code.*
;
/**
*
* 新闻点赞记录信息
*
* @author zxfei
* @date 2024-12-04
*/
@RestController
@RequestMapping
(
"news/up"
)
public
class
NewsUpController
extends
BaseCRUDJsonBodyMappingController
<
NewsUpService
,
NewsUpEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
public
NewsUpController
(){
super
.
setModuleDesc
(
"新闻点赞记录信息"
);
}
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
super
.
init
(
model
,
context
);
}
}
\ No newline at end of file
enterprise-manager/src/main/resources/sqlmap/module/news/NewsUpMapper.xml
0 → 100644
View file @
d1ff59e6
This diff is collapsed.
Click to expand it.
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