|
@@ -1,23 +1,26 @@
|
|
|
package com.ruoyi.post.service.impl;
|
|
|
|
|
|
+import com.ruoyi.common.constant.UserConstants;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.post.domain.PostBulletin;
|
|
|
import com.ruoyi.post.domain.PostNews;
|
|
|
import com.ruoyi.post.mapper.PostBulletinMapper;
|
|
|
+import com.ruoyi.post.mapper.PostNewsMapper;
|
|
|
import com.ruoyi.post.service.IPostBulletinService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @Author HuiANan
|
|
|
* @Date 2023/1/13 17:19
|
|
|
* @Exegesis:
|
|
|
*/
|
|
|
@Service
|
|
|
-public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
-{
|
|
|
+public class PostBulletinServiceImpl implements IPostBulletinService {
|
|
|
@Resource
|
|
|
private PostBulletinMapper postBulletinMapper;
|
|
|
|
|
@@ -28,8 +31,7 @@ public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
* @return 通知公告管理;
|
|
|
*/
|
|
|
@Override
|
|
|
- public PostBulletin selectPostBulletinByNoticeId(Integer noticeId)
|
|
|
- {
|
|
|
+ public PostBulletin selectPostBulletinByNoticeId(Integer noticeId) {
|
|
|
return postBulletinMapper.selectPostBulletinByNoticeId(noticeId);
|
|
|
}
|
|
|
|
|
@@ -40,20 +42,18 @@ public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
* @return 通知公告管理;
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<PostBulletin> selectPostBulletinList(PostBulletin postBulletin)
|
|
|
- {
|
|
|
+ public List<PostBulletin> selectPostBulletinList(PostBulletin postBulletin) {
|
|
|
return postBulletinMapper.selectPostBulletinList(postBulletin);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增通知公告管理; InnoDB free: 8192 kB
|
|
|
+ * 新增通知公告管理;
|
|
|
*
|
|
|
* @param postBulletin 通知公告管理;
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int insertPostBulletin(PostBulletin postBulletin)
|
|
|
- {
|
|
|
+ public int insertPostBulletin(PostBulletin postBulletin) {
|
|
|
postBulletin.setCreateTime(DateUtils.getNowDate());
|
|
|
return postBulletinMapper.insertPostBulletin(postBulletin);
|
|
|
}
|
|
@@ -65,8 +65,7 @@ public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updatePostBulletin(PostBulletin postBulletin)
|
|
|
- {
|
|
|
+ public int updatePostBulletin(PostBulletin postBulletin) {
|
|
|
postBulletin.setUpdateTime(DateUtils.getNowDate());
|
|
|
return postBulletinMapper.updatePostBulletin(postBulletin);
|
|
|
}
|
|
@@ -78,8 +77,7 @@ public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deletePostBulletinByNoticeIds(Integer[] noticeIds)
|
|
|
- {
|
|
|
+ public int deletePostBulletinByNoticeIds(Integer[] noticeIds) {
|
|
|
return postBulletinMapper.deletePostBulletinByNoticeIds(noticeIds);
|
|
|
}
|
|
|
|
|
@@ -90,25 +88,30 @@ public class PostBulletinServiceImpl implements IPostBulletinService
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deletePostBulletinByNoticeId(Integer noticeId)
|
|
|
- {
|
|
|
+ public int deletePostBulletinByNoticeId(Integer noticeId) {
|
|
|
return postBulletinMapper.deletePostBulletinByNoticeId(noticeId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 判断消息标题是否重复
|
|
|
- * @param postNews
|
|
|
+ * 公告及公告内容为空的判断
|
|
|
+ *
|
|
|
+ * @param postBulletin
|
|
|
*/
|
|
|
@Override
|
|
|
- public void newsTitleIfRepeat(PostNews postNews) {
|
|
|
+ public String newsTitleAndNewsContentIsNull(PostBulletin postBulletin) {
|
|
|
+ //查询内容以及标题是否存在
|
|
|
+ String PostNewsId = StringUtils.isNull(postBulletin.getNoticeId()) ? "标题以及内容不存在" : postBulletin.getNoticeId().toString();
|
|
|
+ String title = postBulletinMapper.checkTitleAndContentIsExit(postBulletin.getNoticeTitle(), postBulletin.getNoticeContent());
|
|
|
+ if (StringUtils.isNotNull(title) && postBulletin.getNoticeId().toString() != PostNewsId) {
|
|
|
+ return UserConstants.NOT_UNIQUE;
|
|
|
+ }
|
|
|
+ return UserConstants.UNIQUE;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- /**
|
|
|
- * 消息标题以及消息内容为空判断
|
|
|
- * @param postNews
|
|
|
- */
|
|
|
@Override
|
|
|
- public void newsTitleAndNewsContentIsNull(PostNews postNews) {
|
|
|
-
|
|
|
+ public PostBulletin selectViewDetail(Integer noticeId) {
|
|
|
+ return postBulletinMapper.selectViewDetails(noticeId);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|