1、表名,表结构修改
2、专题功能开发 3、标签及相关功能开发 4、个人主页开发
This commit is contained in:
parent
b662001f03
commit
733b57ca41
@ -2,11 +2,10 @@ package com.rymcu.vertical.config;
|
||||
|
||||
import com.rymcu.vertical.core.constant.ShiroConstants;
|
||||
import com.rymcu.vertical.core.exception.CaptchaException;
|
||||
import com.rymcu.vertical.core.exception.ServiceException;
|
||||
import com.rymcu.vertical.entity.Menu;
|
||||
import com.rymcu.vertical.entity.Permission;
|
||||
import com.rymcu.vertical.entity.Role;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.service.MenuService;
|
||||
import com.rymcu.vertical.service.PermissionService;
|
||||
import com.rymcu.vertical.service.RoleService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.Encodes;
|
||||
@ -36,7 +35,7 @@ public class HpeisShiroRealm extends AuthorizingRealm {
|
||||
private RoleService roleService;
|
||||
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@ -56,10 +55,10 @@ public class HpeisShiroRealm extends AuthorizingRealm {
|
||||
authorizationInfo.addRole(role.getInputCode());
|
||||
}
|
||||
}
|
||||
List<Menu> permissions = menuService.selectMenuByUser(user);
|
||||
for (Menu perm : permissions) {
|
||||
if (perm.getPermission() != null) {
|
||||
authorizationInfo.addStringPermission(perm.getPermission());
|
||||
List<Permission> permissions = permissionService.selectMenuByUser(user);
|
||||
for (Permission perm : permissions) {
|
||||
if (perm.getPermissionCategory() != null) {
|
||||
authorizationInfo.addStringPermission(perm.getPermissionCategory());
|
||||
}
|
||||
}
|
||||
// 添加用户权限
|
||||
|
@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// TODO 先不拦截接口,进行测试
|
||||
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
|
||||
.excludePathPatterns("/api/v1/console/**","/api/v1/article/articles/**","/api/v1/article/detail/**");
|
||||
.excludePathPatterns("/api/v1/console/**","/api/v1/article/articles/**","/api/v1/article/detail/**","/api/v1/topic/**");
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ public enum ResultCode {
|
||||
|
||||
|
||||
|
||||
;
|
||||
;
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class ArticleDTO {
|
||||
/** 文章内容html */
|
||||
private String articleContentHtml;
|
||||
/** 评论总数 */
|
||||
private Integer commentCount;
|
||||
private Integer articleCommentCount;
|
||||
/** 过去时长 */
|
||||
private String timeAgo;
|
||||
/** 文章永久链接 */
|
||||
|
17
src/main/java/com/rymcu/vertical/dto/UserDTO.java
Normal file
17
src/main/java/com/rymcu/vertical/dto/UserDTO.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.rymcu.vertical.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDTO {
|
||||
|
||||
private Integer idUser;
|
||||
|
||||
private String account;
|
||||
|
||||
private String avatarType;
|
||||
|
||||
private String avatarUrl;
|
||||
|
||||
private String nickname;
|
||||
}
|
@ -5,38 +5,42 @@ import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "vertical_article")
|
||||
public class Article implements Serializable,Cloneable {
|
||||
/** 主键 */
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
@Column(name = "id")
|
||||
private Integer idArticle ;
|
||||
private Integer idArticle;
|
||||
/** 文章标题 */
|
||||
private String articleTitle ;
|
||||
private String articleTitle;
|
||||
/** 文章缩略图 */
|
||||
private String articleThumbnailUrl ;
|
||||
private String articleThumbnailUrl;
|
||||
/** 文章作者id */
|
||||
private Integer articleAuthorId ;
|
||||
private Integer articleAuthorId;
|
||||
/** 文章类型 */
|
||||
private String articleType ;
|
||||
private String articleType;
|
||||
/** 文章标签 */
|
||||
private String articleTags ;
|
||||
private String articleTags;
|
||||
/** 浏览总数 */
|
||||
private Integer articleViewCount;
|
||||
/** 预览内容 */
|
||||
private String articlePreviewContent ;
|
||||
private String articlePreviewContent;
|
||||
/** 评论总数 */
|
||||
private Integer commentCount ;
|
||||
private Integer articleCommentCount;
|
||||
/** 0:非优选1:优选;0 */
|
||||
private String articlePerfect;
|
||||
/** 文章永久链接 */
|
||||
private String articlePermalink ;
|
||||
private String articlePermalink;
|
||||
/** 站内链接 */
|
||||
private String articleLink ;
|
||||
private String articleLink;
|
||||
/** 创建时间 */
|
||||
private Date createdTime ;
|
||||
private Date createdTime;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime ;
|
||||
private Date updatedTime;
|
||||
}
|
||||
|
@ -2,11 +2,19 @@ package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "vertical_article_content")
|
||||
public class ArticleContent {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idArticle;
|
||||
|
||||
private String articleContent;
|
||||
|
@ -1,69 +0,0 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "SYS_MENU")
|
||||
public class Menu implements Serializable,Cloneable {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Integer idMenu;
|
||||
|
||||
/**
|
||||
* 上级菜单ID
|
||||
* */
|
||||
@Column(name = "parent_id")
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
* */
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* */
|
||||
@Column(name = "SORT")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 路径
|
||||
* */
|
||||
@Column(name = "HREF")
|
||||
private String href;
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
* */
|
||||
@Column(name = "MENU_TYPE")
|
||||
private String menuType;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
* */
|
||||
@ColumnType(column = "PERMISSION",
|
||||
jdbcType = JdbcType.VARCHAR)
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* */
|
||||
@Column(name = "created_time")
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* */
|
||||
@Column(name = "status")
|
||||
private String status;
|
||||
}
|
28
src/main/java/com/rymcu/vertical/entity/Permission.java
Normal file
28
src/main/java/com/rymcu/vertical/entity/Permission.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "vertical_permission")
|
||||
public class Permission implements Serializable,Cloneable {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idPermission;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
* */
|
||||
@ColumnType(column = "permission_category")
|
||||
private String permissionCategory;
|
||||
}
|
@ -3,16 +3,18 @@ package com.rymcu.vertical.entity;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "sys_role")
|
||||
@Table(name = "vertical_role")
|
||||
public class Role implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idRole;
|
||||
|
||||
/**
|
||||
|
@ -5,28 +5,36 @@ import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Tag {
|
||||
@Table(name = "vertical_tag")
|
||||
public class Tag implements Serializable,Cloneable {
|
||||
/** 主键 */
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Integer idTag ;
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idTag;
|
||||
/** 标签名 */
|
||||
private String tagName ;
|
||||
private String tagTitle;
|
||||
/** 标签图标 */
|
||||
private String tagIconUrl ;
|
||||
private String tagIconPath;
|
||||
/** 标签uri */
|
||||
private String tagUri ;
|
||||
private String tagUri;
|
||||
/** 描述 */
|
||||
private String tagDescription ;
|
||||
private String tagDescription;
|
||||
/** 浏览量 */
|
||||
private Integer tagViewCount ;
|
||||
private Integer tagViewCount;
|
||||
/** 关联文章总数 */
|
||||
private Integer tagArticleCount ;
|
||||
private Integer tagArticleCount;
|
||||
/** 标签广告 */
|
||||
private String tagAd;
|
||||
/** 是否显示全站侧边栏广告 */
|
||||
private String tagShowSideAd;
|
||||
/** 创建时间 */
|
||||
private Date createdTime ;
|
||||
private Date createdTime;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime ;
|
||||
private Date updatedTime;
|
||||
}
|
||||
|
43
src/main/java/com/rymcu/vertical/entity/Topic.java
Normal file
43
src/main/java/com/rymcu/vertical/entity/Topic.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.rymcu.vertical.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Table(name = "vertical_topic")
|
||||
public class Topic {
|
||||
|
||||
/** 主键 */
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idTopic;
|
||||
/** 专题标题 */
|
||||
private String topicTitle;
|
||||
/** 专题路径 */
|
||||
private String topicUri;
|
||||
/** 专题描述 */
|
||||
private String topicDescription;
|
||||
/** 专题类型 */
|
||||
private String topicType;
|
||||
/** 专题序号;10 */
|
||||
private Integer topicSort;
|
||||
/** 专题图片路径 */
|
||||
private String topicIconPath;
|
||||
/** 0:作为导航1:不作为导航;0 */
|
||||
private String topicNva;
|
||||
/** 专题下标签总数;0 */
|
||||
private Integer topicTagCount;
|
||||
/** 0:正常1:禁用;0 */
|
||||
private String topicStatus;
|
||||
/** 创建时间 */
|
||||
private Date createdTime;
|
||||
/** 更新时间 */
|
||||
private Date updatedTime;
|
||||
|
||||
}
|
@ -5,16 +5,18 @@ import org.apache.ibatis.type.JdbcType;
|
||||
import tk.mybatis.mapper.annotation.ColumnType;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Table(name = "sys_user")
|
||||
@Table(name = "vertical_user")
|
||||
@Data
|
||||
public class User implements Serializable,Cloneable {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer idUser;
|
||||
|
||||
/**
|
||||
|
@ -21,4 +21,10 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
Integer updateArticleContent(@Param("idArticle") Integer idArticle, @Param("articleContent") String articleContent, @Param("articleContentHtml") String articleContentHtml);
|
||||
|
||||
ArticleContent selectArticleContent(@Param("idArticle") Integer idArticle);
|
||||
|
||||
List<ArticleDTO> selectArticlesByTopicName(@Param("topicName") String topicName);
|
||||
|
||||
List<ArticleDTO> selectArticlesByTagName(@Param("tagName") String tagName);
|
||||
|
||||
List<ArticleDTO> selectUserArticles(@Param("idUser") Integer idUser);
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.dto.MenuDTO;
|
||||
import com.rymcu.vertical.entity.Menu;
|
||||
import com.rymcu.vertical.entity.Role;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MenuMapper extends Mapper<Menu> {
|
||||
|
||||
List<Menu> selectMenuByIdRole(@Param("role") Integer role);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.entity.Permission;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PermissionMapper extends Mapper<Permission> {
|
||||
|
||||
List<Permission> selectMenuByIdRole(@Param("role") Integer role);
|
||||
}
|
@ -2,6 +2,14 @@ package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.entity.Tag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface TagMapper extends Mapper<Tag> {
|
||||
Integer insertTagArticle(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||
|
||||
Integer selectCountTagArticleById(@Param("idTag") Integer idTag, @Param("idArticle") Integer idArticle);
|
||||
|
||||
Integer selectCountUserTagById(@Param("idUser") Integer idUser, @Param("idTag") Integer idTag);
|
||||
|
||||
Integer insertUserTag(@Param("idTag") Integer idTag, @Param("idUser") Integer idUser, @Param("type") Integer type);
|
||||
}
|
||||
|
10
src/main/java/com/rymcu/vertical/mapper/TopicMapper.java
Normal file
10
src/main/java/com/rymcu/vertical/mapper/TopicMapper.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.entity.Topic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TopicMapper extends Mapper<Topic> {
|
||||
List<Topic> selectTopicNav();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.vertical.mapper;
|
||||
|
||||
import com.rymcu.vertical.core.mapper.Mapper;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -12,4 +13,6 @@ public interface UserMapper extends Mapper<User> {
|
||||
Integer insertUserRole(@Param("idUser") Integer idUser, @Param("idRole") Integer idRole);
|
||||
|
||||
UserInfoDTO findUserInfoByAccount(@Param("account") String account);
|
||||
|
||||
UserDTO selectUserDTOByNickname(@Param("nickname") String nickname);
|
||||
}
|
@ -6,13 +6,20 @@ import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.web.api.exception.MallApiException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ArticleService extends Service<Article> {
|
||||
List<ArticleDTO> articles(String searchText, String tag);
|
||||
List<ArticleDTO> findArticles(String searchText, String tag);
|
||||
|
||||
Map postArticle(Integer idArticle, String articleTitle, String articleContent, String articleContentHtml, String articleTags, HttpServletRequest request) throws MallApiException;
|
||||
Map postArticle(Integer idArticle, String articleTitle, String articleContent, String articleContentHtml, String articleTags, HttpServletRequest request) throws MallApiException, UnsupportedEncodingException;
|
||||
|
||||
ArticleDTO findArticleDTOById(Integer id, int i);
|
||||
|
||||
List<ArticleDTO> findArticlesByTopicName(String name);
|
||||
|
||||
List<ArticleDTO> findArticlesByTagName(String name);
|
||||
|
||||
List<ArticleDTO> findUserArticlesByIdUser(Integer idUser);
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.dto.MenuDTO;
|
||||
import com.rymcu.vertical.entity.Menu;
|
||||
import com.rymcu.vertical.entity.Permission;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
|
||||
import java.util.List;
|
||||
@ -11,7 +10,7 @@ import java.util.List;
|
||||
/**
|
||||
* Created by CodeGenerator on 2018/05/29.
|
||||
*/
|
||||
public interface MenuService extends Service<Menu> {
|
||||
public interface PermissionService extends Service<Permission> {
|
||||
|
||||
List<Menu> selectMenuByUser(User sysUser);
|
||||
List<Permission> selectMenuByUser(User sysUser);
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.entity.Tag;
|
||||
import com.rymcu.vertical.web.api.exception.MallApiException;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public interface TagService extends Service<Tag> {
|
||||
|
||||
void saveTagArticle(Article article) throws UnsupportedEncodingException, MallApiException;
|
||||
}
|
||||
|
10
src/main/java/com/rymcu/vertical/service/TopicService.java
Normal file
10
src/main/java/com/rymcu/vertical/service/TopicService.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.entity.Topic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TopicService extends Service<Topic> {
|
||||
List<Topic> findTopicNav();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.rymcu.vertical.service;
|
||||
|
||||
import com.rymcu.vertical.core.service.Service;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import org.apache.ibatis.exceptions.TooManyResultsException;
|
||||
|
||||
@ -18,4 +19,6 @@ public interface UserService extends Service<User> {
|
||||
Map register(String email, String password, String code);
|
||||
|
||||
Map login(String account, String password);
|
||||
|
||||
UserDTO findUserDTOByNickname(String nickname);
|
||||
}
|
||||
|
@ -3,10 +3,14 @@ package com.rymcu.vertical.service.impl;
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.Author;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.entity.ArticleContent;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.mapper.ArticleMapper;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.TagService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.Html2TextUtil;
|
||||
import com.rymcu.vertical.util.UserUtils;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
@ -17,21 +21,23 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ArticleServiceImpl extends AbstractService<Article> implements ArticleService {
|
||||
|
||||
@Resource
|
||||
private ArticleMapper articleMapper;
|
||||
@Resource
|
||||
private TagService tagService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
private static final String DOMAIN = "https://rymcu.com";
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> articles(String searchText, String tag) {
|
||||
public List<ArticleDTO> findArticles(String searchText, String tag) {
|
||||
List<ArticleDTO> list = articleMapper.selectArticles(searchText, tag);
|
||||
list.forEach(article->{
|
||||
article = genArticle(article,0);
|
||||
@ -41,13 +47,14 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Map postArticle(Integer idArticle, String articleTitle, String articleContent, String articleContentHtml, String articleTags, HttpServletRequest request) throws MallApiException {
|
||||
public Map postArticle(Integer idArticle, String articleTitle, String articleContent, String articleContentHtml, String articleTags, HttpServletRequest request) throws MallApiException, UnsupportedEncodingException {
|
||||
Map map = new HashMap();
|
||||
Article article;
|
||||
User user = UserUtils.getWxCurrentUser();
|
||||
if(idArticle == null || idArticle == 0){
|
||||
article = new Article();
|
||||
article.setArticleTitle(articleTitle);
|
||||
article.setArticleAuthorId(UserUtils.getWxCurrentUser().getIdUser());
|
||||
article.setArticleAuthorId(user.getIdUser());
|
||||
article.setArticleTags(articleTags);
|
||||
article.setCreatedTime(new Date());
|
||||
article.setUpdatedTime(article.getCreatedTime());
|
||||
@ -57,8 +64,8 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
articleMapper.insertArticleContent(article.getIdArticle(),articleContent,articleContentHtml);
|
||||
} else {
|
||||
article = articleMapper.selectByPrimaryKey(idArticle);
|
||||
if(UserUtils.getWxCurrentUser().getIdUser() != article.getIdArticle()){
|
||||
map.put("message","非法用户!");
|
||||
if(user.getIdUser() != article.getArticleAuthorId()){
|
||||
map.put("message","非法访问!");
|
||||
return map;
|
||||
}
|
||||
article.setArticleTitle(articleTitle);
|
||||
@ -74,7 +81,9 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
article.setUpdatedTime(new Date());
|
||||
articleMapper.updateArticleContent(article.getIdArticle(),articleContent,articleContentHtml);
|
||||
}
|
||||
tagService.saveTagArticle(article);
|
||||
articleMapper.updateByPrimaryKeySelective(article);
|
||||
|
||||
map.put("id", article.getIdArticle());
|
||||
return map;
|
||||
}
|
||||
@ -86,6 +95,27 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
return articleDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> findArticlesByTopicName(String name) {
|
||||
List<ArticleDTO> articleDTOS = articleMapper.selectArticlesByTopicName(name);
|
||||
return articleDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> findArticlesByTagName(String name) {
|
||||
List<ArticleDTO> articleDTOS = articleMapper.selectArticlesByTagName(name);
|
||||
return articleDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> findUserArticlesByIdUser(Integer idUser) {
|
||||
List<ArticleDTO> list = articleMapper.selectUserArticles(idUser);
|
||||
list.forEach(article->{
|
||||
article = genArticle(article,0);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private ArticleDTO genArticle(ArticleDTO article,Integer type) {
|
||||
Author author = articleMapper.selectAuthor(article.getArticleAuthorId());
|
||||
article.setArticleAuthor(author);
|
||||
|
@ -1,15 +1,12 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.dto.MenuDTO;
|
||||
import com.rymcu.vertical.entity.Menu;
|
||||
import com.rymcu.vertical.entity.Permission;
|
||||
import com.rymcu.vertical.entity.Role;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.mapper.MenuMapper;
|
||||
import com.rymcu.vertical.service.MenuService;
|
||||
import com.rymcu.vertical.mapper.PermissionMapper;
|
||||
import com.rymcu.vertical.service.PermissionService;
|
||||
import com.rymcu.vertical.service.RoleService;
|
||||
import com.rymcu.vertical.util.BeanCopierUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -17,7 +14,6 @@ import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
@ -25,18 +21,18 @@ import java.util.UUID;
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class MenuServiceImpl extends AbstractService<Menu> implements MenuService {
|
||||
public class PermissionServiceImpl extends AbstractService<Permission> implements PermissionService {
|
||||
@Resource
|
||||
private MenuMapper menuMapper;
|
||||
private PermissionMapper permissionMapper;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Override
|
||||
public List<Menu> selectMenuByUser(User sysUser) {
|
||||
List<Menu> list = new ArrayList<Menu>();
|
||||
public List<Permission> selectMenuByUser(User sysUser) {
|
||||
List<Permission> list = new ArrayList<Permission>();
|
||||
List<Role> roles = roleService.selectRoleByUser(sysUser);
|
||||
roles.forEach(role -> list.addAll(menuMapper.selectMenuByIdRole(role.getIdRole())));
|
||||
roles.forEach(role -> list.addAll(permissionMapper.selectMenuByIdRole(role.getIdRole())));
|
||||
HashSet hashSet = new HashSet(list);
|
||||
list.clear();
|
||||
list.addAll(hashSet);
|
@ -1,10 +1,67 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.entity.Article;
|
||||
import com.rymcu.vertical.entity.Tag;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.mapper.TagMapper;
|
||||
import com.rymcu.vertical.service.TagService;
|
||||
import com.rymcu.vertical.util.UserUtils;
|
||||
import com.rymcu.vertical.web.api.exception.MallApiException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class TagServiceImpl extends AbstractService<Tag> implements TagService {
|
||||
|
||||
@Resource
|
||||
private TagMapper tagMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveTagArticle(Article article) throws UnsupportedEncodingException, MallApiException {
|
||||
User user = UserUtils.getWxCurrentUser();
|
||||
String articleTags = article.getArticleTags();
|
||||
if(StringUtils.isNotBlank(articleTags)){
|
||||
String[] tags = articleTags.split(",");
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
boolean addTagArticle = false;
|
||||
boolean addUserTag = false;
|
||||
Tag tag = new Tag();
|
||||
tag.setTagTitle(tags[i]);
|
||||
tag = tagMapper.selectOne(tag);
|
||||
if(tag == null){
|
||||
tag = new Tag();
|
||||
tag.setTagTitle(tags[i]);
|
||||
tag.setTagUri(URLEncoder.encode(tag.getTagTitle(),"UTF-8"));
|
||||
tag.setCreatedTime(new Date());
|
||||
tag.setUpdatedTime(tag.getCreatedTime());
|
||||
tagMapper.insertSelective(tag);
|
||||
addTagArticle = true;
|
||||
addUserTag = true;
|
||||
} else {
|
||||
Integer count = tagMapper.selectCountTagArticleById(tag.getIdTag(),article.getIdArticle());
|
||||
if(count == 0){
|
||||
addTagArticle = true;
|
||||
}
|
||||
Integer countUserTag = tagMapper.selectCountUserTagById(user.getIdUser(),tag.getIdTag());
|
||||
if(countUserTag == 0){
|
||||
addUserTag = true;
|
||||
}
|
||||
}
|
||||
if(addTagArticle){
|
||||
tagMapper.insertTagArticle(tag.getIdTag(),article.getIdArticle());
|
||||
}
|
||||
if(addUserTag){
|
||||
tagMapper.insertUserTag(tag.getIdTag(),user.getIdUser(),1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.rymcu.vertical.service.impl;
|
||||
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.entity.Topic;
|
||||
import com.rymcu.vertical.mapper.TopicMapper;
|
||||
import com.rymcu.vertical.service.TopicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TopicServiceImpl extends AbstractService<Topic> implements TopicService {
|
||||
|
||||
@Resource
|
||||
private TopicMapper topicMapper;
|
||||
|
||||
@Override
|
||||
public List<Topic> findTopicNav() {
|
||||
List<Topic> topics = topicMapper.selectTopicNav();
|
||||
return topics;
|
||||
}
|
||||
}
|
@ -3,12 +3,13 @@ package com.rymcu.vertical.service.impl;
|
||||
import com.rymcu.vertical.core.service.AbstractService;
|
||||
import com.rymcu.vertical.core.service.redis.RedisService;
|
||||
import com.rymcu.vertical.dto.TUser;
|
||||
import com.rymcu.vertical.dto.UserInfoDTO;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.entity.Role;
|
||||
import com.rymcu.vertical.entity.User;
|
||||
import com.rymcu.vertical.jwt.service.TokenManager;
|
||||
import com.rymcu.vertical.mapper.RoleMapper;
|
||||
import com.rymcu.vertical.mapper.UserMapper;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import com.rymcu.vertical.util.BeanCopierUtil;
|
||||
import com.rymcu.vertical.util.Utils;
|
||||
@ -56,7 +57,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
||||
} else {
|
||||
user = new User();
|
||||
user.setAccount(email);
|
||||
user.setNickname(email);
|
||||
user.setNickname(email.split("@")[0]);
|
||||
user.setEmail(email);
|
||||
user.setPassword(Utils.entryptPassword(password));
|
||||
user.setCreatedTime(new Date());
|
||||
@ -96,4 +97,10 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO findUserDTOByNickname(String nickname) {
|
||||
UserDTO user = userMapper.selectUserDTOByNickname(nickname);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -20,7 +21,7 @@ public class ArticleController {
|
||||
@PostMapping("/post")
|
||||
public GlobalResult postArticle(@RequestParam(name = "idArticle",defaultValue = "0") Integer idArticle,@RequestParam(name = "articleTitle",defaultValue = "") String articleTitle,
|
||||
@RequestParam(name = "articleContent",defaultValue = "") String articleContent,@RequestParam(name = "articleContentHtml",defaultValue = "") String articleContentHtml,
|
||||
@RequestParam(name = "articleTags",defaultValue = "") String articleTags, HttpServletRequest request) throws MallApiException {
|
||||
@RequestParam(name = "articleTags",defaultValue = "") String articleTags, HttpServletRequest request) throws MallApiException, UnsupportedEncodingException {
|
||||
Map map = articleService.postArticle(idArticle,articleTitle,articleContent,articleContentHtml,articleTags,request);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
@ -28,7 +29,7 @@ public class ArticleController {
|
||||
@PutMapping("/post")
|
||||
public GlobalResult updateArticle(@RequestParam(name = "idArticle",defaultValue = "0") Integer idArticle,@RequestParam(name = "articleTitle",defaultValue = "") String articleTitle,
|
||||
@RequestParam(name = "articleContent",defaultValue = "") String articleContent,@RequestParam(name = "articleContentHtml",defaultValue = "") String articleContentHtml,
|
||||
@RequestParam(name = "articleTags",defaultValue = "") String articleTags, HttpServletRequest request) throws MallApiException {
|
||||
@RequestParam(name = "articleTags",defaultValue = "") String articleTags, HttpServletRequest request) throws MallApiException, UnsupportedEncodingException {
|
||||
Map map = articleService.postArticle(idArticle,articleTitle,articleContent,articleContentHtml,articleTags,request);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
@ -47,6 +47,23 @@ public class CommonApiController {
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取找回密码邮件验证码")
|
||||
@PostMapping("/get-forget-email-code")
|
||||
public GlobalResult getForgetEmailCode(@RequestParam("email") String email) {
|
||||
Map map = new HashMap();
|
||||
map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage());
|
||||
User user = userService.findByAccount(email);
|
||||
if (user != null) {
|
||||
Integer result = javaMailService.sendEmailCode(email);
|
||||
if(result == 0){
|
||||
map.put("message",GlobalResultMessage.SEND_FAIL.getMessage());
|
||||
}
|
||||
} else {
|
||||
map.put("message","该邮箱未注册!");
|
||||
}
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public GlobalResult register(@RequestParam("email") String email, @RequestParam("password") String password, @RequestParam("code") String code){
|
||||
Map map = userService.register(email,password,code);
|
||||
@ -67,7 +84,7 @@ public class CommonApiController {
|
||||
@GetMapping("/articles")
|
||||
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page,@RequestParam(defaultValue = "10") Integer rows,@RequestParam(defaultValue = "") String searchText,@RequestParam(defaultValue = "") String tag){
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.articles(searchText,tag);
|
||||
List<ArticleDTO> list = articleService.findArticles(searchText,tag);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap();
|
||||
map.put("articles", pageInfo.getList());
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.rymcu.vertical.web.api.tag;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/tag")
|
||||
public class TagController {
|
||||
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@GetMapping("/{name}")
|
||||
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable String name){
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findArticlesByTagName(name);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap();
|
||||
map.put("articles", pageInfo.getList());
|
||||
Map pagination = new HashMap();
|
||||
pagination.put("paginationPageCount",pageInfo.getPages());
|
||||
pagination.put("paginationPageNums",pageInfo.getNavigatepageNums());
|
||||
pagination.put("currentPage",pageInfo.getPageNum());
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.rymcu.vertical.web.api.topic;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.entity.Topic;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.TopicService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/topic")
|
||||
public class TopicController {
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private TopicService topicService;
|
||||
|
||||
@GetMapping("/topic-nav")
|
||||
public GlobalResult topicNav(){
|
||||
List<Topic> topics = topicService.findTopicNav();
|
||||
return GlobalResultGenerator.genSuccessResult(topics);
|
||||
}
|
||||
|
||||
@GetMapping("/{name}")
|
||||
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable String name){
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findArticlesByTopicName(name);
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap();
|
||||
map.put("articles", pageInfo.getList());
|
||||
Map pagination = new HashMap();
|
||||
pagination.put("paginationPageCount",pageInfo.getPages());
|
||||
pagination.put("paginationPageNums",pageInfo.getNavigatepageNums());
|
||||
pagination.put("currentPage",pageInfo.getPageNum());
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.rymcu.vertical.web.api.user;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.vertical.core.result.GlobalResult;
|
||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.vertical.dto.ArticleDTO;
|
||||
import com.rymcu.vertical.dto.UserDTO;
|
||||
import com.rymcu.vertical.service.ArticleService;
|
||||
import com.rymcu.vertical.service.UserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@GetMapping("/{nickname}")
|
||||
public GlobalResult detail(@PathVariable String nickname){
|
||||
UserDTO userDTO = userService.findUserDTOByNickname(nickname);
|
||||
return GlobalResultGenerator.genSuccessResult(userDTO);
|
||||
}
|
||||
|
||||
@GetMapping("/{nickname}/articles")
|
||||
public GlobalResult userArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable String nickname){
|
||||
UserDTO userDTO = userService.findUserDTOByNickname(nickname);
|
||||
if (userDTO == null){
|
||||
return GlobalResultGenerator.genErrorResult("用户不存在!");
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findUserArticlesByIdUser(userDTO.getIdUser());
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap();
|
||||
map.put("articles", pageInfo.getList());
|
||||
Map pagination = new HashMap();
|
||||
pagination.put("paginationPageCount",pageInfo.getPages());
|
||||
pagination.put("paginationPageNums",pageInfo.getNavigatepageNums());
|
||||
pagination.put("currentPage",pageInfo.getPageNum());
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
<result column="article_tags" property="articleTags"></result>
|
||||
<result column="article_view_count" property="articleViewCount"></result>
|
||||
<result column="article_preview_content" property="articlePreviewContent"></result>
|
||||
<result column="comment_count" property="commentCount"></result>
|
||||
<result column="comment_count" property="articleCommentCount"></result>
|
||||
<result column="article_permalink" property="articlePermalink"></result>
|
||||
<result column="article_link" property="articleLink"></result>
|
||||
<result column="created_time" property="createdTime"></result>
|
||||
@ -31,7 +31,7 @@
|
||||
<result column="article_view_count" property="articleViewCount"></result>
|
||||
<result column="article_preview_content" property="articlePreviewContent"></result>
|
||||
<result column="article_content" property="articleContent"></result>
|
||||
<result column="comment_count" property="commentCount"></result>
|
||||
<result column="comment_count" property="articleCommentCount"></result>
|
||||
<result column="time_ago" property="timeAgo"></result>
|
||||
<result column="article_permalink" property="articlePermalink"></result>
|
||||
<result column="article_link" property="articleLink"></result>
|
||||
@ -50,22 +50,31 @@
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
</resultMap>
|
||||
<insert id="insertArticleContent">
|
||||
insert into article_content (id_article,article_content,article_content_html,created_time,updated_time)
|
||||
insert into vertical_article_content (id_article,article_content,article_content_html,created_time,updated_time)
|
||||
values (#{idArticle},#{articleContent},#{articleContentHtml},sysdate(),sysdate())
|
||||
</insert>
|
||||
<update id="updateArticleContent">
|
||||
update article_content set article_content = #{articleContent},article_content_html = #{articleContentHtml},updated_time = sysdate() where id_article = #{idArticle}
|
||||
update vertical_article_content set article_content = #{articleContent},article_content_html = #{articleContentHtml},updated_time = sysdate() where id_article = #{idArticle}
|
||||
</update>
|
||||
<select id="selectArticles" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from article art left join sys_user su on art.article_author_id = su.id order by updated_time desc
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id order by updated_time desc
|
||||
</select>
|
||||
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||||
select * from sys_user where id = #{id}
|
||||
select * from vertical_user where id = #{id}
|
||||
</select>
|
||||
<select id="selectArticleDTOById" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from article art left join sys_user su on art.article_author_id = su.id where art.id = #{id}
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where art.id = #{id}
|
||||
</select>
|
||||
<select id="selectArticleContent" resultMap="ArticleContentResultMap">
|
||||
select article_content,article_content_html from article_content where id_article = #{idArticle}
|
||||
select article_content,article_content_html from vertical_article_content where id_article = #{idArticle}
|
||||
</select>
|
||||
<select id="selectArticlesByTopicName" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id order by updated_time desc
|
||||
</select>
|
||||
<select id="selectArticlesByTagName" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id order by updated_time desc
|
||||
</select>
|
||||
<select id="selectUserArticles" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on su.id = #{idUser} and art.article_author_id = su.id where article_author_id = #{idUser} order by updated_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.rymcu.vertical.mapper.MenuMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Menu">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="idMenu"/>
|
||||
<result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
|
||||
<result column="name" jdbcType="OTHER" property="name"/>
|
||||
<result column="sort" jdbcType="INTEGER" property="sort"/>
|
||||
<result column="href" jdbcType="VARCHAR" property="href"/>
|
||||
<result column="menu_type" jdbcType="CHAR" property="menuType"/>
|
||||
<result column="permission" jdbcType="VARCHAR" property="permission"/>
|
||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
|
||||
<result column="status" jdbcType="CHAR" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMenuByIdRole" resultMap="BaseResultMap">
|
||||
select * from sys_role_menu srm left join sys_menu sm on srm.id_menu = sm.id where status = '0' order by sort
|
||||
</select>
|
||||
</mapper>
|
15
src/main/java/mapper/PermissionMapper.xml
Normal file
15
src/main/java/mapper/PermissionMapper.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.rymcu.vertical.mapper.PermissionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Permission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="id"/>
|
||||
<result column="permission_category" property="permissionCategory"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectMenuByIdRole" resultMap="BaseResultMap">
|
||||
select * from vertical_role_permission srm left join vertical_permission sm on srm.id = sm.id
|
||||
</select>
|
||||
</mapper>
|
@ -20,10 +20,10 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRoleByIdUser" resultMap="BaseResultMap">
|
||||
select sr.* from sys_user_role sur left join sys_role sr on sur.id_role = sr.id where id_user = #{id}
|
||||
select sr.* from vertical_user_role sur left join vertical_role sr on sur.id_role = sr.id where id_user = #{id}
|
||||
</select>
|
||||
<select id="selectRoleByInputCode" resultMap="BaseResultMap">
|
||||
select * from sys_role where input_code = #{inputCode}
|
||||
select * from vertical_role where input_code = #{inputCode}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -5,6 +5,28 @@
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="idTag"/>
|
||||
<id column="id" property="idTag"/>
|
||||
<id column="tag_title" property="tagTitle"/>
|
||||
<id column="tag_icon_path" property="tagIconPath"/>
|
||||
<id column="tag_uri" property="tagUri"/>
|
||||
<id column="tag_description" property="tagDescription"/>
|
||||
<id column="tag_view_count" property="tagViewCount"/>
|
||||
<id column="tag_article_count" property="tagArticleCount"/>
|
||||
<id column="tag_ad" property="tagAd"/>
|
||||
<id column="tag_show_side_ad" property="tagShowSideAd"/>
|
||||
<id column="created_time" property="createdTime"/>
|
||||
<id column="updated_time" property="updatedTime"/>
|
||||
</resultMap>
|
||||
<insert id="insertTagArticle">
|
||||
insert into vertical_tag_article (id_tag,id_article,created_time,updated_time) values (#{idTag},#{idArticle},sysdate(),sysdate())
|
||||
</insert>
|
||||
<insert id="insertUserTag">
|
||||
insert into vertical_user_tag (id_tag,id_user,type,created_time,updated_time) values (#{idTag},#{idUser},#{type},sysdate(),sysdate())
|
||||
</insert>
|
||||
<select id="selectCountTagArticleById" resultType="java.lang.Integer">
|
||||
select count(*) from vertical_tag_article where id_tag = #{idTag} and id_article = #{idArticle}
|
||||
</select>
|
||||
<select id="selectCountUserTagById" resultType="java.lang.Integer">
|
||||
select count(*) from vertical_user_tag where id_tag = #{idTag} and id_user = #{idUser}
|
||||
</select>
|
||||
</mapper>
|
24
src/main/java/mapper/TopicMapper.xml
Normal file
24
src/main/java/mapper/TopicMapper.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.rymcu.vertical.mapper.TopicMapper">
|
||||
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Topic">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" property="idTopic"/>
|
||||
<id column="topic_title" property="topicTitle"/>
|
||||
<id column="topic_uri" property="topicUri"/>
|
||||
<id column="topic_description" property="topicDescription"/>
|
||||
<id column="topic_type" property="topicType"/>
|
||||
<id column="topic_sort" property="topicSort"/>
|
||||
<id column="topic_icon_path" property="topicIconPath"/>
|
||||
<id column="topic_nva" property="topicNva"/>
|
||||
<id column="topic_tag_count" property="topicTagCount"/>
|
||||
<id column="topic_status" property="topicStatus"/>
|
||||
<id column="created_time" property="createdTime"/>
|
||||
<id column="updated_time" property="updatedTime"/>
|
||||
</resultMap>
|
||||
<select id="selectTopicNav" resultMap="BaseResultMap">
|
||||
select id,topic_title,topic_uri,topic_icon_path from vertical_topic where topic_nva = 0 and topic_status = 0 order by topic_sort
|
||||
</select>
|
||||
</mapper>
|
@ -5,41 +5,51 @@
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="idUser"/>
|
||||
<result column="account" jdbcType="VARCHAR" property="account"/>
|
||||
<result column="password" jdbcType="VARCHAR" property="password"/>
|
||||
<result column="nickname" jdbcType="VARCHAR" property="nickname"/>
|
||||
<result column="real_name" jdbcType="VARCHAR" property="realName"/>
|
||||
<result column="sex" jdbcType="CHAR" property="sex"/>
|
||||
<result column="avatar_type" jdbcType="VARCHAR" property="avatarType"/>
|
||||
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/>
|
||||
<result column="email" jdbcType="VARCHAR" property="email"/>
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
||||
<result column="status" jdbcType="CHAR" property="status"/>
|
||||
<result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/>
|
||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
|
||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
|
||||
<id column="id" property="idUser"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="nickname" property="nickname"/>
|
||||
<result column="real_name" property="realName"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="avatar_type" property="avatarType"/>
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="last_login_time" property="lastLoginTime"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="updated_time" property="updatedTime"/>
|
||||
</resultMap>
|
||||
<resultMap id="UserInfoResultMapper" type="com.rymcu.vertical.dto.UserInfoDTO">
|
||||
<result column="account" jdbcType="VARCHAR" property="account"/>
|
||||
<result column="nickname" jdbcType="VARCHAR" property="nickname"/>
|
||||
<result column="sex" jdbcType="VARCHAR" property="sex"/>
|
||||
<result column="avatar_type" jdbcType="VARCHAR" property="avatarType"/>
|
||||
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/>
|
||||
<result column="email" jdbcType="VARCHAR" property="email"/>
|
||||
<result column="phone" jdbcType="VARCHAR" property="phone"/>
|
||||
<result column="status" jdbcType="INTEGER" property="status"/>
|
||||
<result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="nickname" property="nickname"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="avatar_type" property="avatarType"/>
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="last_login_time" property="lastLoginTime"/>
|
||||
</resultMap>
|
||||
<resultMap id="DTOResultMapper" type="com.rymcu.vertical.dto.UserDTO">
|
||||
<result column="id" property="idUser"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="nickname" property="nickname"/>
|
||||
<result column="avatar_type" property="avatarType"/>
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
</resultMap>
|
||||
<insert id="insertUserRole">
|
||||
insert into sys_user_role (id_user,id_role,created_time) values (#{idUser},#{idRole},sysdate())
|
||||
insert into vertical_user_role (id_user,id_role,created_time) values (#{idUser},#{idRole},sysdate())
|
||||
</insert>
|
||||
|
||||
<select id="findByAccount" resultMap="BaseResultMap">
|
||||
select id, nickname, account, password, status from sys_user where account = #{account} AND status = 0
|
||||
select id, nickname, account, password, status from vertical_user where account = #{account} AND status = 0
|
||||
</select>
|
||||
<select id="findUserInfoByAccount" resultType="com.rymcu.vertical.dto.UserInfoDTO">
|
||||
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, password, status, last_login_time from sus_user when account = #{account}
|
||||
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, password, status, last_login_time from vertical_user when account = #{account}
|
||||
</select>
|
||||
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
||||
select id, nickname, avatar_type, avatar_url, account from vertical_user where nickname = #{nickname} and status = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -10,7 +10,7 @@ spring:
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: #密码
|
||||
password: d9d2j9w2
|
||||
database: 1
|
||||
timeout: 3000
|
||||
jedis:
|
||||
@ -20,17 +20,17 @@ spring:
|
||||
max-idle: 500
|
||||
min-idle: 0
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
username: #你的账号
|
||||
password: #你的密码
|
||||
url: jdbc:mysql://101.132.182.12:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: d9d2j9w2.RYMCU
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
resources:
|
||||
add-mappings: true
|
||||
mail:
|
||||
host: smtp.ym.163.com
|
||||
port: 465
|
||||
username: #你的邮箱账号
|
||||
password: #你的邮箱密码
|
||||
username: service@rymcu.com
|
||||
password: Aa12345678
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
@ -38,8 +38,8 @@ spring:
|
||||
wx:
|
||||
miniapp:
|
||||
configs:
|
||||
- appid: #
|
||||
secret: #
|
||||
- appid: wxf57df4f171606a26
|
||||
secret: 574ff86cb48a42f3980b221e942c53b1
|
||||
token: #微信小程序消息服务器配置的token
|
||||
aesKey: #微信小程序消息服务器配置的EncodingAESKey
|
||||
msgDataFormat: JSON
|
||||
@ -48,7 +48,8 @@ logging:
|
||||
file:
|
||||
path: /logs/vertical
|
||||
level:
|
||||
root: info
|
||||
com:
|
||||
rymcu: warn
|
||||
server:
|
||||
port: 8099
|
||||
compression:
|
||||
|
@ -1,6 +1,6 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: pord
|
||||
# profiles:
|
||||
# active: pord
|
||||
thymeleaf:
|
||||
prefix: classpath:/templates/
|
||||
suffix: .html
|
||||
@ -10,7 +10,8 @@ spring:
|
||||
content-type: text/html
|
||||
cache: false
|
||||
redis:
|
||||
host: 127.0.0.1:6379
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: d9d2j9w2
|
||||
database: 1
|
||||
timeout: 3000
|
||||
@ -23,20 +24,20 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false
|
||||
username: root
|
||||
password: d9d2j9w2
|
||||
password: d9d2j9w2.RYMCU
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
resources:
|
||||
add-mappings: true
|
||||
mail:
|
||||
host: smtp.ym.163.com
|
||||
port: 465
|
||||
username: #你的邮箱账号
|
||||
password: #你的邮箱密码
|
||||
username: service@rymcu.com
|
||||
password: Aa12345678
|
||||
wx:
|
||||
miniapp:
|
||||
configs:
|
||||
- appid: #
|
||||
secret: #
|
||||
- appid: wxf57df4f171606a26
|
||||
secret: 574ff86cb48a42f3980b221e942c53b1
|
||||
token: #微信小程序消息服务器配置的token
|
||||
aesKey: #微信小程序消息服务器配置的EncodingAESKey
|
||||
msgDataFormat: JSON
|
||||
@ -45,6 +46,9 @@ logging:
|
||||
file:
|
||||
path: f:/logs/vertical
|
||||
server:
|
||||
port: 8082
|
||||
port: 8099
|
||||
servlet:
|
||||
context-path: /vertical
|
||||
context-path: /vertical
|
||||
version: 1.0
|
||||
resource:
|
||||
file-path: https://rymcu.com/vertical
|
Loading…
Reference in New Issue
Block a user