From 8a89873844d7f85d80527733c5745de3544d4f32 Mon Sep 17 00:00:00 2001 From: x ronger Date: Thu, 24 Sep 2020 22:53:21 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=201.=20=E5=85=B3=E6=B3=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=202.=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=203.=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E4=BC=98=E5=8C=96=204.=20?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vertical/config/BaseExceptionHandler.java | 8 +- .../rymcu/vertical/config/BaseShiroRealm.java | 4 +- .../rymcu/vertical/config/ShiroConfig.java | 1 + .../rymcu/vertical/dto/NotificationDTO.java | 2 + .../java/com/rymcu/vertical/entity/Tag.java | 2 + .../java/com/rymcu/vertical/entity/Topic.java | 2 + .../rymcu/vertical/mapper/ArticleMapper.java | 22 +++ .../rymcu/vertical/mapper/TopicMapper.java | 4 +- .../com/rymcu/vertical/mapper/UserMapper.java | 7 + .../vertical/service/ArticleService.java | 8 ++ .../vertical/service/PermissionService.java | 7 +- .../rymcu/vertical/service/TopicService.java | 13 +- .../service/impl/ArticleServiceImpl.java | 131 +++++++++++------- .../service/impl/NotificationServiceImpl.java | 33 ++++- .../service/impl/PermissionServiceImpl.java | 7 +- .../service/impl/PortfolioServiceImpl.java | 4 +- .../vertical/service/impl/TagServiceImpl.java | 39 +++--- .../service/impl/TopicServiceImpl.java | 43 +++--- .../service/impl/UserServiceImpl.java | 4 +- .../com/rymcu/vertical/util/BaiDuUtils.java | 3 +- .../com/rymcu/vertical/util/UserUtils.java | 2 +- .../web/api/admin/AdminController.java | 13 +- .../web/api/article/ArticleController.java | 7 + .../web/api/common/UploadController.java | 41 +++--- .../notification/NotificationController.java | 4 +- .../vertical/web/api/user/UserController.java | 2 + src/main/java/mapper/ArticleMapper.xml | 17 ++- src/main/java/mapper/DashboardMapper.xml | 13 +- src/main/java/mapper/TopicMapper.xml | 6 +- src/main/java/mapper/UserMapper.xml | 3 + 30 files changed, 307 insertions(+), 145 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/config/BaseExceptionHandler.java b/src/main/java/com/rymcu/vertical/config/BaseExceptionHandler.java index fc47680..9ebe05e 100644 --- a/src/main/java/com/rymcu/vertical/config/BaseExceptionHandler.java +++ b/src/main/java/com/rymcu/vertical/config/BaseExceptionHandler.java @@ -23,6 +23,8 @@ import java.util.Map; /** * 全局异常处理器 + * + * @author ronger * */ @RestControllerAdvice public class BaseExceptionHandler { @@ -46,7 +48,8 @@ public class BaseExceptionHandler { result.setCode(1000002); result.setMessage("用户无权限"); logger.info("用户无权限"); - }else if (ex instanceof ServiceException) {//业务失败的异常,如“账号或密码错误” + }else if (ex instanceof ServiceException) { + //业务失败的异常,如“账号或密码错误” result.setCode(((ServiceException) ex).getCode()); result.setMessage(ex.getMessage()); logger.info(ex.getMessage()); @@ -88,7 +91,8 @@ public class BaseExceptionHandler { } else if (ex instanceof UnauthorizedException) { attributes.put("code", "1000002"); attributes.put("message", "用户无权限"); - } else if (ex instanceof ServiceException) {//业务失败的异常,如“账号或密码错误” + } else if (ex instanceof ServiceException) { + //业务失败的异常,如“账号或密码错误” attributes.put("code",((ServiceException) ex).getCode()); attributes.put("message",ex.getMessage()); logger.info(ex.getMessage()); diff --git a/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java b/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java index 7c88b93..1a0126b 100644 --- a/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java +++ b/src/main/java/com/rymcu/vertical/config/BaseShiroRealm.java @@ -42,8 +42,6 @@ public class BaseShiroRealm extends AuthorizingRealm { @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { - //Principal principal = (Principal) getAvailablePrincipal(principals); -// System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()"); SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); Principal principal = (Principal)principals.getPrimaryPrincipal(); User user = new User(); @@ -55,7 +53,7 @@ public class BaseShiroRealm extends AuthorizingRealm { authorizationInfo.addRole(role.getInputCode()); } } - List permissions = permissionService.selectMenuByUser(user); + List permissions = permissionService.selectPermissionByUser(user); for (Permission perm : permissions) { if (perm.getPermissionCategory() != null) { authorizationInfo.addStringPermission(perm.getPermissionCategory()); diff --git a/src/main/java/com/rymcu/vertical/config/ShiroConfig.java b/src/main/java/com/rymcu/vertical/config/ShiroConfig.java index 9fda51a..25b48ce 100644 --- a/src/main/java/com/rymcu/vertical/config/ShiroConfig.java +++ b/src/main/java/com/rymcu/vertical/config/ShiroConfig.java @@ -55,6 +55,7 @@ public class ShiroConfig implements EnvironmentAware { filterChainDefinitionMap.put("/api/**", "anon"); filterChainDefinitionMap.put("/ws/**", "anon"); + filterChainDefinitionMap.put("/wx/**", "anon"); filterChainDefinitionMap.put("/**", "auth"); //配置shiro默认登录界面地址,前后端分离中登录界面跳转应由前端路由控制,后台仅返回json数据 shiroFilterFactoryBean.setLoginUrl("/login"); diff --git a/src/main/java/com/rymcu/vertical/dto/NotificationDTO.java b/src/main/java/com/rymcu/vertical/dto/NotificationDTO.java index c9d69f7..4384763 100644 --- a/src/main/java/com/rymcu/vertical/dto/NotificationDTO.java +++ b/src/main/java/com/rymcu/vertical/dto/NotificationDTO.java @@ -2,11 +2,13 @@ package com.rymcu.vertical.dto; import com.rymcu.vertical.entity.Notification; import lombok.Data; +import lombok.EqualsAndHashCode; /** * @author ronger */ @Data +@EqualsAndHashCode(callSuper = false) public class NotificationDTO extends Notification { private Integer idNotification; diff --git a/src/main/java/com/rymcu/vertical/entity/Tag.java b/src/main/java/com/rymcu/vertical/entity/Tag.java index b53e68a..9184f90 100644 --- a/src/main/java/com/rymcu/vertical/entity/Tag.java +++ b/src/main/java/com/rymcu/vertical/entity/Tag.java @@ -44,4 +44,6 @@ public class Tag implements Serializable,Cloneable { private Date updatedTime; /** 保留标签 */ private String tagReservation; + /** 描述 */ + private String tagDescriptionHtml; } diff --git a/src/main/java/com/rymcu/vertical/entity/Topic.java b/src/main/java/com/rymcu/vertical/entity/Topic.java index 4cb6c72..0011dda 100644 --- a/src/main/java/com/rymcu/vertical/entity/Topic.java +++ b/src/main/java/com/rymcu/vertical/entity/Topic.java @@ -42,5 +42,7 @@ public class Topic { private Date createdTime; /** 更新时间 */ private Date updatedTime; + /** 专题描述 Html */ + private String topicDescriptionHtml; } diff --git a/src/main/java/com/rymcu/vertical/mapper/ArticleMapper.java b/src/main/java/com/rymcu/vertical/mapper/ArticleMapper.java index 8c74ece..81264f5 100644 --- a/src/main/java/com/rymcu/vertical/mapper/ArticleMapper.java +++ b/src/main/java/com/rymcu/vertical/mapper/ArticleMapper.java @@ -136,4 +136,26 @@ public interface ArticleMapper extends Mapper
{ * @return */ List selectPortfolioArticles(@Param("idArticle") Integer idArticle); + + /** + * 更新文章标签 + * @param idArticle + * @param tags + * @return + */ + Integer updateArticleTags(@Param("idArticle") Integer idArticle, @Param("tags") String tags); + + /** + * 判断是否有评论 + * @param id + * @return + */ + boolean existsCommentWithPrimaryKey(@Param("id") Integer id); + + /** + * 删除关联作品集数据 + * @param id + * @return + */ + Integer deleteLinkedPortfolioData(@Param("id") Integer id); } diff --git a/src/main/java/com/rymcu/vertical/mapper/TopicMapper.java b/src/main/java/com/rymcu/vertical/mapper/TopicMapper.java index 266d867..d1dbd99 100644 --- a/src/main/java/com/rymcu/vertical/mapper/TopicMapper.java +++ b/src/main/java/com/rymcu/vertical/mapper/TopicMapper.java @@ -32,6 +32,7 @@ public interface TopicMapper extends Mapper { List selectTopicTag(@Param("idTopic") Integer idTopic); /** + * 更新 * @param idTopic * @param topicTitle * @param topicUri @@ -40,9 +41,10 @@ public interface TopicMapper extends Mapper { * @param topicStatus * @param topicSort * @param topicDescription + * @param topicDescriptionHtml * @return */ - Integer update(@Param("idTopic") Integer idTopic, @Param("topicTitle") String topicTitle, @Param("topicUri") String topicUri, @Param("topicIconPath") String topicIconPath, @Param("topicNva") String topicNva, @Param("topicStatus") String topicStatus, @Param("topicSort") Integer topicSort, @Param("topicDescription") String topicDescription); + Integer update(@Param("idTopic") Integer idTopic, @Param("topicTitle") String topicTitle, @Param("topicUri") String topicUri, @Param("topicIconPath") String topicIconPath, @Param("topicNva") String topicNva, @Param("topicStatus") String topicStatus, @Param("topicSort") Integer topicSort, @Param("topicDescription") String topicDescription, @Param("topicDescriptionHtml") String topicDescriptionHtml); /** * @param idTopic diff --git a/src/main/java/com/rymcu/vertical/mapper/UserMapper.java b/src/main/java/com/rymcu/vertical/mapper/UserMapper.java index ce95279..de1eae8 100644 --- a/src/main/java/com/rymcu/vertical/mapper/UserMapper.java +++ b/src/main/java/com/rymcu/vertical/mapper/UserMapper.java @@ -113,4 +113,11 @@ public interface UserMapper extends Mapper { * @return */ Author selectAuthor(@Param("id") Integer id); + + /** + * 更新用户最后登录时间 + * @param idUser + * @return + */ + Integer updateLastLoginTime(@Param("idUser") Integer idUser); } \ No newline at end of file diff --git a/src/main/java/com/rymcu/vertical/service/ArticleService.java b/src/main/java/com/rymcu/vertical/service/ArticleService.java index 65f6718..74ead8d 100644 --- a/src/main/java/com/rymcu/vertical/service/ArticleService.java +++ b/src/main/java/com/rymcu/vertical/service/ArticleService.java @@ -105,4 +105,12 @@ public interface ArticleService extends Service
{ * @return */ List selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser); + + /** + * 更新文章标签 + * @param idArticle + * @param tags + * @return + */ + Map updateTags(Integer idArticle, String tags) throws UnsupportedEncodingException, BaseApiException; } diff --git a/src/main/java/com/rymcu/vertical/service/PermissionService.java b/src/main/java/com/rymcu/vertical/service/PermissionService.java index 74eea8c..bf577d1 100644 --- a/src/main/java/com/rymcu/vertical/service/PermissionService.java +++ b/src/main/java/com/rymcu/vertical/service/PermissionService.java @@ -14,5 +14,10 @@ import java.util.List; */ public interface PermissionService extends Service { - List selectMenuByUser(User sysUser); + /** + * 获取用户权限 + * @param sysUser + * @return + */ + List selectPermissionByUser(User sysUser); } diff --git a/src/main/java/com/rymcu/vertical/service/TopicService.java b/src/main/java/com/rymcu/vertical/service/TopicService.java index cffce69..60bbd27 100644 --- a/src/main/java/com/rymcu/vertical/service/TopicService.java +++ b/src/main/java/com/rymcu/vertical/service/TopicService.java @@ -22,11 +22,9 @@ public interface TopicService extends Service { /** * 根据 topicUri 获取主题信息及旗下标签数据 * @param topicUri 主题 URI - * @param page - * @param rows * @return * */ - Map findTopicByTopicUri(String topicUri, Integer page, Integer rows); + Topic findTopicByTopicUri(String topicUri); /** * 新增/更新主题信息 @@ -56,4 +54,13 @@ public interface TopicService extends Service { * @return */ Map unbindTopicTag(TopicTagDTO topicTag); + + /** + * 获取主题下标签列表 + * @param topicUri + * @param page + * @param rows + * @return + */ + Map findTagsByTopicUri(String topicUri, Integer page, Integer rows); } diff --git a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java index ef3808d..dd620cc 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java @@ -25,10 +25,7 @@ import tk.mybatis.mapper.entity.Condition; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.UnsupportedEncodingException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author ronger @@ -62,19 +59,19 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } else { list = articleMapper.selectArticles(searchDTO.getSearchText(), searchDTO.getTag(), searchDTO.getTopicUri()); } - list.forEach(article->{ - genArticle(article,0); + list.forEach(article -> { + genArticle(article, 0); }); return list; } @Override public ArticleDTO findArticleDTOById(Integer id, Integer type) { - ArticleDTO articleDTO = articleMapper.selectArticleDTOById(id,type); + ArticleDTO articleDTO = articleMapper.selectArticleDTOById(id, type); if (articleDTO == null) { return null; } - articleDTO = genArticle(articleDTO,type); + articleDTO = genArticle(articleDTO, type); return articleDTO; } @@ -82,7 +79,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti public List findArticlesByTopicUri(String name) { List articleDTOS = articleMapper.selectArticlesByTopicUri(name); articleDTOS.forEach(articleDTO -> { - genArticle(articleDTO,0); + genArticle(articleDTO, 0); }); return articleDTOS; } @@ -96,29 +93,30 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findUserArticlesByIdUser(Integer idUser) { List list = articleMapper.selectUserArticles(idUser); - list.forEach(article->{ - genArticle(article,0); + list.forEach(article -> { + genArticle(article, 0); }); return list; } @Override - @Transactional(rollbackFor = { UnsupportedEncodingException.class, BaseApiException.class }) + @Transactional(rollbackFor = {UnsupportedEncodingException.class, BaseApiException.class}) public Map postArticle(ArticleDTO article, HttpServletRequest request) throws UnsupportedEncodingException, BaseApiException { Map map = new HashMap(1); - if(StringUtils.isBlank(article.getArticleTitle())){ - map.put("message","标题不能为空!"); + if (StringUtils.isBlank(article.getArticleTitle())) { + map.put("message", "标题不能为空!"); return map; } - if(StringUtils.isBlank(article.getArticleContent())){ - map.put("message","正文不能为空!"); + if (StringUtils.isBlank(article.getArticleContent())) { + map.put("message", "正文不能为空!"); return map; } + boolean isUpdate = false; String articleTitle = article.getArticleTitle(); String articleTags = article.getArticleTags(); String articleContent = article.getArticleContent(); String articleContentHtml = article.getArticleContentHtml(); - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); String reservedTag = checkTags(articleTags); boolean notification = false; if (StringUtils.isNotBlank(reservedTag)) { @@ -131,7 +129,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } } Article newArticle; - if(article.getIdArticle() == null || article.getIdArticle() == 0){ + if (article.getIdArticle() == null || article.getIdArticle() == 0) { newArticle = new Article(); newArticle.setArticleTitle(articleTitle); newArticle.setArticleAuthorId(user.getIdUser()); @@ -140,24 +138,19 @@ public class ArticleServiceImpl extends AbstractService
implements Arti newArticle.setUpdatedTime(newArticle.getCreatedTime()); newArticle.setArticleStatus(article.getArticleStatus()); articleMapper.insertSelective(newArticle); - articleMapper.insertArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml); - if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) { - BaiDuUtils.sendSEOData(newArticle.getArticlePermalink()); - } + articleMapper.insertArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml); } else { + isUpdate = true; newArticle = articleMapper.selectByPrimaryKey(article.getIdArticle()); - if(!user.getIdUser().equals(newArticle.getArticleAuthorId())){ - map.put("message","非法访问!"); + if (!user.getIdUser().equals(newArticle.getArticleAuthorId())) { + map.put("message", "非法访问!"); return map; } newArticle.setArticleTitle(articleTitle); newArticle.setArticleTags(articleTags); newArticle.setArticleStatus(article.getArticleStatus()); newArticle.setUpdatedTime(new Date()); - articleMapper.updateArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml); - if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) { - BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); - } + articleMapper.updateArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml); } if (notification && defaultStatus.equals(newArticle.getArticleStatus())) { @@ -174,23 +167,34 @@ public class ArticleServiceImpl extends AbstractService
implements Arti newArticle.setArticleLink("/draft/" + newArticle.getIdArticle()); } - if(StringUtils.isNotBlank(articleContentHtml)){ + if (StringUtils.isNotBlank(articleContentHtml)) { Integer length = articleContentHtml.length(); - if(length > MAX_PREVIEW){ + if (length > MAX_PREVIEW) { length = MAX_PREVIEW; } - String articlePreviewContent = articleContentHtml.substring(0,length); + String articlePreviewContent = articleContentHtml.substring(0, length); newArticle.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent)); } articleMapper.updateByPrimaryKeySelective(newArticle); + // 推送百度 SEO + if (!ProjectConstant.ENV.equals(env) + && defaultStatus.equals(newArticle.getArticleStatus()) + && articleContent.length() >= MAX_PREVIEW) { + if (isUpdate) { + BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); + } else { + BaiDuUtils.sendSEOData(newArticle.getArticlePermalink()); + } + } + map.put("id", newArticle.getIdArticle()); return map; } private String checkTags(String articleTags) { // 判断文章是否有标签 - if(StringUtils.isBlank(articleTags)){ + if (StringUtils.isBlank(articleTags)) { return ""; } // 判断是否存在系统配置的保留标签词 @@ -206,7 +210,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti continue; } - for (String articleTag: articleTagArr) { + for (String articleTag : articleTagArr) { if (StringUtils.isBlank(articleTag)) { continue; } @@ -223,21 +227,31 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override @Transactional(rollbackFor = Exception.class) public Map delete(Integer id) { - Map map = new HashMap(1); + Map map = new HashMap(1); Integer result; - // 删除引用标签记录 - result = articleMapper.deleteTagArticle(id); - if (result > 0){ + // 判断是否有评论 + boolean isHavComment = articleMapper.existsCommentWithPrimaryKey(id); + if (isHavComment) { + map.put("message", "已有评论的文章不允许删除!"); + } else { + // 删除关联数据(作品集关联关系,标签关联关系) + deleteLinkedData(id); + // 删除文章 result = articleMapper.deleteByPrimaryKey(id); - if (result < 1){ + if (result < 1) { map.put("message", "删除失败!"); } - } else { - map.put("message", "删除失败!"); } return map; } + private void deleteLinkedData(Integer id) { + // 删除关联作品集 + articleMapper.deleteLinkedPortfolioData(id); + // 删除引用标签记录 + articleMapper.deleteTagArticle(id); + } + @Override @Transactional(rollbackFor = Exception.class) public void incrementArticleViewCount(Integer id) { @@ -249,7 +263,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public Map share(Integer id) throws BaseApiException { Article article = articleMapper.selectByPrimaryKey(id); - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); StringBuilder shareUrl = new StringBuilder(article.getArticlePermalink()); shareUrl.append("?s=").append(user.getNickname()); Map map = new HashMap(1); @@ -259,10 +273,10 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findDrafts() throws BaseApiException { - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); List list = articleMapper.selectDrafts(user.getIdUser()); - list.forEach(article->{ - genArticle(article,0); + list.forEach(article -> { + genArticle(article, 0); }); return list; } @@ -270,21 +284,38 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findArticlesByIdPortfolio(Integer idPortfolio) { List list = articleMapper.selectArticlesByIdPortfolio(idPortfolio); - list.forEach(article->{ - genArticle(article,0); + list.forEach(article -> { + genArticle(article, 0); }); return list; } @Override public List selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) { - List list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio,searchText,idUser); - list.forEach(article->{ - genArticle(article,0); + List list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser); + list.forEach(article -> { + genArticle(article, 0); }); return list; } + @Override + @Transactional(rollbackFor = Exception.class) + public Map updateTags(Integer idArticle, String tags) throws UnsupportedEncodingException, BaseApiException { + Map map = new HashMap(2); + Article article = articleMapper.selectByPrimaryKey(idArticle); + if (Objects.nonNull(article)) { + article.setArticleTags(tags); + articleMapper.updateArticleTags(idArticle, tags); + tagService.saveTagArticle(article); + map.put("success", true); + } else { + map.put("success", false); + map.put("message", "更新失败,文章不存在!"); + } + return map; + } + private ArticleDTO genArticle(ArticleDTO article, Integer type) { Integer ARTICLE_LIST = 0; Integer ARTICLE_VIEW = 1; @@ -296,7 +327,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti article.setTags(tags); if (!type.equals(ARTICLE_LIST)) { ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle()); - if (type.equals(ARTICLE_VIEW)){ + if (type.equals(ARTICLE_VIEW)) { article.setArticleContent(articleContent.getArticleContentHtml()); // 获取所属作品集列表数据 List portfolioArticleDTOList = articleMapper.selectPortfolioArticles(article.getIdArticle()); diff --git a/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java index 45d68cd..5fc016e 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/NotificationServiceImpl.java @@ -5,20 +5,20 @@ import com.rymcu.vertical.dto.ArticleDTO; import com.rymcu.vertical.dto.Author; import com.rymcu.vertical.dto.NotificationDTO; import com.rymcu.vertical.entity.Comment; +import com.rymcu.vertical.entity.Follow; import com.rymcu.vertical.entity.Notification; import com.rymcu.vertical.entity.User; import com.rymcu.vertical.mapper.NotificationMapper; -import com.rymcu.vertical.service.ArticleService; -import com.rymcu.vertical.service.CommentService; -import com.rymcu.vertical.service.NotificationService; -import com.rymcu.vertical.service.UserService; +import com.rymcu.vertical.service.*; import com.rymcu.vertical.util.BeanCopierUtil; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author ronger @@ -34,6 +34,10 @@ public class NotificationServiceImpl extends AbstractService imple private CommentService commentService; @Resource private UserService userService; + @Resource + private FollowService followService; + @Value("${resource.domain}") + private String domain; @Override public List findUnreadNotifications(Integer idUser) { @@ -58,6 +62,7 @@ public class NotificationServiceImpl extends AbstractService imple ArticleDTO article; Comment comment; User user; + Follow follow; switch (notification.getDataType()) { case "0": // 系统公告/帖子 @@ -69,6 +74,11 @@ public class NotificationServiceImpl extends AbstractService imple break; case "1": // 关注 + follow = followService.findById(notification.getDataId().toString()); + notificationDTO.setDataTitle("关注提醒"); + user = userService.findById(follow.getFollowerId().toString()); + notificationDTO.setDataUrl(getFollowLink(follow.getFollowingType(), user.getNickname())); + notificationDTO.setAuthor(genAuthor(user)); break; case "2": // 回帖 @@ -79,10 +89,25 @@ public class NotificationServiceImpl extends AbstractService imple user = userService.findById(comment.getCommentAuthorId().toString()); notificationDTO.setAuthor(genAuthor(user)); break; + default: + break; } return notificationDTO; } + private String getFollowLink(String followingType, String id) { + StringBuilder url = new StringBuilder(); + url.append(domain); + switch (followingType) { + case "0": + url = url.append("/user/").append(id); + break; + default: + url.append("/notification"); + } + return url.toString(); + } + private Author genAuthor(User user) { Author author = new Author(); author.setUserNickname(user.getNickname()); diff --git a/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java index 0631561..4e42d2b 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/PermissionServiceImpl.java @@ -17,10 +17,11 @@ import java.util.List; /** - * Created by CodeGenerator on 2018/05/29. + * + * @author CodeGenerator + * @date 2018/05/29 */ @Service -@Transactional public class PermissionServiceImpl extends AbstractService implements PermissionService { @Resource private PermissionMapper permissionMapper; @@ -29,7 +30,7 @@ public class PermissionServiceImpl extends AbstractService implement private RoleService roleService; @Override - public List selectMenuByUser(User sysUser) { + public List selectPermissionByUser(User sysUser) { List list = new ArrayList(); List roles = roleService.selectRoleByUser(sysUser); roles.forEach(role -> list.addAll(permissionMapper.selectMenuByIdRole(role.getIdRole()))); diff --git a/src/main/java/com/rymcu/vertical/service/impl/PortfolioServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/PortfolioServiceImpl.java index d5814bc..fdf75db 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/PortfolioServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/PortfolioServiceImpl.java @@ -62,7 +62,7 @@ public class PortfolioServiceImpl extends AbstractService implements @Override public Portfolio postPortfolio(Portfolio portfolio) throws BaseApiException { - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); if (portfolio.getIdPortfolio() == null || portfolio.getIdPortfolio() == 0) { portfolio.setPortfolioAuthorId(user.getIdUser()); portfolio.setCreatedTime(new Date()); @@ -78,7 +78,7 @@ public class PortfolioServiceImpl extends AbstractService implements @Override public Map findUnbindArticles(Integer page, Integer rows, String searchText, Integer idPortfolio) throws BaseApiException { Map map = new HashMap(1); - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); Portfolio portfolio = portfolioMapper.selectByPrimaryKey(idPortfolio); if (portfolio == null) { map.put("message", "该作品集不存在或已被删除!"); diff --git a/src/main/java/com/rymcu/vertical/service/impl/TagServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/TagServiceImpl.java index 72be192..6c1b3e3 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/TagServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/TagServiceImpl.java @@ -37,11 +37,11 @@ public class TagServiceImpl extends AbstractService implements TagService { private ArticleMapper articleMapper; @Override - @Transactional(rollbackFor = { UnsupportedEncodingException.class,BaseApiException.class }) + @Transactional(rollbackFor = {UnsupportedEncodingException.class, BaseApiException.class}) public Integer saveTagArticle(Article article) throws UnsupportedEncodingException, BaseApiException { - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); String articleTags = article.getArticleTags(); - if(StringUtils.isNotBlank(articleTags)){ + if (StringUtils.isNotBlank(articleTags)) { String[] tags = articleTags.split(","); List articleTagDTOList = articleMapper.selectTags(article.getIdArticle()); for (int i = 0; i < tags.length; i++) { @@ -50,10 +50,10 @@ public class TagServiceImpl extends AbstractService implements TagService { Tag tag = new Tag(); tag.setTagTitle(tags[i]); tag = tagMapper.selectOne(tag); - if(tag == null){ + if (tag == null) { tag = new Tag(); tag.setTagTitle(tags[i]); - tag.setTagUri(URLEncoder.encode(tag.getTagTitle(),"UTF-8")); + tag.setTagUri(URLEncoder.encode(tag.getTagTitle(), "UTF-8")); tag.setCreatedTime(new Date()); tag.setUpdatedTime(tag.getCreatedTime()); tag.setTagArticleCount(1); @@ -61,31 +61,34 @@ public class TagServiceImpl extends AbstractService implements TagService { addTagArticle = true; addUserTag = true; } else { - for(int m=0,n=articleTagDTOList.size()-1;m { articleMapper.deleteUnusedArticleTag(articleTagDTO.getIdArticleTag()); }); - if(addTagArticle){ - tagMapper.insertTagArticle(tag.getIdTag(),article.getIdArticle()); + if (addTagArticle) { + tagMapper.insertTagArticle(tag.getIdTag(), article.getIdArticle()); } - if(addUserTag){ - tagMapper.insertUserTag(tag.getIdTag(),user.getIdUser(),1); + if (addUserTag) { + tagMapper.insertUserTag(tag.getIdTag(), user.getIdUser(), 1); } } return 1; @@ -109,14 +112,14 @@ public class TagServiceImpl extends AbstractService implements TagService { Map map = new HashMap(1); if (tag.getIdTag() == null) { if (StringUtils.isBlank(tag.getTagTitle())) { - map.put("message","标签名不能为空!"); + map.put("message", "标签名不能为空!"); return map; } else { Condition tagCondition = new Condition(Tag.class); tagCondition.createCriteria().andCondition("tag_title =", tag.getTagTitle()); List tags = tagMapper.selectByCondition(tagCondition); if (!tags.isEmpty()) { - map.put("message","标签 '" + tag.getTagTitle() + "' 已存在!"); + map.put("message", "标签 '" + tag.getTagTitle() + "' 已存在!"); return map; } } @@ -132,10 +135,10 @@ public class TagServiceImpl extends AbstractService implements TagService { result = tagMapper.insertSelective(newTag); } else { tag.setUpdatedTime(new Date()); - result = tagMapper.update(tag.getIdTag(),tag.getTagUri(),tag.getTagIconPath(),tag.getTagStatus(),tag.getTagDescription(),tag.getTagReservation()); + result = tagMapper.update(tag.getIdTag(), tag.getTagUri(), tag.getTagIconPath(), tag.getTagStatus(), tag.getTagDescription(), tag.getTagReservation()); } if (result == 0) { - map.put("message","操作失败!"); + map.put("message", "操作失败!"); } else { map.put("tag", tag); } diff --git a/src/main/java/com/rymcu/vertical/service/impl/TopicServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/TopicServiceImpl.java index e875202..64af131 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/TopicServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/TopicServiceImpl.java @@ -37,23 +37,10 @@ public class TopicServiceImpl extends AbstractService implements TopicSer } @Override - public Map findTopicByTopicUri(String topicUri, Integer page, Integer rows) { - Map map = new HashMap(2); - TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri); - if (topic == null) { - return map; - } - PageHelper.startPage(page, rows); - List list = topicMapper.selectTopicTag(topic.getIdTopic()); - PageInfo pageInfo = new PageInfo(list); - topic.setTags(pageInfo.getList()); - map.put("topic", topic); - Map pagination = new HashMap(3); - pagination.put("pageSize",pageInfo.getPageSize()); - pagination.put("total",pageInfo.getTotal()); - pagination.put("currentPage",pageInfo.getPageNum()); - map.put("pagination", pagination); - return map; + public Topic findTopicByTopicUri(String topicUri) { + Topic searchTopic = new Topic(); + searchTopic.setTopicUri(topicUri); + return topicMapper.selectOne(searchTopic); } @Override @@ -82,6 +69,7 @@ public class TopicServiceImpl extends AbstractService implements TopicSer newTopic.setTopicStatus(topic.getTopicStatus()); newTopic.setTopicSort(topic.getTopicSort()); newTopic.setTopicDescription(topic.getTopicDescription()); + newTopic.setTopicDescriptionHtml(topic.getTopicDescriptionHtml()); newTopic.setCreatedTime(new Date()); newTopic.setUpdatedTime(topic.getCreatedTime()); result = topicMapper.insertSelective(newTopic); @@ -89,7 +77,7 @@ public class TopicServiceImpl extends AbstractService implements TopicSer topic.setCreatedTime(new Date()); result = topicMapper.update(topic.getIdTopic(),topic.getTopicTitle(),topic.getTopicUri() ,topic.getTopicIconPath(),topic.getTopicNva(),topic.getTopicStatus() - ,topic.getTopicSort(),topic.getTopicDescription()); + ,topic.getTopicSort(),topic.getTopicDescription(),topic.getTopicDescriptionHtml()); } if (result == 0) { map.put("message","操作失败!"); @@ -132,4 +120,23 @@ public class TopicServiceImpl extends AbstractService implements TopicSer } return map; } + + @Override + public Map findTagsByTopicUri(String topicUri, Integer page, Integer rows) { + Map map = new HashMap(2); + TopicDTO topic = topicMapper.selectTopicByTopicUri(topicUri); + if (topic == null) { + return map; + } + PageHelper.startPage(page, rows); + List list = topicMapper.selectTopicTag(topic.getIdTopic()); + PageInfo pageInfo = new PageInfo(list); + map.put("tags", pageInfo.getList()); + Map pagination = new HashMap(3); + pagination.put("pageSize",pageInfo.getPageSize()); + pagination.put("total",pageInfo.getTotal()); + pagination.put("currentPage",pageInfo.getPageNum()); + map.put("pagination", pagination); + return map; + } } diff --git a/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java index dc8ef02..136c58a 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/UserServiceImpl.java @@ -100,8 +100,7 @@ public class UserServiceImpl extends AbstractService implements UserServic user = userMapper.selectOne(user); if(user != null){ if(Utils.comparePwd(password, user.getPassword())){ - user.setLastLoginTime(new Date()); - userMapper.updateByPrimaryKeySelective(user); + userMapper.updateLastLoginTime(user.getIdUser()); TokenUser tokenUser = new TokenUser(); BeanCopierUtil.copy(user, tokenUser); tokenUser.setToken(tokenManager.createToken(account)); @@ -183,6 +182,7 @@ public class UserServiceImpl extends AbstractService implements UserServic if (StringUtils.isNotBlank(user.getAvatarType()) && avatarSvgType.equals(user.getAvatarType())) { String avatarUrl = UploadController.uploadBase64File(user.getAvatarUrl(), 0); user.setAvatarUrl(avatarUrl); + user.setAvatarType("0"); } Integer result = userMapper.updateUserInfo(user.getIdUser(), user.getNickname(), user.getAvatarType(),user.getAvatarUrl(), user.getEmail(),user.getPhone(),user.getSignature(), user.getSex()); diff --git a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java index 262c558..3e72334 100644 --- a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java +++ b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java @@ -80,6 +80,7 @@ public class BaiDuUtils { } public static void main(String[] args){ - sendUpdateSEOData("https://rymcu.com"); +// sendUpdateSEOData("https://rymcu.com"); + sendSEOData("https://rymcu.com/article/98"); } } diff --git a/src/main/java/com/rymcu/vertical/util/UserUtils.java b/src/main/java/com/rymcu/vertical/util/UserUtils.java index 0edbd09..502b6b0 100644 --- a/src/main/java/com/rymcu/vertical/util/UserUtils.java +++ b/src/main/java/com/rymcu/vertical/util/UserUtils.java @@ -25,7 +25,7 @@ public class UserUtils { * 通过token获取当前用户的信息 * @return */ - public static User getWxCurrentUser() throws BaseApiException { + public static User getCurrentUserByToken() throws BaseApiException { String authHeader = ContextHolderUtils.getRequest().getHeader(JwtConstants.AUTHORIZATION); if (authHeader == null) { return null; diff --git a/src/main/java/com/rymcu/vertical/web/api/admin/AdminController.java b/src/main/java/com/rymcu/vertical/web/api/admin/AdminController.java index 643dc9b..d2ca280 100644 --- a/src/main/java/com/rymcu/vertical/web/api/admin/AdminController.java +++ b/src/main/java/com/rymcu/vertical/web/api/admin/AdminController.java @@ -109,11 +109,20 @@ public class AdminController { } @GetMapping("/topic/{topicUri}") - public GlobalResult topic(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows,@PathVariable String topicUri){ + public GlobalResult topic(@PathVariable String topicUri){ if (StringUtils.isBlank(topicUri)) { return GlobalResultGenerator.genErrorResult("数据异常!"); } - Map map = topicService.findTopicByTopicUri(topicUri,page,rows); + Topic topic = topicService.findTopicByTopicUri(topicUri); + return GlobalResultGenerator.genSuccessResult(topic); + } + + @GetMapping("/topic/{topicUri}/tags") + public GlobalResult topicTags(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows,@PathVariable String topicUri){ + if (StringUtils.isBlank(topicUri)) { + return GlobalResultGenerator.genErrorResult("数据异常!"); + } + Map map = topicService.findTagsByTopicUri(topicUri,page,rows); return GlobalResultGenerator.genSuccessResult(map); } diff --git a/src/main/java/com/rymcu/vertical/web/api/article/ArticleController.java b/src/main/java/com/rymcu/vertical/web/api/article/ArticleController.java index 13aab2c..1bf5b85 100644 --- a/src/main/java/com/rymcu/vertical/web/api/article/ArticleController.java +++ b/src/main/java/com/rymcu/vertical/web/api/article/ArticleController.java @@ -6,6 +6,7 @@ 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.CommentDTO; +import com.rymcu.vertical.entity.Article; import com.rymcu.vertical.service.ArticleService; import com.rymcu.vertical.service.CommentService; import com.rymcu.vertical.util.Utils; @@ -80,4 +81,10 @@ public class ArticleController { return GlobalResultGenerator.genSuccessResult(map); } + @PostMapping("/{id}/update-tags") + public GlobalResult updateTags(@PathVariable Integer id, @RequestBody Article article) throws BaseApiException, UnsupportedEncodingException { + Map map = articleService.updateTags(id, article.getArticleTags()); + return GlobalResultGenerator.genSuccessResult(map); + } + } diff --git a/src/main/java/com/rymcu/vertical/web/api/common/UploadController.java b/src/main/java/com/rymcu/vertical/web/api/common/UploadController.java index f8f9ddf..7c8348e 100644 --- a/src/main/java/com/rymcu/vertical/web/api/common/UploadController.java +++ b/src/main/java/com/rymcu/vertical/web/api/common/UploadController.java @@ -25,6 +25,7 @@ import java.util.Set; /** * 文件上传控制器 + * * @author ronger */ @RestController @@ -36,22 +37,22 @@ public class UploadController { public static final String ctxHeadPicPath = "/usr/local/src/nebula/static"; @PostMapping("/file") - public GlobalResult uploadPicture(@RequestParam(value = "file", required = false) MultipartFile multipartFile,@RequestParam(defaultValue = "1")Integer type, HttpServletRequest request){ + public GlobalResult uploadPicture(@RequestParam(value = "file", required = false) MultipartFile multipartFile, @RequestParam(defaultValue = "1") Integer type, HttpServletRequest request) { if (multipartFile == null) { return GlobalResultGenerator.genErrorResult("请选择要上传的文件"); } String typePath = getTypePath(type); //图片存储路径 - String dir = ctxHeadPicPath+"/"+typePath; + String dir = ctxHeadPicPath + "/" + typePath; File file = new File(dir); if (!file.exists()) { file.mkdirs();// 创建文件根目录 } - String localPath = Utils.getProperty("resource.file-path")+"/"+typePath+"/"; + String localPath = Utils.getProperty("resource.file-path") + "/" + typePath + "/"; String orgName = multipartFile.getOriginalFilename(); - String fileName = System.currentTimeMillis()+"."+ FileUtils.getExtend(orgName).toLowerCase(); + String fileName = System.currentTimeMillis() + "." + FileUtils.getExtend(orgName).toLowerCase(); String savePath = file.getPath() + File.separator + fileName; @@ -59,7 +60,7 @@ public class UploadController { File saveFile = new File(savePath); try { FileCopyUtils.copy(multipartFile.getBytes(), saveFile); - data.put("url", localPath+fileName); + data.put("url", localPath + fileName); } catch (IOException e) { data.put("message", "上传失败!"); } @@ -68,43 +69,43 @@ public class UploadController { } @PostMapping("/file/batch") - public GlobalResult batchFileUpload(@RequestParam(value = "file[]", required = false)MultipartFile[] multipartFiles,@RequestParam(defaultValue = "1")Integer type,HttpServletRequest request){ + public GlobalResult batchFileUpload(@RequestParam(value = "file[]", required = false) MultipartFile[] multipartFiles, @RequestParam(defaultValue = "1") Integer type, HttpServletRequest request) { String typePath = getTypePath(type); //图片存储路径 - String dir = ctxHeadPicPath+"/"+typePath; + String dir = ctxHeadPicPath + "/" + typePath; File file = new File(dir); if (!file.exists()) { file.mkdirs();// 创建文件根目录 } - String localPath = Utils.getProperty("resource.file-path")+"/"+typePath+"/"; + String localPath = Utils.getProperty("resource.file-path") + "/" + typePath + "/"; Map succMap = new HashMap(10); Set errFiles = new HashSet(); - for(int i=0,len=multipartFiles.length;i list = notificationService.findNotifications(user.getIdUser()); PageInfo pageInfo = new PageInfo(list); @@ -40,7 +40,7 @@ public class NotificationController { @GetMapping("/unread") public GlobalResult unreadNotification(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) throws BaseApiException { - User user = UserUtils.getWxCurrentUser(); + User user = UserUtils.getCurrentUserByToken(); PageHelper.startPage(page, rows); List list = notificationService.findUnreadNotifications(user.getIdUser()); PageInfo pageInfo = new PageInfo(list); diff --git a/src/main/java/com/rymcu/vertical/web/api/user/UserController.java b/src/main/java/com/rymcu/vertical/web/api/user/UserController.java index 10f218c..ba2f040 100644 --- a/src/main/java/com/rymcu/vertical/web/api/user/UserController.java +++ b/src/main/java/com/rymcu/vertical/web/api/user/UserController.java @@ -4,6 +4,7 @@ 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.core.service.log.annotation.VisitLogger; import com.rymcu.vertical.dto.ArticleDTO; import com.rymcu.vertical.dto.PortfolioDTO; import com.rymcu.vertical.dto.UserDTO; @@ -33,6 +34,7 @@ public class UserController { private PortfolioService portfolioService; @GetMapping("/{nickname}") + @VisitLogger public GlobalResult detail(@PathVariable String nickname){ UserDTO userDTO = userService.findUserDTOByNickname(nickname); return GlobalResultGenerator.genSuccessResult(userDTO); diff --git a/src/main/java/mapper/ArticleMapper.xml b/src/main/java/mapper/ArticleMapper.xml index 3aac306..971037e 100644 --- a/src/main/java/mapper/ArticleMapper.xml +++ b/src/main/java/mapper/ArticleMapper.xml @@ -71,14 +71,26 @@ update vertical_article set article_view_count = #{articleViewCount} where id = #{id} + + update vertical_article set article_tags = #{tags} where id = #{idArticle} + delete from vertical_tag_article where id_article = #{id} delete from vertical_tag_article where id = #{idArticleTag} + + delete from vertical_portfolio_article where id_vertical_article = #{id} + select vp.portfolio_title,vp.portfolio_head_img_url,vpa.id_vertical_portfolio,vpa.id_vertical_article from vertical_portfolio vp join vertical_portfolio_article vpa on vp.id = vpa.id_vertical_portfolio where vpa.id_vertical_article = #{idArticle} + \ No newline at end of file diff --git a/src/main/java/mapper/DashboardMapper.xml b/src/main/java/mapper/DashboardMapper.xml index 50a8ef2..a777165 100644 --- a/src/main/java/mapper/DashboardMapper.xml +++ b/src/main/java/mapper/DashboardMapper.xml @@ -9,26 +9,23 @@ select count(*) from vertical_user select * from vertical_tag vt where not exists(select * from vertical_topic_tag vtt where vtt.id_topic = #{idTopic} and vtt.id_tag = vt.id) - and vt.tag_title = #{tagTitle} + and LOCATE(#{tagTitle}, vt.tag_title) > 0 order by vt.created_time desc diff --git a/src/main/java/mapper/UserMapper.xml b/src/main/java/mapper/UserMapper.xml index f134db4..2874d2c 100644 --- a/src/main/java/mapper/UserMapper.xml +++ b/src/main/java/mapper/UserMapper.xml @@ -65,6 +65,9 @@ where id = #{idUser} + + update vertical_user set last_login_time = sysdate() where id = #{idUser} +