style(entity,dto,service,...): 实体等pojo主键变为Long类型

主要对article实体等pojo主键变为Long类型,并对其涉及到的代码作一系列适配
article部分代码对service实现返回map做一系列修正
This commit is contained in:
Kould 2022-07-10 22:31:58 +08:00
parent e9dbda42b0
commit 0744e48eb9
62 changed files with 393 additions and 302 deletions

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.config;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rymcu.forest.core.constant.ShiroConstants;
import com.rymcu.forest.core.exception.CaptchaException;
import com.rymcu.forest.entity.Permission;
@ -106,7 +107,8 @@ public class BaseShiroRealm extends AuthorizingRealm {
private static final long serialVersionUID = 1L;
private Integer id; // 编号
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id; // 编号
private String account; // 登录名
private String name; // 姓名
private boolean mobileLogin; // 是否手机登录
@ -120,7 +122,7 @@ public class BaseShiroRealm extends AuthorizingRealm {
this.mobileLogin = mobileLogin;
}
public Integer getId() {
public Long getId() {
return id;
}

View File

@ -0,0 +1,24 @@
package com.rymcu.forest.core.exception;
public class ContentNotExistException extends RuntimeException{
private static final long serialVersionUID = 3206734387536223284L;
public ContentNotExistException() {
}
public ContentNotExistException(String message) {
super(message);
}
public ContentNotExistException(String message, Throwable cause) {
super(message, cause);
}
public ContentNotExistException(Throwable cause) {
super(cause);
}
public ContentNotExistException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,25 @@
package com.rymcu.forest.core.exception;
public class DataDuplicationException extends RuntimeException {
private static final long serialVersionUID = 3206744387536223284L;
public DataDuplicationException() {
}
public DataDuplicationException(String message) {
super(message);
}
public DataDuplicationException(String message, Throwable cause) {
super(message, cause);
}
public DataDuplicationException(Throwable cause) {
super(cause);
}
public DataDuplicationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,26 @@
package com.rymcu.forest.core.exception;
public class UltraViresException extends RuntimeException {
private static final long serialVersionUID = 3206744387536228284L;
public UltraViresException() {
super();
}
public UltraViresException(String message) {
super(message);
}
public UltraViresException(String message, Throwable cause) {
super(message, cause);
}
public UltraViresException(Throwable cause) {
super(cause);
}
protected UltraViresException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -90,7 +90,7 @@ public class VisitAspect {
if (StringUtils.isBlank(param) || "undefined".equals(param) || "null".equals(param)) {
break;
}
Integer id = Integer.parseInt(param);
Long id = Long.parseLong(param);
articleService.incrementArticleViewCount(id);
break;
default:

View File

@ -76,7 +76,7 @@ public class AuthorshipAspect {
}
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
String idArticle;
Integer idAuthor = 0;
Long idAuthor = 0l;
if (isAjax(request)) {
Object[] objects = joinPoint.getArgs();
JSONObject jsonObject;

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@ -11,13 +12,15 @@ import java.util.List;
*/
@Data
public class ArticleDTO {
private Integer idArticle;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle;
/** 文章标题 */
private String articleTitle;
/** 文章缩略图 */
private String articleThumbnailUrl;
/** 文章作者id */
private Integer articleAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long articleAuthorId;
/** 文章作者 */
private String articleAuthorName;
/** 文章作者头像 */

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
@ -7,12 +8,13 @@ import lombok.Data;
*/
@Data
public class ArticleTagDTO {
private Integer idArticleTag;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticleTag;
private Integer idTag;
private Integer idArticle;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle;
private String tagTitle;
@ -22,5 +24,6 @@ public class ArticleTagDTO {
private String tagIconPath;
private Integer tagAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long tagAuthorId;
}

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
@ -8,7 +9,8 @@ import lombok.Data;
@Data
public class Author {
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
private String userNickname;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rymcu.forest.entity.Notification;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -11,7 +12,8 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
public class NotificationDTO extends Notification {
private Integer idNotification;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idNotification;
private String dataTitle;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.List;
@ -10,11 +11,14 @@ import java.util.List;
@Data
public class PortfolioArticleDTO {
private Integer id;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
private Integer idPortfolio;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio;
private Integer idArticle;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle;
private String headImgUrl;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@ -10,11 +11,13 @@ import java.util.Date;
@Data
public class PortfolioDTO {
private Integer idPortfolio;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio;
/** 作品集头像 */
private String headImgUrl;
/** 作品集作者 */
private Integer portfolioAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long portfolioAuthorId;
/** 作品集作者 */
private String portfolioAuthorName;
/** 作品集作者头像 */

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
@ -8,7 +9,8 @@ import lombok.Data;
@Data
public class UserDTO {
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
private String account;

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -13,7 +14,8 @@ import java.util.Date;
@Data
public class UserInfoDTO implements Serializable {
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
private String account;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -19,13 +20,15 @@ public class Article implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer idArticle;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idArticle;
/** 文章标题 */
private String articleTitle;
/** 文章缩略图 */
private String articleThumbnailUrl;
/** 文章作者id */
private Integer articleAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long articleAuthorId;
/** 文章类型 */
private String articleType;
/** 文章标签 */

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -29,7 +30,8 @@ public class ArticleThumbsUp implements Serializable, Cloneable {
/**
* 用户表主键
*/
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
/**
* 点赞时间
*/

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -29,7 +30,8 @@ public class BankAccount {
/** 账户余额 */
private BigDecimal accountBalance;
/** 账户所有者 */
private Integer accountOwner;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long accountOwner;
/** 创建时间 */
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -19,22 +20,26 @@ public class Comment implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer idComment;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idComment;
/** 评论内容 */
@Column(name = "comment_content")
private String commentContent;
/** 作者 id */
@Column(name = "comment_author_id")
private Integer commentAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentAuthorId;
/** 文章 id */
@Column(name = "comment_article_id")
private Integer commentArticleId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentArticleId;
/** 锚点 url */
@Column(name = "comment_sharp_url")
private String commentSharpUrl;
/** 父评论 id */
@Column(name = "comment_original_comment_id")
private Integer commentOriginalCommentId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long commentOriginalCommentId;
/** 状态 */
@Column(name = "comment_status")
private String commentStatus;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -18,13 +19,16 @@ public class Follow implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer idFollow;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idFollow;
/** 关注者 id */
@Column(name = "follower_id")
private Integer followerId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long followerId;
/** 关注数据 id */
@Column(name = "following_id")
private Integer followingId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long followingId;
/** 0用户1标签2帖子收藏3帖子关注 */
@Column(name = "following_type")
private String followingType;

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -23,12 +24,14 @@ public class Notification implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer idNotification;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idNotification;
/**
* 用户id
*/
@Column(name = "id_user")
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
/**
* 数据类型
*/
@ -38,7 +41,8 @@ public class Notification implements Serializable,Cloneable {
* 数据id
*/
@Column(name = "data_id")
private Integer dataId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long dataId;
/**
* 数据摘要
*/

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.*;
@ -15,14 +16,16 @@ public class Portfolio {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer idPortfolio;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idPortfolio;
/** 作品集头像 */
@Column(name = "portfolio_head_img_url")
private String headImgUrl;
/** 作品集名称 */
private String portfolioTitle;
/** 作品集作者 */
private Integer portfolioAuthorId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long portfolioAuthorId;
/** 作品集介绍 */
private String portfolioDescription;
/** 作品集介绍 Html */

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.GeneratedValue;
@ -28,11 +29,13 @@ public class Sponsor implements Serializable, Cloneable {
/**
* 数据主键
*/
private Integer dataId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long dataId;
/**
* 赞赏人
*/
private Integer sponsor;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long sponsor;
/**
* 赞赏日期
*/

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import tk.mybatis.mapper.annotation.ColumnType;
@ -21,7 +22,8 @@ public class User implements Serializable,Cloneable {
@Id
@Column(name = "id")
@GeneratedValue(generator = "JDBC")
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
/**
* 登录账号

View File

@ -13,7 +13,7 @@ import javax.persistence.Table;
public class UserExtend {
@Id
private Integer idUser;
private Long idUser;
private String github;

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.lucene.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -22,7 +23,8 @@ import javax.persistence.Column;
public class UserLucene {
/** 用户编号 */
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
/** 昵称 */
private String nickname;

View File

@ -161,7 +161,7 @@ public class UserLuceneServiceImpl implements UserLuceneService {
}
resList.add(
UserLucene.builder()
.idUser(Integer.valueOf(hitDoc.get("id")))
.idUser(Long.valueOf(hitDoc.get("id")))
.nickname(titleValue.toString())
.signature(baikeValue.toString())
.score(String.valueOf(score))

View File

@ -30,7 +30,7 @@ public interface ArticleMapper extends Mapper<Article> {
* @param type
* @return
*/
ArticleDTO selectArticleDTOById(@Param("id") Integer id, @Param("type") int type);
ArticleDTO selectArticleDTOById(@Param("id") Long id, @Param("type") int type);
/**
* 保存文章内容
@ -39,7 +39,7 @@ public interface ArticleMapper extends Mapper<Article> {
* @param articleContentHtml
* @return
*/
Integer insertArticleContent(@Param("idArticle") Integer idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
Integer insertArticleContent(@Param("idArticle") Long idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
/**
* 更新文章内容
@ -48,14 +48,14 @@ public interface ArticleMapper extends Mapper<Article> {
* @param articleContentHtml
* @return
*/
Integer updateArticleContent(@Param("idArticle") Integer idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
Integer updateArticleContent(@Param("idArticle") Long idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
/**
* 获取文章正文内容
* @param idArticle
* @return
*/
ArticleContent selectArticleContent(@Param("idArticle") Integer idArticle);
ArticleContent selectArticleContent(@Param("idArticle") Long idArticle);
/**
* 获取主题下文章列表
@ -76,21 +76,21 @@ public interface ArticleMapper extends Mapper<Article> {
* @param idUser
* @return
*/
List<ArticleDTO> selectUserArticles(@Param("idUser") Integer idUser);
List<ArticleDTO> selectUserArticles(@Param("idUser") Long idUser);
/**
* 删除文章标签
* @param id
* @return
*/
Integer deleteTagArticle(@Param("id") Integer id);
Integer deleteTagArticle(@Param("id") Long id);
/**
* 获取文章标签列表
* @param idArticle
* @return
*/
List<ArticleTagDTO> selectTags(@Param("idArticle") Integer idArticle);
List<ArticleTagDTO> selectTags(@Param("idArticle") Long idArticle);
/**
* 更新文章浏览数
@ -98,28 +98,28 @@ public interface ArticleMapper extends Mapper<Article> {
* @param articleViewCount
* @return
*/
Integer updateArticleViewCount(@Param("id") Integer id, @Param("articleViewCount") Integer articleViewCount);
Integer updateArticleViewCount(@Param("id") Long id, @Param("articleViewCount") Integer articleViewCount);
/**
* 获取草稿列表
* @param idUser
* @return
*/
List<ArticleDTO> selectDrafts(@Param("idUser") Integer idUser);
List<ArticleDTO> selectDrafts(@Param("idUser") Long idUser);
/**
* 删除未使用的文章标签
* @param idArticleTag
* @return
*/
Integer deleteUnusedArticleTag(@Param("idArticleTag") Integer idArticleTag);
Integer deleteUnusedArticleTag(@Param("idArticleTag") Long idArticleTag);
/**
* 查询作品集下文章
* @param idPortfolio
* @return
*/
List<ArticleDTO> selectArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio);
List<ArticleDTO> selectArticlesByIdPortfolio(@Param("idPortfolio") Long idPortfolio);
/**
* 查询作品集未绑定文章
@ -128,14 +128,14 @@ public interface ArticleMapper extends Mapper<Article> {
* @param idUser
* @return
*/
List<ArticleDTO> selectUnbindArticlesByIdPortfolio(@Param("idPortfolio") Integer idPortfolio, @Param("searchText") String searchText, @Param("idUser") Integer idUser);
List<ArticleDTO> selectUnbindArticlesByIdPortfolio(@Param("idPortfolio") Long idPortfolio, @Param("searchText") String searchText, @Param("idUser") Long idUser);
/**
* 查询文章所属作品集列表
* @param idArticle
* @return
*/
List<PortfolioArticleDTO> selectPortfolioArticles(@Param("idArticle") Integer idArticle);
List<PortfolioArticleDTO> selectPortfolioArticles(@Param("idArticle") Long idArticle);
/**
* 更新文章标签
@ -143,21 +143,21 @@ public interface ArticleMapper extends Mapper<Article> {
* @param tags
* @return
*/
Integer updateArticleTags(@Param("idArticle") Integer idArticle, @Param("tags") String tags);
Integer updateArticleTags(@Param("idArticle") Long idArticle, @Param("tags") String tags);
/**
* 判断是否有评论
* @param id
* @return
*/
boolean existsCommentWithPrimaryKey(@Param("id") Integer id);
boolean existsCommentWithPrimaryKey(@Param("id") Long id);
/**
* 删除关联作品集数据
* @param id
* @return
*/
Integer deleteLinkedPortfolioData(@Param("id") Integer id);
Integer deleteLinkedPortfolioData(@Param("id") Long id);
/**
* 更新文章连接及预览内容
@ -167,7 +167,7 @@ public interface ArticleMapper extends Mapper<Article> {
* @param articlePreviewContent
* @return
*/
Integer updateArticleLinkAndPreviewContent(@Param("idArticle") Integer idArticle, @Param("articleLink") String articleLink, @Param("articlePermalink") String articlePermalink, @Param("articlePreviewContent") String articlePreviewContent);
Integer updateArticleLinkAndPreviewContent(@Param("idArticle") Long idArticle, @Param("articleLink") String articleLink, @Param("articlePermalink") String articlePermalink, @Param("articlePreviewContent") String articlePreviewContent);
/**
* 根据专题主键及当前文章排序号获取专题下文章大纲
@ -175,7 +175,7 @@ public interface ArticleMapper extends Mapper<Article> {
* @param sortNo
* @return
*/
List<ArticleDTO> selectPortfolioArticlesByIdPortfolioAndSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("sortNo") Integer sortNo);
List<ArticleDTO> selectPortfolioArticlesByIdPortfolioAndSortNo(@Param("idPortfolio") Long idPortfolio, @Param("sortNo") Integer sortNo);
/**
* 更新文章优选状态
@ -183,13 +183,13 @@ public interface ArticleMapper extends Mapper<Article> {
* @param articlePerfect
* @return
*/
int updatePerfect(@Param("idArticle") Integer idArticle, @Param("articlePerfect") String articlePerfect);
int updatePerfect(@Param("idArticle") Long idArticle, @Param("articlePerfect") String articlePerfect);
/**
* 删除文章关联文章内容表信息
* @param idArticle
*/
void deleteArticleContent(@Param("idArticle") Integer idArticle);
void deleteArticleContent(@Param("idArticle") Long idArticle);
/**
* 获取公告

View File

@ -39,7 +39,7 @@ public interface CommentMapper extends Mapper<Comment> {
* @param commentSharpUrl
* @return
*/
Integer updateCommentSharpUrl(@Param("idComment") Integer idComment, @Param("commentSharpUrl") String commentSharpUrl);
Integer updateCommentSharpUrl(@Param("idComment") Long idComment, @Param("commentSharpUrl") String commentSharpUrl);
/**
* 获取评论列表数据

View File

@ -18,19 +18,19 @@ public interface FollowMapper extends Mapper<Follow> {
* @param followingType
* @return
*/
Boolean isFollow(@Param("followingId") Integer followingId, @Param("followerId") Integer followerId, @Param("followingType") String followingType);
Boolean isFollow(@Param("followingId") Integer followingId, @Param("followerId") Long followerId, @Param("followingType") String followingType);
/**
* 查询用户粉丝
* @param idUser
* @return
*/
List<UserDTO> selectUserFollowersByUser(@Param("idUser") Integer idUser);
List<UserDTO> selectUserFollowersByUser(@Param("idUser") Long idUser);
/**
* 查询用户关注用户
* @param idUser
* @return
*/
List<UserDTO> selectUserFollowingsByUser(@Param("idUser") Integer idUser);
List<UserDTO> selectUserFollowingsByUser(@Param("idUser") Long idUser);
}

View File

@ -17,14 +17,14 @@ public interface NotificationMapper extends Mapper<Notification> {
* @param idUser
* @return
*/
List<Notification> selectUnreadNotifications(@Param("idUser") Integer idUser);
List<Notification> selectUnreadNotifications(@Param("idUser") Long idUser);
/**
* 获取消息数据
* @param idUser
* @return
*/
List<NotificationDTO> selectNotifications(@Param("idUser") Integer idUser);
List<NotificationDTO> selectNotifications(@Param("idUser") Long idUser);
/**
* 获取消息数据
@ -33,7 +33,7 @@ public interface NotificationMapper extends Mapper<Notification> {
* @param dataType
* @return
*/
Notification selectNotification(@Param("idUser") Integer idUser, @Param("dataId") Integer dataId, @Param("dataType") String dataType);
Notification selectNotification(@Param("idUser") Long idUser, @Param("dataId") Long dataId, @Param("dataType") String dataType);
/**
* 创建消息通知
@ -43,21 +43,21 @@ public interface NotificationMapper extends Mapper<Notification> {
* @param dataSummary
* @return
*/
Integer insertNotification(@Param("idUser") Integer idUser, @Param("dataId") Integer dataId, @Param("dataType") String dataType, @Param("dataSummary") String dataSummary);
Integer insertNotification(@Param("idUser") Long idUser, @Param("dataId") Long dataId, @Param("dataType") String dataType, @Param("dataSummary") String dataSummary);
/**
* 标记消息已读
* @param id
* @return
*/
Integer readNotification(@Param("id") Integer id);
Integer readNotification(@Param("id") Long id);
/**
* 标记所有消息已读
* @param idUser
* @return
*/
Integer readAllNotification(@Param("idUser") Integer idUser);
Integer readAllNotification(@Param("idUser") Long idUser);
/**
* 删除相关未读消息
@ -65,5 +65,5 @@ public interface NotificationMapper extends Mapper<Notification> {
* @param dataType
* @return
*/
Integer deleteUnreadNotification(@Param("dataId") Integer dataId, @Param("dataType") String dataType);
Integer deleteUnreadNotification(@Param("dataId") Long dataId, @Param("dataType") String dataType);
}

View File

@ -16,7 +16,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param idUser
* @return
*/
List<PortfolioDTO> selectUserPortfoliosByIdUser(@Param("idUser") Integer idUser);
List<PortfolioDTO> selectUserPortfoliosByIdUser(@Param("idUser") Long idUser);
/**
* 查询作品集
@ -24,14 +24,14 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param type
* @return
*/
PortfolioDTO selectPortfolioDTOById(@Param("id") Integer id, @Param("type") Integer type);
PortfolioDTO selectPortfolioDTOById(@Param("id") Long id, @Param("type") Integer type);
/**
* 统计作品集下文章数
* @param idPortfolio
* @return
*/
Integer selectCountArticleNumber(@Param("idPortfolio") Integer idPortfolio);
Integer selectCountArticleNumber(@Param("idPortfolio") Long idPortfolio);
/**
* 查询文章是否已绑定
@ -39,7 +39,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param idPortfolio
* @return
*/
Integer selectCountPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio);
Integer selectCountPortfolioArticle(@Param("idArticle") Long idArticle, @Param("idPortfolio") Long idPortfolio);
/**
* 插入文章与作品集绑定数据
@ -48,14 +48,14 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param maxSortNo
* @return
*/
Integer insertPortfolioArticle(@Param("idArticle") Integer idArticle, @Param("idPortfolio") Integer idPortfolio, @Param("maxSortNo") Integer maxSortNo);
Integer insertPortfolioArticle(@Param("idArticle") Long idArticle, @Param("idPortfolio") Long idPortfolio, @Param("maxSortNo") Integer maxSortNo);
/**
* 查询作品集下最大排序号
* @param idPortfolio
* @return
*/
Integer selectMaxSortNo(@Param("idPortfolio") Integer idPortfolio);
Integer selectMaxSortNo(@Param("idPortfolio") Long idPortfolio);
/**
* 更新文章排序号
@ -64,7 +64,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param sortNo
* @return
*/
Integer updateArticleSortNo(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle, @Param("sortNo") Integer sortNo);
Integer updateArticleSortNo(@Param("idPortfolio") Long idPortfolio, @Param("idArticle") Long idArticle, @Param("sortNo") Integer sortNo);
/**
* 取消绑定文章
@ -72,7 +72,7 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @param idArticle
* @return
*/
Integer unbindArticle(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle);
Integer unbindArticle(@Param("idPortfolio") Long idPortfolio, @Param("idArticle") Long idArticle);
/**
* 获取作品集列表数据

View File

@ -8,7 +8,7 @@ import java.util.List;
public interface RoleMapper extends Mapper<Role> {
List<Role> selectRoleByIdUser(@Param("id") Integer id);
List<Role> selectRoleByIdUser(@Param("id") Long id);
Role selectRoleByInputCode(@Param("inputCode") String inputCode);

View File

@ -13,5 +13,5 @@ public interface SponsorMapper extends Mapper<Sponsor> {
* @param idArticle
* @return
*/
Integer updateArticleSponsorCount(@Param("idArticle") Integer idArticle);
Integer updateArticleSponsorCount(@Param("idArticle") Long idArticle);
}

View File

@ -18,7 +18,7 @@ public interface TagMapper extends Mapper<Tag> {
* @param idArticle
* @return
*/
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Long idArticle);
/**
* 统计标签使用数(文章)
@ -26,7 +26,7 @@ public interface TagMapper extends Mapper<Tag> {
* @param idArticle
* @return
*/
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Long idArticle);
/**
* 获取用户标签数
@ -34,7 +34,7 @@ public interface TagMapper extends Mapper<Tag> {
* @param idTag
* @return
*/
Integer selectCountUserTagById(@Param("idUser") Integer idUser, @Param("idTag") Integer idTag);
Integer selectCountUserTagById(@Param("idUser") Long idUser, @Param("idTag") Integer idTag);
/**
* 插入用户标签信息
@ -43,7 +43,7 @@ public interface TagMapper extends Mapper<Tag> {
* @param type
* @return
*/
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Integer idUser, @Param("type") Integer type);
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Long idUser, @Param("type") Integer type);
/**
* 删除未使用标签

View File

@ -28,7 +28,7 @@ public interface UserMapper extends Mapper<User> {
* @param idRole
* @return
*/
Integer insertUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
Integer insertUserRole(@Param("idUser") Long idUser, @Param("idRole") Integer idRole);
/**
* 根据账号获取获取用户信息
@ -57,7 +57,7 @@ public interface UserMapper extends Mapper<User> {
* @param idUser
* @return
*/
Integer selectRoleWeightsByUser(@Param("idUser") Integer idUser);
Integer selectRoleWeightsByUser(@Param("idUser") Long idUser);
/**
* 更新用户权限
@ -73,7 +73,7 @@ public interface UserMapper extends Mapper<User> {
* @param status
* @return
*/
Integer updateStatus(@Param("idUser") Integer idUser, @Param("status") String status);
Integer updateStatus(@Param("idUser") Long idUser, @Param("status") String status);
/**
* 根据昵称获取重名用户数量
@ -99,7 +99,7 @@ public interface UserMapper extends Mapper<User> {
* @param sex
* @return
*/
Integer updateUserInfo(@Param("idUser") Integer idUser, @Param("nickname") String nickname, @Param("avatarType") String avatarType, @Param("avatarUrl") String avatarUrl, @Param("signature") String signature, @Param("sex") String sex);
Integer updateUserInfo(@Param("idUser") Long idUser, @Param("nickname") String nickname, @Param("avatarType") String avatarType, @Param("avatarUrl") String avatarUrl, @Param("signature") String signature, @Param("sex") String sex);
/**
* 验证昵称是否重复
@ -107,20 +107,20 @@ public interface UserMapper extends Mapper<User> {
* @param nickname
* @return
*/
Integer checkNicknameByIdUser(@Param("idUser") Integer idUser, @Param("nickname") String nickname);
Integer checkNicknameByIdUser(@Param("idUser") Long idUser, @Param("nickname") String nickname);
/**
* 根据用户 ID 获取作者信息
* @param id
* @return
*/
Author selectAuthor(@Param("id") Integer id);
Author selectAuthor(@Param("id") Long id);
/**
* 更新用户最后登录时间
* @param idUser
* @return
*/
Integer updateLastLoginTime(@Param("idUser") Integer idUser);
Integer updateLastLoginTime(@Param("idUser") Long idUser);
/**
* 更换邮箱

View File

@ -29,7 +29,7 @@ public interface ArticleService extends Service<Article> {
* @param type
* @return
* */
ArticleDTO findArticleDTOById(Integer id, Integer type);
ArticleDTO findArticleDTOById(Long id, Integer type);
/**
* 查询主题下文章列表
@ -50,7 +50,7 @@ public interface ArticleService extends Service<Article> {
* @param idUser
* @return
* */
List<ArticleDTO> findUserArticlesByIdUser(Integer idUser);
List<ArticleDTO> findUserArticlesByIdUser(Long idUser);
/**
* 新增/更新文章
@ -60,7 +60,7 @@ public interface ArticleService extends Service<Article> {
* @throws BaseApiException
* @return
* */
Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException;
Long postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException;
/**
* 删除文章
@ -68,13 +68,13 @@ public interface ArticleService extends Service<Article> {
* @return
* @throws BaseApiException
* */
Map delete(Integer id) throws BaseApiException;
Integer delete(Long id) throws BaseApiException;
/**
* 增量文章浏览数
* @param id
*/
void incrementArticleViewCount(Integer id);
void incrementArticleViewCount(Long id);
/**
* 获取分享链接数据
@ -82,7 +82,7 @@ public interface ArticleService extends Service<Article> {
* @throws BaseApiException
* @return
*/
Map share(Integer id) throws BaseApiException;
public String share(Integer id) throws BaseApiException;
/**
* 查询草稿文章类别
@ -96,7 +96,7 @@ public interface ArticleService extends Service<Article> {
* @param idPortfolio
* @return
*/
List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio);
List<ArticleDTO> findArticlesByIdPortfolio(Long idPortfolio);
/**
* 查询作品集下未绑定文章
@ -105,7 +105,7 @@ public interface ArticleService extends Service<Article> {
* @param idUser
* @return
*/
List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser);
List<ArticleDTO> selectUnbindArticles(Long idPortfolio, String searchText, Long idUser);
/**
* 更新文章标签
@ -115,7 +115,7 @@ public interface ArticleService extends Service<Article> {
* @throws UnsupportedEncodingException
* @throws BaseApiException
*/
Map updateTags(Integer idArticle, String tags) throws UnsupportedEncodingException, BaseApiException;
Boolean updateTags(Long idArticle, String tags) throws UnsupportedEncodingException, BaseApiException;
/**
* 更新文章优选状态
@ -123,7 +123,7 @@ public interface ArticleService extends Service<Article> {
* @param articlePerfect
* @return
*/
Map updatePerfect(Integer idArticle, String articlePerfect);
Boolean updatePerfect(Long idArticle, String articlePerfect);
/**
* 获取公告列表

View File

@ -24,7 +24,7 @@ public interface BankAccountService extends Service<BankAccount> {
* @param idUser
* @return
*/
BankAccountDTO findBankAccountByIdUser(Integer idUser);
BankAccountDTO findBankAccountByIdUser(Long idUser);
/**
* 根据账户查询银行账户信息

View File

@ -42,7 +42,7 @@ public interface FollowService extends Service<Follow> {
* @param followingId
* @return
*/
List<Follow> findByFollowingId(String followType, Integer followingId);
List<Follow> findByFollowingId(String followType, Long followingId);

View File

@ -17,14 +17,14 @@ public interface NotificationService extends Service<Notification> {
* @param idUser
* @return
*/
List<Notification> findUnreadNotifications(Integer idUser);
List<Notification> findUnreadNotifications(Long idUser);
/**
* 获取消息数据
* @param idUser
* @return
*/
List<NotificationDTO> findNotifications(Integer idUser);
List<NotificationDTO> findNotifications(Long idUser);
/**
* 获取消息数据
@ -33,7 +33,7 @@ public interface NotificationService extends Service<Notification> {
* @param dataType
* @return
*/
Notification findNotification(Integer idUser, Integer dataId, String dataType);
Notification findNotification(Long idUser, Long dataId, String dataType);
/**
* 创建系统通知
@ -43,14 +43,14 @@ public interface NotificationService extends Service<Notification> {
* @param dataSummary
* @return
*/
Integer save(Integer idUser, Integer dataId, String dataType, String dataSummary);
Integer save(Long idUser, Long dataId, String dataType, String dataSummary);
/**
* 标记消息已读
* @param id
* @return
*/
Integer readNotification(Integer id);
Integer readNotification(Long id);
/**
* 标记所有消息已读
@ -65,5 +65,5 @@ public interface NotificationService extends Service<Notification> {
* @param dataType
* @return
*/
Integer deleteUnreadNotification(Integer dataId, String dataType);
Integer deleteUnreadNotification(Long dataId, String dataType);
}

View File

@ -27,7 +27,7 @@ public interface PortfolioService extends Service<Portfolio> {
* @param type
* @return
*/
PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type);
PortfolioDTO findPortfolioDTOById(Long idPortfolio, Integer type);
/**
* 保持/更新作品集
@ -47,7 +47,7 @@ public interface PortfolioService extends Service<Portfolio> {
* @throws BaseApiException
* @return
*/
Map findUnbindArticles(Integer page, Integer rows, String searchText, Integer idPortfolio) throws BaseApiException;
Map findUnbindArticles(Integer page, Integer rows, String searchText, Long idPortfolio) throws BaseApiException;
/**
* 绑定文章
@ -69,14 +69,14 @@ public interface PortfolioService extends Service<Portfolio> {
* @param idArticle
* @return
*/
Map unbindArticle(Integer idPortfolio, Integer idArticle);
Map unbindArticle(Long idPortfolio, Long idArticle);
/**
* 删除作品集
* @param idPortfolio
* @return
*/
Map deletePortfolio(Integer idPortfolio) throws BaseApiException;
Map deletePortfolio(Long idPortfolio) throws BaseApiException;
/**
* 获取作品集列表数据

View File

@ -27,7 +27,7 @@ public interface RoleService extends Service<Role> {
* @param idUser
* @return
* */
List<Role> findByIdUser(Integer idUser);
List<Role> findByIdUser(Long idUser);
/**
* 更新用户状态

View File

@ -36,7 +36,7 @@ public interface TransactionRecordService extends Service<TransactionRecord> {
* @return
* @throws Exception
*/
TransactionRecord userTransfer(Integer toUserId, Integer formUserId, TransactionEnum transactionType) throws Exception;
TransactionRecord userTransfer(Long toUserId, Long formUserId, TransactionEnum transactionType) throws Exception;
/**
* 社区银行转账/奖励发放
@ -45,7 +45,7 @@ public interface TransactionRecordService extends Service<TransactionRecord> {
* @return
* @throws Exception
*/
TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) throws Exception;
TransactionRecord bankTransfer(Long idUser, TransactionEnum transactionType) throws Exception;
/**
* 发放新手奖励

View File

@ -71,7 +71,7 @@ public interface UserService extends Service<User> {
* @param status 状态
* @return Map
* */
Map updateStatus(Integer idUser, String status);
Map updateStatus(Long idUser, String status);
/**
* 获取用户信息
@ -93,21 +93,21 @@ public interface UserService extends Service<User> {
* @param nickname
* @return
*/
Map checkNickname(Integer idUser, String nickname);
Map checkNickname(Long idUser, String nickname);
/**
* 获取用户权限
* @param idUser
* @return
*/
Integer findRoleWeightsByUser(Integer idUser);
Integer findRoleWeightsByUser(Long idUser);
/**
* 查询作者信息
* @param idUser
* @return
*/
Author selectAuthor(Integer idUser);
Author selectAuthor(Long idUser);
/**
* 更新用户扩展信息

View File

@ -1,6 +1,9 @@
package com.rymcu.forest.service.impl;
import com.rymcu.forest.core.constant.NotificationConstant;
import com.rymcu.forest.core.exception.ContentNotExistException;
import com.rymcu.forest.core.exception.DataDuplicationException;
import com.rymcu.forest.core.exception.UltraViresException;
import com.rymcu.forest.core.service.AbstractService;
import com.rymcu.forest.dto.*;
import com.rymcu.forest.entity.Article;
@ -68,7 +71,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
}
@Override
public ArticleDTO findArticleDTOById(Integer id, Integer type) {
public ArticleDTO findArticleDTOById(Long id, Integer type) {
ArticleDTO articleDTO = articleMapper.selectArticleDTOById(id, type);
if (articleDTO == null) {
return null;
@ -90,7 +93,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
}
@Override
public List<ArticleDTO> findUserArticlesByIdUser(Integer idUser) {
public List<ArticleDTO> findUserArticlesByIdUser(Long idUser) {
List<ArticleDTO> list = articleMapper.selectUserArticles(idUser);
list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list;
@ -98,16 +101,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override
@Transactional(rollbackFor = {UnsupportedEncodingException.class, BaseApiException.class})
public Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException {
Map map = new HashMap(1);
if (StringUtils.isBlank(article.getArticleTitle())) {
map.put("message", "标题不能为空!");
return map;
}
if (StringUtils.isBlank(article.getArticleContent())) {
map.put("message", "正文不能为空!");
return map;
}
public Long postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException {
boolean isUpdate = false;
String articleTitle = article.getArticleTitle();
String articleTags = article.getArticleTags();
@ -122,14 +116,14 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
if (StringUtils.isNotBlank(reservedTag)) {
Integer roleWeights = userService.findRoleWeightsByUser(user.getIdUser());
if (roleWeights > ADMIN_ROLE_WEIGHTS) {
map.put("message", StringEscapeUtils.unescapeJava(reservedTag) + "标签为系统保留标签!");
return map;
throw new UltraViresException(StringEscapeUtils.unescapeJava(reservedTag) + "标签为系统保留标签!");
} else {
notification = true;
}
}
Article newArticle;
if (article.getIdArticle() == null || article.getIdArticle() == 0) {
Long idArticle = article.getIdArticle();
if (idArticle == null || idArticle == 0) {
newArticle = new Article();
newArticle.setArticleTitle(articleTitle);
newArticle.setArticleAuthorId(user.getIdUser());
@ -140,7 +134,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
articleMapper.insertSelective(newArticle);
articleMapper.insertArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml);
} else {
newArticle = articleMapper.selectByPrimaryKey(article.getIdArticle());
newArticle = articleMapper.selectByPrimaryKey(idArticle);
// 如果文章之前状态为草稿则应视为新发布文章
if (DEFAULT_STATUS.equals(newArticle.getArticleStatus())) {
isUpdate = true;
@ -151,38 +145,38 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
newArticle.setUpdatedTime(new Date());
articleMapper.updateArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml);
}
Long newArticleId = newArticle.getIdArticle();
// 发送相关通知
if (DEFAULT_STATUS.equals(newArticle.getArticleStatus())) {
// 发送系统通知
if (notification) {
NotificationUtils.sendAnnouncement(newArticle.getIdArticle(), NotificationConstant.Article, newArticle.getArticleTitle());
NotificationUtils.sendAnnouncement(newArticleId, NotificationConstant.Article, newArticle.getArticleTitle());
} else {
// 发送关注通知
StringBuilder dataSummary = new StringBuilder();
if (isUpdate) {
dataSummary.append(user.getNickname()).append("更新了文章: ").append(newArticle.getArticleTitle());
NotificationUtils.sendArticlePush(newArticle.getIdArticle(), NotificationConstant.UpdateArticle, dataSummary.toString(), newArticle.getArticleAuthorId());
NotificationUtils.sendArticlePush(newArticleId, NotificationConstant.UpdateArticle, dataSummary.toString(), newArticle.getArticleAuthorId());
} else {
dataSummary.append(user.getNickname()).append("发布了文章: ").append(newArticle.getArticleTitle());
NotificationUtils.sendArticlePush(newArticle.getIdArticle(), NotificationConstant.PostArticle, dataSummary.toString(), newArticle.getArticleAuthorId());
NotificationUtils.sendArticlePush(newArticleId, NotificationConstant.PostArticle, dataSummary.toString(), newArticle.getArticleAuthorId());
}
}
// 草稿不更新索引
if (isUpdate) {
log.info("更新文章索引id={}", newArticle.getIdArticle());
luceneService.updateArticle(newArticle.getIdArticle().toString());
log.info("更新文章索引id={}", newArticleId);
luceneService.updateArticle(newArticleId.toString());
} else {
log.info("写入文章索引id={}", newArticle.getIdArticle());
luceneService.writeArticle(newArticle.getIdArticle().toString());
log.info("写入文章索引id={}", newArticleId);
luceneService.writeArticle(newArticleId.toString());
}
// 更新文章链接
newArticle.setArticlePermalink(domain + "/article/" + newArticle.getIdArticle());
newArticle.setArticleLink("/article/" + newArticle.getIdArticle());
newArticle.setArticlePermalink(domain + "/article/" + newArticleId);
newArticle.setArticleLink("/article/" + newArticleId);
} else {
// 更新文章链接
newArticle.setArticlePermalink(domain + "/draft/" + newArticle.getIdArticle());
newArticle.setArticleLink("/draft/" + newArticle.getIdArticle());
newArticle.setArticlePermalink(domain + "/draft/" + newArticleId);
newArticle.setArticleLink("/draft/" + newArticleId);
}
tagService.saveTagArticle(newArticle, articleContentHtml);
@ -194,66 +188,24 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
newArticle.setArticlePreviewContent(previewContent);
}
articleMapper.updateByPrimaryKeySelective(newArticle);
map.put("id", newArticle.getIdArticle());
return map;
}
private String checkTags(String articleTags) {
// 判断文章是否有标签
if (StringUtils.isBlank(articleTags)) {
return "";
}
// 判断是否存在系统配置的保留标签词
Condition condition = new Condition(Tag.class);
condition.createCriteria().andEqualTo("tagReservation", "1");
List<Tag> tags = tagService.findByCondition(condition);
if (tags.isEmpty()) {
return "";
} else {
String[] articleTagArr = articleTags.split(",");
for (Tag tag : tags) {
if (StringUtils.isBlank(tag.getTagTitle())) {
continue;
}
for (String articleTag : articleTagArr) {
if (StringUtils.isBlank(articleTag)) {
continue;
}
if (articleTag.equals(tag.getTagTitle())) {
return tag.getTagTitle();
}
}
}
}
return "";
return newArticleId;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Map delete(Integer id) throws BaseApiException {
Map<String, String> map = new HashMap(1);
int result;
public Integer delete(Long id) throws BaseApiException {
// 判断是否有评论
boolean isHavComment = articleMapper.existsCommentWithPrimaryKey(id);
if (isHavComment) {
map.put("message", "已有评论的文章不允许删除!");
} else {
if (!articleMapper.existsCommentWithPrimaryKey(id)) {
// 删除关联数据(作品集关联关系,标签关联关系)
deleteLinkedData(id);
// 删除文章
result = articleMapper.deleteByPrimaryKey(id);
int result = articleMapper.deleteByPrimaryKey(id);
luceneService.deleteArticle(id.toString());
if (result < 1) {
map.put("message", "删除失败!");
}
}
return map;
return result;
} else throw new DataDuplicationException("已有评论的文章不允许删除!");
}
private void deleteLinkedData(Integer id) {
private void deleteLinkedData(Long id) {
// 删除关联作品集
articleMapper.deleteLinkedPortfolioData(id);
// 删除引用标签记录
@ -266,22 +218,20 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override
@Transactional(rollbackFor = Exception.class)
public void incrementArticleViewCount(Integer id) {
public void incrementArticleViewCount(Long id) {
Article article = articleMapper.selectByPrimaryKey(id);
Integer articleViewCount = article.getArticleViewCount() + 1;
articleMapper.updateArticleViewCount(article.getIdArticle(), articleViewCount);
}
@Override
public Map share(Integer id) throws BaseApiException {
public String share(Integer id) throws BaseApiException {
Article article = articleMapper.selectByPrimaryKey(id);
User user = UserUtils.getCurrentUserByToken();
if (Objects.isNull(user)) {
throw new BaseApiException(ErrorCode.INVALID_TOKEN);
}
Map map = new HashMap(2);
map.put("shareUrl", article.getArticlePermalink() + "?s=" + user.getAccount());
return map;
return article.getArticlePermalink() + "?s=" + user.getAccount();
}
@Override
@ -296,14 +246,14 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
}
@Override
public List<ArticleDTO> findArticlesByIdPortfolio(Integer idPortfolio) {
public List<ArticleDTO> findArticlesByIdPortfolio(Long idPortfolio) {
List<ArticleDTO> list = articleMapper.selectArticlesByIdPortfolio(idPortfolio);
list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list;
}
@Override
public List<ArticleDTO> selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) {
public List<ArticleDTO> selectUnbindArticles(Long idPortfolio, String searchText, Long idUser) {
List<ArticleDTO> list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser);
list.forEach(articleDTO -> genArticle(articleDTO, 0));
return list;
@ -311,32 +261,23 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
@Override
@Transactional(rollbackFor = Exception.class)
public Map updateTags(Integer idArticle, String tags) throws UnsupportedEncodingException, BaseApiException {
Map map = new HashMap(2);
public Boolean updateTags(Long idArticle, String tags) throws UnsupportedEncodingException, BaseApiException {
Article article = articleMapper.selectByPrimaryKey(idArticle);
if (Objects.nonNull(article)) {
article.setArticleTags(tags);
articleMapper.updateArticleTags(idArticle, tags);
tagService.saveTagArticle(article, "");
map.put("success", true);
} else {
map.put("success", false);
map.put("message", "更新失败,文章不存在!");
if (!Objects.nonNull(article)) {
throw new ContentNotExistException("更新失败,文章不存在!");
}
return map;
article.setArticleTags(tags);
articleMapper.updateArticleTags(idArticle, tags);
tagService.saveTagArticle(article, "");
return true;
}
@Override
public Map updatePerfect(Integer idArticle, String articlePerfect) {
Map map = new HashMap(2);
int result = articleMapper.updatePerfect(idArticle, articlePerfect);
if (result == 0) {
map.put("success", false);
map.put("message", "设置优选文章失败!");
} else {
map.put("success", true);
public Boolean updatePerfect(Long idArticle, String articlePerfect) {
if (articleMapper.updatePerfect(idArticle, articlePerfect) == 0) {
throw new ContentNotExistException("设置优选文章失败!");
}
return map;
return true;
}
@Override
@ -387,4 +328,36 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
author.setUserAccount(user.getAccount());
return author;
}
private String checkTags(String articleTags) {
// 判断文章是否有标签
if (StringUtils.isBlank(articleTags)) {
return "";
}
// 判断是否存在系统配置的保留标签词
Condition condition = new Condition(Tag.class);
condition.createCriteria().andEqualTo("tagReservation", "1");
List<Tag> tags = tagService.findByCondition(condition);
if (tags.isEmpty()) {
return "";
} else {
String[] articleTagArr = articleTags.split(",");
for (Tag tag : tags) {
if (StringUtils.isBlank(tag.getTagTitle())) {
continue;
}
for (String articleTag : articleTagArr) {
if (StringUtils.isBlank(articleTag)) {
continue;
}
if (articleTag.equals(tag.getTagTitle())) {
return tag.getTagTitle();
}
}
}
}
return "";
}
}

View File

@ -37,7 +37,7 @@ public class BankAccountServiceImpl extends AbstractService<BankAccount> impleme
}
@Override
public BankAccountDTO findBankAccountByIdUser(Integer idUser) {
public BankAccountDTO findBankAccountByIdUser(Long idUser) {
BankAccount bankAccount = new BankAccount();
bankAccount.setAccountOwner(idUser);
String defaultAccountType = "0";
@ -79,7 +79,7 @@ public class BankAccountServiceImpl extends AbstractService<BankAccount> impleme
BankAccount bankAccount = new BankAccount();
bankAccount.setIdBank(1);
bankAccount.setAccountType("1");
bankAccount.setAccountOwner(2);
bankAccount.setAccountOwner(2L);
return bankAccountMapper.selectOne(bankAccount);
}

View File

@ -51,7 +51,7 @@ public class FollowServiceImpl extends AbstractService<Follow> implements Follow
}
@Override
public List<Follow> findByFollowingId(String followType, Integer followingId) {
public List<Follow> findByFollowingId(String followType, Long followingId) {
Follow follow = new Follow();
follow.setFollowingType(followType);
follow.setFollowingId(followingId);

View File

@ -28,12 +28,12 @@ public class NotificationServiceImpl extends AbstractService<Notification> imple
private final static String UN_READ = "0";
@Override
public List<Notification> findUnreadNotifications(Integer idUser) {
public List<Notification> findUnreadNotifications(Long idUser) {
return notificationMapper.selectUnreadNotifications(idUser);
}
@Override
public List<NotificationDTO> findNotifications(Integer idUser) {
public List<NotificationDTO> findNotifications(Long idUser) {
List<NotificationDTO> list = notificationMapper.selectNotifications(idUser);
list.forEach(notification -> {
NotificationDTO notificationDTO = NotificationUtils.genNotification(notification);
@ -57,19 +57,19 @@ public class NotificationServiceImpl extends AbstractService<Notification> imple
}
@Override
public Notification findNotification(Integer idUser, Integer dataId, String dataType) {
public Notification findNotification(Long idUser, Long dataId, String dataType) {
return notificationMapper.selectNotification(idUser, dataId, dataType);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer save(Integer idUser, Integer dataId, String dataType, String dataSummary) {
public Integer save(Long idUser, Long dataId, String dataType, String dataSummary) {
return notificationMapper.insertNotification(idUser, dataId, dataType, dataSummary);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer readNotification(Integer id) {
public Integer readNotification(Long id) {
return notificationMapper.readNotification(id);
}
@ -79,7 +79,7 @@ public class NotificationServiceImpl extends AbstractService<Notification> imple
}
@Override
public Integer deleteUnreadNotification(Integer dataId, String dataType) {
public Integer deleteUnreadNotification(Long dataId, String dataType) {
return notificationMapper.deleteUnreadNotification(dataId, dataType);
}
}

View File

@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rymcu.forest.core.service.AbstractService;
import com.rymcu.forest.dto.*;
import com.rymcu.forest.entity.Article;
import com.rymcu.forest.entity.Portfolio;
import com.rymcu.forest.entity.User;
import com.rymcu.forest.lucene.model.PortfolioLucene;
@ -53,7 +52,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
}
@Override
public PortfolioDTO findPortfolioDTOById(Integer idPortfolio, Integer type) {
public PortfolioDTO findPortfolioDTOById(Long idPortfolio, Integer type) {
PortfolioDTO portfolio = portfolioMapper.selectPortfolioDTOById(idPortfolio,type);
if (portfolio == null) {
return new PortfolioDTO();
@ -68,6 +67,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
@Override
public Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException {
User user = UserUtils.getCurrentUserByToken();
assert user != null;
if (StringUtils.isNotBlank(portfolio.getHeadImgType())) {
String headImgUrl = UploadController.uploadBase64File(portfolio.getHeadImgUrl(), 0);
portfolio.setHeadImgUrl(headImgUrl);
@ -98,7 +98,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
}
@Override
public Map findUnbindArticles(Integer page, Integer rows, String searchText, Integer idPortfolio) throws BaseApiException {
public Map findUnbindArticles(Integer page, Integer rows, String searchText, Long idPortfolio) throws BaseApiException {
Map map = new HashMap(1);
User user = UserUtils.getCurrentUserByToken();
Portfolio portfolio = portfolioMapper.selectByPrimaryKey(idPortfolio);
@ -153,7 +153,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
}
@Override
public Map unbindArticle(Integer idPortfolio, Integer idArticle) {
public Map unbindArticle(Long idPortfolio, Long idArticle) {
Map map = new HashMap(1);
if (idPortfolio == null || idPortfolio.equals(0)) {
map.put("message", "作品集数据异常");
@ -171,7 +171,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
}
@Override
public Map deletePortfolio(Integer idPortfolio) throws BaseApiException {
public Map deletePortfolio(Long idPortfolio) throws BaseApiException {
Map map = new HashMap(1);
if (idPortfolio == null || idPortfolio.equals(0)) {
map.put("message", "作品集数据异常");

View File

@ -32,7 +32,7 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
}
@Override
public List<Role> findByIdUser(Integer idUser) {
public List<Role> findByIdUser(Long idUser) {
return roleMapper.selectRoleByIdUser(idUser);
}

View File

@ -70,7 +70,7 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
}
@Override
public TransactionRecord userTransfer(Integer toUserId, Integer formUserId, TransactionEnum transactionType) throws Exception {
public TransactionRecord userTransfer(Long toUserId, Long formUserId, TransactionEnum transactionType) throws Exception {
BankAccountDTO toBankAccount = bankAccountService.findBankAccountByIdUser(toUserId);
BankAccountDTO formBankAccount = bankAccountService.findBankAccountByIdUser(formUserId);
TransactionRecord transactionRecord = new TransactionRecord();
@ -82,7 +82,7 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
}
@Override
public TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) throws Exception {
public TransactionRecord bankTransfer(Long idUser, TransactionEnum transactionType) throws Exception {
BankAccountDTO toBankAccount = bankAccountService.findBankAccountByIdUser(idUser);
Boolean isTrue;
// 校验货币规则

View File

@ -169,7 +169,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
@Override
@Transactional(rollbackFor = Exception.class)
public Map updateStatus(Integer idUser, String status) {
public Map updateStatus(Long idUser, String status) {
Map map = new HashMap(2);
Integer result = userMapper.updateStatus(idUser, status);
if (result == 0) {
@ -231,7 +231,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
}
@Override
public Map checkNickname(Integer idUser, String nickname) {
public Map checkNickname(Long idUser, String nickname) {
Map map = new HashMap(2);
Integer number = userMapper.checkNicknameByIdUser(idUser, nickname);
if (number > 0) {
@ -241,12 +241,12 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
}
@Override
public Integer findRoleWeightsByUser(Integer idUser) {
public Integer findRoleWeightsByUser(Long idUser) {
return userMapper.selectRoleWeightsByUser(idUser);
}
@Override
public Author selectAuthor(Integer idUser) {
public Author selectAuthor(Long idUser) {
return userMapper.selectAuthor(idUser);
}

View File

@ -29,7 +29,7 @@ public class NotificationUtils {
private static ArticleService articleService = SpringContextHolder.getBean(ArticleService.class);
private static CommentService commentService = SpringContextHolder.getBean(CommentService.class);
public static void sendAnnouncement(Integer dataId, String dataType, String dataSummary) {
public static void sendAnnouncement(Long dataId, String dataType, String dataSummary) {
ExecutorService executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
CompletableFuture.supplyAsync(() -> {
try {
@ -44,7 +44,7 @@ public class NotificationUtils {
}, executor);
}
public static void saveNotification(Integer idUser, Integer dataId, String dataType, String dataSummary) {
public static void saveNotification(Long idUser, Long dataId, String dataType, String dataSummary) {
ExecutorService executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
CompletableFuture.supplyAsync(() -> {
try {
@ -70,7 +70,7 @@ public class NotificationUtils {
}
public static void sendArticlePush(Integer dataId, String dataType, String dataSummary, Integer articleAuthorId) {
public static void sendArticlePush(Long dataId, String dataType, String dataSummary, Long articleAuthorId) {
ExecutorService executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
CompletableFuture.supplyAsync(() -> {
try {
@ -154,12 +154,10 @@ public class NotificationUtils {
private static String getFollowLink(String followingType, String id) {
StringBuilder url = new StringBuilder();
url.append(Utils.getProperty("resource.domain"));
switch (followingType) {
case "0":
url = url.append("/user/").append(id);
break;
default:
url.append("/notification");
if ("0".equals(followingType)) {
url.append("/user/").append(id);
} else {
url.append("/notification");
}
return url.toString();
}

View File

@ -26,8 +26,9 @@ public class AdminArticleController {
private ArticleService articleService;
@PatchMapping("/update-perfect")
public GlobalResult updatePerfect(@RequestBody Article article) {
Map map = articleService.updatePerfect(article.getIdArticle(), article.getArticlePerfect());
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<Boolean> updatePerfect(@RequestBody Article article) {
Long idArticle = article.getIdArticle();
String articlePerfect = article.getArticlePerfect();
return GlobalResultGenerator.genSuccessResult(articleService.updatePerfect(idArticle, articlePerfect));
}
}

View File

@ -54,7 +54,7 @@ public class AdminController {
}
@GetMapping("/user/{idUser}/role")
public GlobalResult<List<Role>> userRole(@PathVariable Integer idUser){
public GlobalResult<List<Role>> userRole(@PathVariable Long idUser){
List<Role> roles = roleService.findByIdUser(idUser);
return GlobalResultGenerator.genSuccessResult(roles);
}

View File

@ -43,61 +43,52 @@ public class ArticleController {
private SponsorService sponsorService;
@GetMapping("/detail/{idArticle}")
public GlobalResult<Map<String, Object>> detail(@PathVariable Integer idArticle, @RequestParam(defaultValue = "2") Integer type) {
ArticleDTO articleDTO = articleService.findArticleDTOById(idArticle, type);
Map map = new HashMap<>(1);
map.put("article", articleDTO);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<ArticleDTO> detail(@PathVariable Long idArticle, @RequestParam(defaultValue = "2") Integer type) {
ArticleDTO dto = articleService.findArticleDTOById(idArticle, type);
return GlobalResultGenerator.genSuccessResult(dto);
}
@PostMapping("/post")
public GlobalResult postArticle(@RequestBody ArticleDTO article, HttpServletRequest request) throws BaseApiException, UnsupportedEncodingException {
Map map = articleService.postArticle(article, request);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<Long> postArticle(@RequestBody ArticleDTO article, HttpServletRequest request) throws BaseApiException, UnsupportedEncodingException {
return GlobalResultGenerator.genSuccessResult(articleService.postArticle(article, request));
}
@PutMapping("/post")
@AuthorshipInterceptor(moduleName = Module.ARTICLE)
public GlobalResult updateArticle(@RequestBody ArticleDTO article, HttpServletRequest request) throws BaseApiException, UnsupportedEncodingException {
Map map = articleService.postArticle(article, request);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<Long> updateArticle(@RequestBody ArticleDTO article, HttpServletRequest request) throws BaseApiException, UnsupportedEncodingException {
return GlobalResultGenerator.genSuccessResult(articleService.postArticle(article, request));
}
@DeleteMapping("/delete/{idArticle}")
@AuthorshipInterceptor(moduleName = Module.ARTICLE)
public GlobalResult delete(@PathVariable Integer idArticle) throws BaseApiException {
Map map = articleService.delete(idArticle);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<Integer> delete(@PathVariable Long idArticle) throws BaseApiException {
return GlobalResultGenerator.genSuccessResult(articleService.delete(idArticle));
}
@GetMapping("/{idArticle}/comments")
public GlobalResult<Map<String, Object>> commons(@PathVariable Integer idArticle) {
List<CommentDTO> commentDTOList = commentService.getArticleComments(idArticle);
Map map = new HashMap<>(1);
map.put("comments", commentDTOList);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<List<CommentDTO>> commons(@PathVariable Integer idArticle) {
return GlobalResultGenerator.genSuccessResult(commentService.getArticleComments(idArticle));
}
@GetMapping("/drafts")
public GlobalResult drafts(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) throws BaseApiException {
public GlobalResult<PageInfo<ArticleDTO>> drafts(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) throws BaseApiException {
PageHelper.startPage(page, rows);
List<ArticleDTO> list = articleService.findDrafts();
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);
Map map = Utils.getArticlesGlobalResult(pageInfo);
return GlobalResultGenerator.genSuccessResult(map);
PageInfo<ArticleDTO> pageInfo = new PageInfo<>(list);
return GlobalResultGenerator.genSuccessResult(pageInfo);
}
@GetMapping("/{idArticle}/share")
public GlobalResult share(@PathVariable Integer idArticle) throws BaseApiException {
Map map = articleService.share(idArticle);
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<String> share(@PathVariable Integer idArticle) throws BaseApiException {
return GlobalResultGenerator.genSuccessResult(articleService.share(idArticle));
}
@PostMapping("/update-tags")
@AuthorshipInterceptor(moduleName = Module.ARTICLE_TAG)
public GlobalResult updateTags(@RequestBody Article article) throws BaseApiException, UnsupportedEncodingException {
Map map = articleService.updateTags(article.getIdArticle(), article.getArticleTags());
return GlobalResultGenerator.genSuccessResult(map);
public GlobalResult<Boolean> updateTags(@RequestBody Article article) throws BaseApiException, UnsupportedEncodingException {
Long idArticle = article.getIdArticle();
String articleTags = article.getArticleTags();
return GlobalResultGenerator.genSuccessResult(articleService.updateTags(idArticle, articleTags));
}
@PostMapping("/thumbs-up")

View File

@ -43,7 +43,7 @@ public class BankAccountController {
}
@GetMapping("/{idUser}")
public GlobalResult detail(@PathVariable Integer idUser) {
public GlobalResult detail(@PathVariable Long idUser) {
BankAccountDTO bankAccount = bankAccountService.findBankAccountByIdUser(idUser);
return GlobalResultGenerator.genSuccessResult(bankAccount);
}

View File

@ -33,7 +33,7 @@ public class WalletController {
@GetMapping("/{idUser}")
@SecurityInterceptor
public GlobalResult detail(@PathVariable Integer idUser) {
public GlobalResult detail(@PathVariable Long idUser) {
BankAccountDTO bankAccount = bankAccountService.findBankAccountByIdUser(idUser);
return GlobalResultGenerator.genSuccessResult(bankAccount);
}
@ -44,7 +44,7 @@ public class WalletController {
String idUser = request.getParameter("idUser");
String startDate = request.getParameter("startDate");
String endDate = request.getParameter("endDate");
BankAccountDTO bankAccount = bankAccountService.findBankAccountByIdUser(Integer.valueOf(idUser));
BankAccountDTO bankAccount = bankAccountService.findBankAccountByIdUser(Long.valueOf(idUser));
PageHelper.startPage(page, rows);
List<TransactionRecordDTO> list = bankAccountService.findUserTransactionRecords(bankAccount.getBankAccount(), startDate, endDate);
PageInfo<TransactionRecordDTO> pageInfo = new PageInfo(list);

View File

@ -106,7 +106,7 @@ public class CommonApiController {
@GetMapping("/article/{id}")
@VisitLogger
public GlobalResult<Map<String, Object>> article(@PathVariable Integer id) {
public GlobalResult<Map<String, Object>> article(@PathVariable Long id) {
ArticleDTO articleDTO = articleService.findArticleDTOById(id, 1);
Map<String, Object> map = new HashMap<>(1);
map.put("article", articleDTO);
@ -121,7 +121,7 @@ public class CommonApiController {
@GetMapping("/portfolio/{id}")
@VisitLogger
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id) {
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Long id) {
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id, 1);
Map<String, Object> map = new HashMap<>(1);
map.put("portfolio", portfolioDTO);
@ -129,7 +129,7 @@ public class CommonApiController {
}
@GetMapping("/portfolio/{id}/articles")
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable Integer id) {
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable Long id) {
PageHelper.startPage(page, rows);
List<ArticleDTO> list = articleService.findArticlesByIdPortfolio(id);
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);

View File

@ -57,7 +57,7 @@ public class NotificationController {
}
@PutMapping("/read/{id}")
public GlobalResult read(@PathVariable Integer id) {
public GlobalResult read(@PathVariable Long id) {
Integer result = notificationService.readNotification(id);
if (result == 0) {
return GlobalResultGenerator.genErrorResult("标记已读失败");

View File

@ -26,7 +26,7 @@ public class PortfolioController {
private PortfolioService portfolioService;
@GetMapping("/detail/{idPortfolio}")
public GlobalResult detail(@PathVariable Integer idPortfolio,@RequestParam(defaultValue = "0") Integer type) {
public GlobalResult detail(@PathVariable Long idPortfolio,@RequestParam(defaultValue = "0") Integer type) {
PortfolioDTO portfolio = portfolioService.findPortfolioDTOById(idPortfolio, type);
Map map = new HashMap<>(1);
map.put("portfolio", portfolio);
@ -48,7 +48,7 @@ public class PortfolioController {
@GetMapping("/{idPortfolio}/unbind-articles")
@AuthorshipInterceptor(moduleName = Module.PORTFOLIO)
public GlobalResult unbindArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @RequestParam(defaultValue = "") String searchText,@PathVariable Integer idPortfolio) throws BaseApiException {
public GlobalResult unbindArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @RequestParam(defaultValue = "") String searchText,@PathVariable Long idPortfolio) throws BaseApiException {
Map map = portfolioService.findUnbindArticles(page, rows, searchText, idPortfolio);
return GlobalResultGenerator.genSuccessResult(map);
}
@ -69,14 +69,14 @@ public class PortfolioController {
@DeleteMapping("/unbind-article")
@AuthorshipInterceptor(moduleName = Module.PORTFOLIO)
public GlobalResult unbindArticle(Integer idArticle,Integer idPortfolio) {
public GlobalResult unbindArticle(Long idArticle, Long idPortfolio) {
Map map = portfolioService.unbindArticle(idPortfolio,idArticle);
return GlobalResultGenerator.genSuccessResult(map);
}
@DeleteMapping("/delete")
@AuthorshipInterceptor(moduleName = Module.PORTFOLIO)
public GlobalResult delete(Integer idPortfolio) throws BaseApiException {
public GlobalResult delete(Long idPortfolio) throws BaseApiException {
Map map = portfolioService.deletePortfolio(idPortfolio);
return GlobalResultGenerator.genSuccessResult(map);
}

View File

@ -41,7 +41,7 @@ public class UserInfoController {
@GetMapping("/check-nickname")
@SecurityInterceptor
public GlobalResult checkNickname(@RequestParam Integer idUser, @RequestParam String nickname) {
public GlobalResult checkNickname(@RequestParam Long idUser, @RequestParam String nickname) {
Map map = userService.checkNickname(idUser, nickname);
return GlobalResultGenerator.genSuccessResult(map);
}

View File

@ -5,7 +5,7 @@
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="idArticle"/>
<id column="id" jdbcType="BIGINT" property="idArticle"/>
<result column="article_title" property="articleTitle"></result>
<result column="article_thumbnail_url" property="articleThumbnailUrl"></result>
<result column="article_author_id" property="articleAuthorId"></result>