新功能发布,缺陷代码修复,用户体验提升
This commit is contained in:
parent
a2eccd5cf8
commit
8e32243ae4
40
README.md
40
README.md
@ -1,7 +1,5 @@
|
|||||||
# vertical
|
> 我们正在构建一个即严谨又活泼、专业又不失有趣的开源嵌入式知识平台。在这里我们可以畅所欲言、以平等、自由的身份获取或分享知识。在这里共同学习、交流、进步、成长。
|
||||||
vertical [vərtikəl],取纵横之`纵`,寓为奔放自如、笔意纵横
|
## 已完成
|
||||||
## 开发计划
|
|
||||||
### 已完成
|
|
||||||
- [x] 首页
|
- [x] 首页
|
||||||
- [x] 会员登录/注册
|
- [x] 会员登录/注册
|
||||||
- [x] 文章发布/编辑/详情/删除
|
- [x] 文章发布/编辑/详情/删除
|
||||||
@ -9,18 +7,30 @@ vertical [vərtikəl],取纵横之`纵`,寓为奔放自如、笔意纵横
|
|||||||
- [x] 找回密码
|
- [x] 找回密码
|
||||||
- [x] 用户管理
|
- [x] 用户管理
|
||||||
- [x] 角色/权限管理 (2019/12/05 21:52 更新)
|
- [x] 角色/权限管理 (2019/12/05 21:52 更新)
|
||||||
- [x] 专题管理 (2019/12/05 21:52 更新)
|
- [x] 专题管理 (2019/12/05 21:52 更新)
|
||||||
- [x] 标签管理 (2019/12/26 00:11 更新)
|
- [x] 标签管理 (2019/12/26 00:11 更新)
|
||||||
- [x] 专题-标签管理 (2019/12/26 00:11 更新)
|
- [x] 专题-标签管理 (2019/12/26 00:11 更新)
|
||||||
- [x] 用户-标签管理 (2019/12/26 00:11 更新)
|
- [x] 用户-标签管理 (2019/12/26 00:11 更新)
|
||||||
### 待完成
|
- [x] 个人信息修改 (2020/01/09 14:20 更新)
|
||||||
- [ ] 个人信息修改
|
- [ ] 消息系统
|
||||||
- [ ] 消息系统
|
- [x] 系统公告 (2020/03/12 14:20 更新)
|
||||||
- [ ] 评论系统
|
- [x] 回帖提醒 (2020/03/12 14:20 更新)
|
||||||
|
- [ ] 关注提醒 (2020/03/12 14:20 更新)
|
||||||
|
- [x] 评论系统 (2020/03/12 14:20 更新)
|
||||||
|
- [x] 我的草稿 (2020/03/16 00:20 更新)
|
||||||
|
- [x] 分享功能
|
||||||
|
- [x] 分享链接 (2020/03/16 12:20 更新)
|
||||||
|
- [x] 分享至微信 (2020/03/16 12:20 更新)
|
||||||
|
## 待完成
|
||||||
- [ ] SEO 优化
|
- [ ] SEO 优化
|
||||||
- [ ] 分享功能
|
- [ ] 关注功能
|
||||||
- [ ] 数据统计
|
- [ ] 关注用户
|
||||||
### 构想
|
- [ ] 关注文章
|
||||||
|
- [ ] 关注主题
|
||||||
|
- [ ] 关注标签
|
||||||
|
- [ ] 数据统计
|
||||||
|
- [ ] 作品集功能
|
||||||
|
## 构想
|
||||||
- [ ] 专业知识题库
|
- [ ] 专业知识题库
|
||||||
- [ ] 社区贡献系统
|
- [ ] 社区贡献系统
|
||||||
- [ ] 会员系统
|
- [ ] 会员系统
|
||||||
|
6
pom.xml
6
pom.xml
@ -24,6 +24,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
|
<version>2.9.3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
@ -123,6 +128,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.14</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
@ -26,10 +26,10 @@ public interface ArticleService extends Service<Article> {
|
|||||||
/**
|
/**
|
||||||
* 查询文章详情信息
|
* 查询文章详情信息
|
||||||
* @param id
|
* @param id
|
||||||
* @param i
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
ArticleDTO findArticleDTOById(Integer id, int i);
|
ArticleDTO findArticleDTOById(Integer id, Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询主题下文章列表
|
* 查询主题下文章列表
|
||||||
@ -74,4 +74,17 @@ public interface ArticleService extends Service<Article> {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
void incrementArticleViewCount(Integer id);
|
void incrementArticleViewCount(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分享链接数据
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map share(Integer id) throws BaseApiException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询草稿文章类别
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ArticleDTO> findDrafts() throws BaseApiException;
|
||||||
}
|
}
|
||||||
|
16
src/main/java/com/rymcu/vertical/service/CommentService.java
Normal file
16
src/main/java/com/rymcu/vertical/service/CommentService.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package com.rymcu.vertical.service;
|
||||||
|
|
||||||
|
import com.rymcu.vertical.core.service.Service;
|
||||||
|
import com.rymcu.vertical.dto.CommentDTO;
|
||||||
|
import com.rymcu.vertical.entity.Comment;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface CommentService extends Service<Comment> {
|
||||||
|
|
||||||
|
List<CommentDTO> getArticleComments(Integer idArticle);
|
||||||
|
|
||||||
|
Map postComment(Comment comment, HttpServletRequest request);
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
package com.rymcu.vertical.service;
|
package com.rymcu.vertical.service;
|
||||||
|
|
||||||
import com.rymcu.vertical.core.service.Service;
|
import com.rymcu.vertical.core.service.Service;
|
||||||
|
import com.rymcu.vertical.dto.LabelModel;
|
||||||
import com.rymcu.vertical.entity.Article;
|
import com.rymcu.vertical.entity.Article;
|
||||||
import com.rymcu.vertical.entity.Tag;
|
import com.rymcu.vertical.entity.Tag;
|
||||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,4 +36,10 @@ public interface TagService extends Service<Tag> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map saveTag(Tag tag);
|
Map saveTag(Tag tag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取标签列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LabelModel> findTagLabels();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,114 @@
|
|||||||
|
package com.rymcu.vertical.service.impl;
|
||||||
|
|
||||||
|
import com.rymcu.vertical.core.constant.NotificationConstant;
|
||||||
|
import com.rymcu.vertical.core.service.AbstractService;
|
||||||
|
import com.rymcu.vertical.dto.Author;
|
||||||
|
import com.rymcu.vertical.dto.CommentDTO;
|
||||||
|
import com.rymcu.vertical.entity.Article;
|
||||||
|
import com.rymcu.vertical.entity.Comment;
|
||||||
|
import com.rymcu.vertical.mapper.CommentMapper;
|
||||||
|
import com.rymcu.vertical.service.ArticleService;
|
||||||
|
import com.rymcu.vertical.service.CommentService;
|
||||||
|
import com.rymcu.vertical.util.Html2TextUtil;
|
||||||
|
import com.rymcu.vertical.util.NotificationUtils;
|
||||||
|
import com.rymcu.vertical.util.Utils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CommentServiceImpl extends AbstractService<Comment> implements CommentService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CommentMapper commentMapper;
|
||||||
|
@Resource
|
||||||
|
private ArticleService articleService;
|
||||||
|
|
||||||
|
private static final int MAX_PREVIEW = 200;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommentDTO> getArticleComments(Integer idArticle) {
|
||||||
|
List<CommentDTO> commentDTOList = commentMapper.selectArticleComments(idArticle);
|
||||||
|
commentDTOList.forEach(commentDTO -> {
|
||||||
|
commentDTO.setTimeAgo(Utils.getTimeAgo(commentDTO.getCreatedTime()));
|
||||||
|
if (commentDTO.getCommentAuthorId() != null) {
|
||||||
|
Author author = commentMapper.selectAuthor(commentDTO.getCommentAuthorId());
|
||||||
|
if (author != null) {
|
||||||
|
commentDTO.setCommenter(author);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (commentDTO.getCommentOriginalCommentId() != null) {
|
||||||
|
Author commentOriginalAuthor = commentMapper.selectCommentOriginalAuthor(commentDTO.getCommentOriginalCommentId());
|
||||||
|
if (commentOriginalAuthor != null) {
|
||||||
|
commentDTO.setCommentOriginalAuthorThumbnailURL(commentOriginalAuthor.getUserAvatarURL());
|
||||||
|
commentDTO.setCommentOriginalAuthorNickname(commentOriginalAuthor.getUserNickname());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return commentDTOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map postComment(Comment comment, HttpServletRequest request) {
|
||||||
|
Map map = new HashMap(1);
|
||||||
|
if(comment.getCommentArticleId() == null){
|
||||||
|
map.put("message","非法访问,文章主键异常!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if(comment.getCommentAuthorId() == null){
|
||||||
|
map.put("message","非法访问,用户未登录!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(comment.getCommentContent())){
|
||||||
|
map.put("message","回帖内容不能为空!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
Article article = articleService.findById(comment.getCommentArticleId().toString());
|
||||||
|
if (article == null) {
|
||||||
|
map.put("message","文章不存在!");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
String ip = Utils.getIpAddress(request);
|
||||||
|
String ua = request.getHeader("user-agent");
|
||||||
|
comment.setCommentIP(ip);
|
||||||
|
comment.setCommentUA(ua);
|
||||||
|
comment.setCreatedTime(new Date());
|
||||||
|
commentMapper.insertSelective(comment);
|
||||||
|
StringBuilder commentSharpUrl = new StringBuilder(article.getArticlePermalink());
|
||||||
|
commentSharpUrl.append("/comment/").append(comment.getIdComment());
|
||||||
|
commentMapper.updateCommentSharpUrl(comment.getIdComment(), commentSharpUrl.toString());
|
||||||
|
|
||||||
|
String commentContent = comment.getCommentContent();
|
||||||
|
if(StringUtils.isNotBlank(commentContent)){
|
||||||
|
Integer length = commentContent.length();
|
||||||
|
if(length > MAX_PREVIEW){
|
||||||
|
length = 200;
|
||||||
|
}
|
||||||
|
String commentPreviewContent = commentContent.substring(0,length);
|
||||||
|
commentContent = Html2TextUtil.getContent(commentPreviewContent);
|
||||||
|
// 评论者不是作者本人则进行消息通知
|
||||||
|
if (!article.getArticleAuthorId().equals(comment.getCommentAuthorId())) {
|
||||||
|
NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent);
|
||||||
|
}
|
||||||
|
// 判断是否是回复消息
|
||||||
|
if (comment.getCommentOriginalCommentId() != null && comment.getCommentOriginalCommentId() != 0) {
|
||||||
|
Comment originalComment = commentMapper.selectByPrimaryKey(comment.getCommentOriginalCommentId());
|
||||||
|
// 回复消息时,评论者不是上级评论作者则进行消息通知
|
||||||
|
if (!comment.getCommentAuthorId().equals(originalComment.getCommentAuthorId())) {
|
||||||
|
NotificationUtils.saveNotification(originalComment.getCommentAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
@ -63,7 +63,8 @@ public class JavaMailServiceImpl implements JavaMailService {
|
|||||||
private Integer sendCode(String to, Integer type) throws MessagingException {
|
private Integer sendCode(String to, Integer type) throws MessagingException {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
// 表示SMTP发送邮件,需要进行身份验证
|
// 表示SMTP发送邮件,需要进行身份验证
|
||||||
props.put("mail.smtp.auth", "true");
|
props.put("mail.smtp.auth", true);
|
||||||
|
props.put("mail.smtp.ssl.enable", true);
|
||||||
props.put("mail.smtp.host", SERVER_HOST);
|
props.put("mail.smtp.host", SERVER_HOST);
|
||||||
props.put("mail.smtp.port", SERVER_PORT);
|
props.put("mail.smtp.port", SERVER_PORT);
|
||||||
// 如果使用ssl,则去掉使用25端口的配置,进行如下配置,
|
// 如果使用ssl,则去掉使用25端口的配置,进行如下配置,
|
||||||
|
@ -1,24 +1,32 @@
|
|||||||
package com.rymcu.vertical.task;
|
package com.rymcu.vertical.task;
|
||||||
|
|
||||||
|
import com.rymcu.vertical.core.constant.ProjectConstant;
|
||||||
import com.rymcu.vertical.util.BaiDuUtils;
|
import com.rymcu.vertical.util.BaiDuUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ronger
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BaiduCronTask {
|
public class BaiduCronTask {
|
||||||
|
|
||||||
@Value("${resource.domain}")
|
@Value("${resource.domain}")
|
||||||
private String domain;
|
private String domain;
|
||||||
|
@Value(("${env}"))
|
||||||
|
private String env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时推送首页更新
|
* 定时推送首页更新
|
||||||
* */
|
* */
|
||||||
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
||||||
public void pushHome() {
|
public void pushHome() {
|
||||||
BaiDuUtils.updateSEOData(domain);
|
if (!ProjectConstant.ENV.equals(env)) {
|
||||||
|
BaiDuUtils.updateSEOData(domain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
139
src/main/java/com/rymcu/vertical/util/CacheUtils.java
Normal file
139
src/main/java/com/rymcu/vertical/util/CacheUtils.java
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
package com.rymcu.vertical.util;
|
||||||
|
|
||||||
|
import org.apache.shiro.cache.Cache;
|
||||||
|
import org.apache.shiro.cache.CacheManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache工具类
|
||||||
|
*/
|
||||||
|
public class CacheUtils {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(CacheUtils.class);
|
||||||
|
private static CacheManager cacheManager = SpringContextHolder.getBean(CacheManager.class);
|
||||||
|
|
||||||
|
private static final String SYS_CACHE = "system";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取SYS_CACHE缓存
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object get(String key) {
|
||||||
|
return get(SYS_CACHE, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取SYS_CACHE缓存
|
||||||
|
* @param key
|
||||||
|
* @param defaultValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object get(String key, Object defaultValue) {
|
||||||
|
Object value = get(key);
|
||||||
|
return value != null ? value : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入SYS_CACHE缓存
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static void put(String key, Object value) {
|
||||||
|
put(SYS_CACHE, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从SYS_CACHE缓存中移除
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static void remove(String key) {
|
||||||
|
remove(SYS_CACHE, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存
|
||||||
|
* @param cacheName
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object get(String cacheName, String key) {
|
||||||
|
return getCache(cacheName).get(getKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存
|
||||||
|
* @param cacheName
|
||||||
|
* @param key
|
||||||
|
* @param defaultValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object get(String cacheName, String key, Object defaultValue) {
|
||||||
|
Object value = get(cacheName, getKey(key));
|
||||||
|
return value != null ? value : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入缓存
|
||||||
|
* @param cacheName
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
public static void put(String cacheName, String key, Object value) {
|
||||||
|
getCache(cacheName).put(getKey(key), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从缓存中移除
|
||||||
|
* @param cacheName
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
public static void remove(String cacheName, String key) {
|
||||||
|
getCache(cacheName).remove(getKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从缓存中移除所有
|
||||||
|
* @param cacheName
|
||||||
|
*/
|
||||||
|
public static void removeAll(String cacheName) {
|
||||||
|
Cache<String, Object> cache = getCache(cacheName);
|
||||||
|
Set<String> keys = cache.keys();
|
||||||
|
for (Iterator<String> it = keys.iterator(); it.hasNext();){
|
||||||
|
cache.remove(it.next());
|
||||||
|
}
|
||||||
|
logger.info("清理缓存: {} => {}", cacheName, keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存键名,多数据源下增加数据源名称前缀
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String getKey(String key){
|
||||||
|
// String dsName = DataSourceHolder.getDataSourceName();
|
||||||
|
// if (StringUtils.isNotBlank(dsName)){
|
||||||
|
// return dsName + "_" + key;
|
||||||
|
// }
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得一个Cache,没有则显示日志。
|
||||||
|
* @param cacheName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static Cache<String, Object> getCache(String cacheName){
|
||||||
|
Cache<String, Object> cache = cacheManager.getCache(cacheName);
|
||||||
|
if (cache == null){
|
||||||
|
throw new RuntimeException("当前系统中没有定义“"+cacheName+"”这个缓存。");
|
||||||
|
}
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -42,7 +42,7 @@ public class NotificationUtils {
|
|||||||
},executor);
|
},executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void saveNotification(Integer idUser, Integer dataId, String dataType, String dataSummary) {
|
public static void saveNotification(Integer idUser, Integer dataId, String dataType, String dataSummary) {
|
||||||
ExecutorService executor= new ThreadPoolExecutor(1,1,0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
|
ExecutorService executor= new ThreadPoolExecutor(1,1,0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
|
||||||
CompletableFuture.supplyAsync(()-> {
|
CompletableFuture.supplyAsync(()-> {
|
||||||
try {
|
try {
|
||||||
|
@ -92,6 +92,6 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
|
|||||||
* 检查ApplicationContext不为空.
|
* 检查ApplicationContext不为空.
|
||||||
*/
|
*/
|
||||||
private static void assertContextInjected() {
|
private static void assertContextInjected() {
|
||||||
Validate.validState(applicationContext != null, "applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.");
|
Validate.validState(applicationContext != null, "application Context属性未注入, 请在applicationContext.xml中定义SpringContextHolder.");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,14 @@
|
|||||||
package com.rymcu.vertical.web.api.article;
|
package com.rymcu.vertical.web.api.article;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.rymcu.vertical.core.result.GlobalResult;
|
import com.rymcu.vertical.core.result.GlobalResult;
|
||||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||||
import com.rymcu.vertical.dto.ArticleDTO;
|
import com.rymcu.vertical.dto.ArticleDTO;
|
||||||
|
import com.rymcu.vertical.dto.CommentDTO;
|
||||||
import com.rymcu.vertical.service.ArticleService;
|
import com.rymcu.vertical.service.ArticleService;
|
||||||
|
import com.rymcu.vertical.service.CommentService;
|
||||||
|
import com.rymcu.vertical.util.Utils;
|
||||||
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
import com.rymcu.vertical.web.api.exception.BaseApiException;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -11,6 +16,7 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,12 +28,12 @@ public class ArticleController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ArticleService articleService;
|
private ArticleService articleService;
|
||||||
|
@Resource
|
||||||
|
private CommentService commentService;
|
||||||
|
|
||||||
@GetMapping("/detail/{id}")
|
@GetMapping("/detail/{id}")
|
||||||
public GlobalResult<Map<String, Object>> detail(@PathVariable Integer id){
|
public GlobalResult<Map<String, Object>> detail(@PathVariable Integer id, @RequestParam(defaultValue = "2") Integer type){
|
||||||
ArticleDTO articleDTO = articleService.findArticleDTOById(id,2);
|
ArticleDTO articleDTO = articleService.findArticleDTOById(id,type);
|
||||||
Map map = new HashMap<>(1);
|
Map map = new HashMap<>(1);
|
||||||
map.put("article", articleDTO);
|
map.put("article", articleDTO);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
@ -51,4 +57,27 @@ public class ArticleController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/comments")
|
||||||
|
public GlobalResult<Map<String, Object>> commons(@PathVariable Integer id){
|
||||||
|
List<CommentDTO> commentDTOList = commentService.getArticleComments(id);
|
||||||
|
Map map = new HashMap<>(1);
|
||||||
|
map.put("comments", commentDTOList);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/drafts")
|
||||||
|
public GlobalResult 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/share")
|
||||||
|
public GlobalResult share(@PathVariable Integer id) throws BaseApiException {
|
||||||
|
Map map = articleService.share(id);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.rymcu.vertical.core.service.log.annotation.VisitLogger;
|
|||||||
import com.rymcu.vertical.dto.ArticleDTO;
|
import com.rymcu.vertical.dto.ArticleDTO;
|
||||||
import com.rymcu.vertical.dto.ForgetPasswordDTO;
|
import com.rymcu.vertical.dto.ForgetPasswordDTO;
|
||||||
import com.rymcu.vertical.dto.TokenUser;
|
import com.rymcu.vertical.dto.TokenUser;
|
||||||
|
import com.rymcu.vertical.dto.UserRegisterInfoDTO;
|
||||||
import com.rymcu.vertical.entity.User;
|
import com.rymcu.vertical.entity.User;
|
||||||
import com.rymcu.vertical.service.ArticleService;
|
import com.rymcu.vertical.service.ArticleService;
|
||||||
import com.rymcu.vertical.service.JavaMailService;
|
import com.rymcu.vertical.service.JavaMailService;
|
||||||
@ -39,7 +40,7 @@ public class CommonApiController {
|
|||||||
private ArticleService articleService;
|
private ArticleService articleService;
|
||||||
|
|
||||||
@ApiOperation(value = "获取邮件验证码")
|
@ApiOperation(value = "获取邮件验证码")
|
||||||
@PostMapping("/get-email-code")
|
@GetMapping("/get-email-code")
|
||||||
public GlobalResult<Map<String, String>> getEmailCode(@RequestParam("email") String email) throws MessagingException {
|
public GlobalResult<Map<String, String>> getEmailCode(@RequestParam("email") String email) throws MessagingException {
|
||||||
Map<String, String> map = new HashMap<>(1);
|
Map<String, String> map = new HashMap<>(1);
|
||||||
map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage());
|
map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage());
|
||||||
@ -56,7 +57,7 @@ public class CommonApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取找回密码邮件")
|
@ApiOperation(value = "获取找回密码邮件")
|
||||||
@PostMapping("/get-forget-password-email")
|
@GetMapping("/get-forget-password-email")
|
||||||
public GlobalResult<Map<Object, Object>> getForgetPasswordEmail(@RequestParam("email") String email) throws MessagingException {
|
public GlobalResult<Map<Object, Object>> getForgetPasswordEmail(@RequestParam("email") String email) throws MessagingException {
|
||||||
Map<Object, Object> map = new HashMap<>(1);
|
Map<Object, Object> map = new HashMap<>(1);
|
||||||
map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage());
|
map.put("message",GlobalResultMessage.SEND_SUCCESS.getMessage());
|
||||||
@ -73,14 +74,14 @@ public class CommonApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public GlobalResult<Map> register(@RequestParam("email") String email, @RequestParam("password") String password, @RequestParam("code") String code){
|
public GlobalResult<Map> register(@RequestBody UserRegisterInfoDTO registerInfo){
|
||||||
Map map = userService.register(email,password,code);
|
Map map = userService.register(registerInfo.getEmail(), registerInfo.getPassword(), registerInfo.getCode());
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public GlobalResult<Map> login(@RequestParam("account") String account, @RequestParam("password") String password){
|
public GlobalResult<Map> login(@RequestBody User user){
|
||||||
Map map = userService.login(account,password);
|
Map map = userService.login(user.getAccount(), user.getPassword());
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import com.rymcu.vertical.core.result.GlobalResult;
|
import com.rymcu.vertical.core.result.GlobalResult;
|
||||||
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
import com.rymcu.vertical.core.result.GlobalResultGenerator;
|
||||||
import com.rymcu.vertical.dto.ArticleDTO;
|
import com.rymcu.vertical.dto.ArticleDTO;
|
||||||
|
import com.rymcu.vertical.dto.LabelModel;
|
||||||
import com.rymcu.vertical.service.ArticleService;
|
import com.rymcu.vertical.service.ArticleService;
|
||||||
|
import com.rymcu.vertical.service.TagService;
|
||||||
import com.rymcu.vertical.util.Utils;
|
import com.rymcu.vertical.util.Utils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -22,6 +24,8 @@ public class TagController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ArticleService articleService;
|
private ArticleService articleService;
|
||||||
|
@Resource
|
||||||
|
private TagService tagService;
|
||||||
|
|
||||||
@GetMapping("/{name}")
|
@GetMapping("/{name}")
|
||||||
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable String name){
|
public GlobalResult articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @PathVariable String name){
|
||||||
@ -31,4 +35,10 @@ public class TagController {
|
|||||||
Map map = Utils.getArticlesGlobalResult(pageInfo);
|
Map map = Utils.getArticlesGlobalResult(pageInfo);
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/tags")
|
||||||
|
public GlobalResult tags() {
|
||||||
|
List<LabelModel> list = tagService.findTagLabels();
|
||||||
|
return GlobalResultGenerator.genSuccessResult(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<result column="time_ago" property="timeAgo"></result>
|
<result column="time_ago" property="timeAgo"></result>
|
||||||
<result column="article_permalink" property="articlePermalink"></result>
|
<result column="article_permalink" property="articlePermalink"></result>
|
||||||
<result column="article_link" property="articleLink"></result>
|
<result column="article_link" property="articleLink"></result>
|
||||||
|
<result column="article_status" property="articleStatus"></result>
|
||||||
<result column="updated_time" property="updatedTime"></result>
|
<result column="updated_time" property="updatedTime"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
||||||
@ -50,11 +51,13 @@
|
|||||||
<result column="updated_time" property="updatedTime"/>
|
<result column="updated_time" property="updatedTime"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="ArticleTagDTOResultMap" type="com.rymcu.vertical.dto.ArticleTagDTO">
|
<resultMap id="ArticleTagDTOResultMap" type="com.rymcu.vertical.dto.ArticleTagDTO">
|
||||||
<id column="id" property="idTag"/>
|
<id column="id" property="idArticleTag"/>
|
||||||
<id column="tag_title" property="tagTitle"/>
|
<result column="id_tag" property="idTag"></result>
|
||||||
<id column="tag_icon_path" property="tagIconPath"/>
|
<result column="id_article" property="idArticle"></result>
|
||||||
<id column="tag_uri" property="tagUri"/>
|
<result column="tag_title" property="tagTitle"></result>
|
||||||
<id column="tag_description" property="tagDescription"/>
|
<result column="tag_icon_path" property="tagIconPath"></result>
|
||||||
|
<result column="tag_uri" property="tagUri"></result>
|
||||||
|
<result column="tag_description" property="tagDescription"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<insert id="insertArticleContent">
|
<insert id="insertArticleContent">
|
||||||
insert into vertical_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)
|
||||||
@ -69,14 +72,20 @@
|
|||||||
<delete id="deleteTagArticle">
|
<delete id="deleteTagArticle">
|
||||||
delete from vertical_tag_article where id_article = #{id}
|
delete from vertical_tag_article where id_article = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="deleteUnusedArticleTag">
|
||||||
|
delete from vertical_tag_article where id = #{idArticleTag}
|
||||||
|
</delete>
|
||||||
<select id="selectArticles" resultMap="DTOResultMap">
|
<select id="selectArticles" 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 art.*,su.nickname,su.avatar_url from vertical_article art left join vertical_user su on art.article_author_id = su.id where article_status = '0' order by updated_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAuthor" resultMap="AuthorResultMap">
|
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||||||
select * from vertical_user where id = #{id}
|
select * from vertical_user where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectArticleDTOById" resultMap="DTOResultMap">
|
<select id="selectArticleDTOById" 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 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}
|
||||||
|
<if test="type == 1">
|
||||||
|
and art.article_status = 0
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectArticleContent" resultMap="ArticleContentResultMap">
|
<select id="selectArticleContent" resultMap="ArticleContentResultMap">
|
||||||
select article_content,article_content_html from vertical_article_content where id_article = #{idArticle}
|
select article_content,article_content_html from vertical_article_content where id_article = #{idArticle}
|
||||||
@ -91,9 +100,13 @@
|
|||||||
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 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>
|
||||||
<select id="selectUserArticles" resultMap="DTOResultMap">
|
<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 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} and art.article_status = 0 order by updated_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectTags" resultMap="ArticleTagDTOResultMap">
|
<select id="selectTags" resultMap="ArticleTagDTOResultMap">
|
||||||
select vt.id, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt left join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle}
|
select vta.id, vta.id_tag, vta.id_article, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt left join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle}
|
||||||
|
</select>
|
||||||
|
<select id="selectDrafts" 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 where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
49
src/main/java/mapper/CommentMapper.xml
Normal file
49
src/main/java/mapper/CommentMapper.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?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.CommentMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Comment">
|
||||||
|
<id column="id" property="idComment"></id>
|
||||||
|
<result column="comment_content" property="commentContent"></result>
|
||||||
|
<result column="comment_author_id" property="commentAuthorId"></result>
|
||||||
|
<result column="comment_article_id" property="commentArticleId"></result>
|
||||||
|
<result column="comment_sharp_url" property="commentSharpUrl"></result>
|
||||||
|
<result column="comment_original_comment_id" property="commentOriginalCommentId"></result>
|
||||||
|
<result column="comment_status" property="commentStatus"></result>
|
||||||
|
<result column="comment_ip" property="commentIP"></result>
|
||||||
|
<result column="comment_ua" property="commentUA"></result>
|
||||||
|
<result column="comment_anonymous" property="commentAnonymous"></result>
|
||||||
|
<result column="comment_reply_count" property="commentReplyCount"></result>
|
||||||
|
<result column="comment_visible" property="commentVisible"></result>
|
||||||
|
<result column="created_time" property="createdTime"></result>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="DTOResultMap" type="com.rymcu.vertical.dto.CommentDTO">
|
||||||
|
<id column="id" property="idComment"></id>
|
||||||
|
<result column="comment_content" property="commentContent"></result>
|
||||||
|
<result column="comment_author_id" property="commentAuthorId"></result>
|
||||||
|
<result column="comment_article_id" property="commentArticleId"></result>
|
||||||
|
<result column="comment_sharp_url" property="commentSharpUrl"></result>
|
||||||
|
<result column="comment_original_comment_id" property="commentOriginalCommentId"></result>
|
||||||
|
<result column="comment_status" property="commentStatus"></result>
|
||||||
|
<result column="comment_anonymous" property="commentAnonymous"></result>
|
||||||
|
<result column="comment_reply_count" property="commentReplyCount"></result>
|
||||||
|
<result column="comment_visible" property="commentVisible"></result>
|
||||||
|
<result column="created_time" property="createdTime"></result>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="AuthorResultMap" type="com.rymcu.vertical.dto.Author">
|
||||||
|
<result column="id" property="idUser"/>
|
||||||
|
<result column="nickname" property="userNickname"/>
|
||||||
|
<result column="avatar_url" property="userAvatarURL"/>
|
||||||
|
</resultMap>
|
||||||
|
<update id="updateCommentSharpUrl">
|
||||||
|
update vertical_comment set comment_sharp_url = #{commentSharpUrl} where id = #{idComment}
|
||||||
|
</update>
|
||||||
|
<select id="selectArticleComments" resultMap="DTOResultMap">
|
||||||
|
select * from vertical_comment where comment_article_id = #{idArticle} order by created_time desc
|
||||||
|
</select>
|
||||||
|
<select id="selectAuthor" resultMap="AuthorResultMap">
|
||||||
|
select id,nickname,avatar_url from vertical_user where id = #{commentAuthorId}
|
||||||
|
</select>
|
||||||
|
<select id="selectCommentOriginalAuthor" resultMap="AuthorResultMap">
|
||||||
|
select vu.id,vu.nickname,vu.avatar_url from vertical_comment vc left join vertical_user vu on vu.id = vc.comment_author_id where vc.id = #{commentOriginalCommentId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -17,7 +17,7 @@
|
|||||||
update vertical_role set status = #{status},updated_time = sysdate() where id = #{idRole}
|
update vertical_role set status = #{status},updated_time = sysdate() where id = #{idRole}
|
||||||
</update>
|
</update>
|
||||||
<update id="update">
|
<update id="update">
|
||||||
update vertical_role set name = #{name}, input_code = ${inputCode}, weights = #{weights}, updated_time = sysdate() where id = #{idRole}
|
update vertical_role set name = #{name}, input_code = #{inputCode}, weights = #{weights}, updated_time = sysdate() where id = #{idRole}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectRoleByIdUser" resultMap="BaseResultMap">
|
<select id="selectRoleByIdUser" resultMap="BaseResultMap">
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
<id column="created_time" property="createdTime"/>
|
<id column="created_time" property="createdTime"/>
|
||||||
<id column="updated_time" property="updatedTime"/>
|
<id column="updated_time" property="updatedTime"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<resultMap id="TagLabelResultMap" type="com.rymcu.vertical.dto.LabelModel">
|
||||||
|
<result column="tag_title" property="label"></result>
|
||||||
|
<result column="tag_title" property="value"></result>
|
||||||
|
</resultMap>
|
||||||
<insert id="insertTagArticle">
|
<insert id="insertTagArticle">
|
||||||
insert into vertical_tag_article (id_tag,id_article,created_time,updated_time) values (#{idTag},#{idArticle},sysdate(),sysdate())
|
insert into vertical_tag_article (id_tag,id_article,created_time,updated_time) values (#{idTag},#{idArticle},sysdate(),sysdate())
|
||||||
</insert>
|
</insert>
|
||||||
@ -36,4 +40,7 @@
|
|||||||
<select id="selectCountUserTagById" resultType="java.lang.Integer">
|
<select id="selectCountUserTagById" resultType="java.lang.Integer">
|
||||||
select count(*) from vertical_user_tag where id_tag = #{idTag} and id_user = #{idUser}
|
select count(*) from vertical_user_tag where id_tag = #{idTag} and id_user = #{idUser}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectTagLabels" resultMap="TagLabelResultMap">
|
||||||
|
select tag_title from vertical_tag where tag_status = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -39,6 +39,7 @@
|
|||||||
<result column="nickname" property="nickname"/>
|
<result column="nickname" property="nickname"/>
|
||||||
<result column="avatar_type" property="avatarType"/>
|
<result column="avatar_type" property="avatarType"/>
|
||||||
<result column="avatar_url" property="avatarUrl"/>
|
<result column="avatar_url" property="avatarUrl"/>
|
||||||
|
<result column="signature" property="signature"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<insert id="insertUserRole">
|
<insert id="insertUserRole">
|
||||||
insert into vertical_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())
|
||||||
@ -67,7 +68,7 @@
|
|||||||
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where account = #{account}
|
select id, nickname, sex, avatar_type, avatar_url, email, phone, account, status, signature, last_login_time from vertical_user where account = #{account}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
<select id="selectUserDTOByNickname" resultMap="DTOResultMapper">
|
||||||
select id, nickname, avatar_type, avatar_url, account from vertical_user where nickname = #{nickname} and status = 0
|
select id, nickname, avatar_type, avatar_url, account, signature from vertical_user where nickname = #{nickname} and status = 0
|
||||||
</select>
|
</select>
|
||||||
<select id="selectRoleWeightsByUser" resultType="java.lang.Integer">
|
<select id="selectRoleWeightsByUser" resultType="java.lang.Integer">
|
||||||
select vr.weights from vertical_role vr left join vertical_user_role vur on vr.id = vur.id_role where vur.id_user = #{idUser}
|
select vr.weights from vertical_role vr left join vertical_user_role vur on vr.id = vur.id_role where vur.id_user = #{idUser}
|
||||||
|
Loading…
Reference in New Issue
Block a user