调整
This commit is contained in:
21
blog.sql
21
blog.sql
@@ -5,9 +5,9 @@ USE t_blog;
|
|||||||
CREATE TABLE `article`
|
CREATE TABLE `article`
|
||||||
(
|
(
|
||||||
`a_id` bigint(20) primary key auto_increment,
|
`a_id` bigint(20) primary key auto_increment,
|
||||||
`a_title` varchar(255) not null unique comment '文章标题',
|
`a_title` varchar(255) COLLATE utf8mb4_unicode_ci not null unique comment '文章标题',
|
||||||
`a_summary` varchar(255) not null comment '文章摘要',
|
`a_summary` varchar(255) COLLATE utf8mb4_unicode_ci not null comment '文章摘要',
|
||||||
`a_md_content` longtext not null comment '文章Markdown内容',
|
`a_md_content` longtext COLLATE utf8mb4_unicode_ci not null comment '文章Markdown内容',
|
||||||
`a_url` tinytext default null comment '转载文章的原文链接',
|
`a_url` tinytext default null comment '转载文章的原文链接',
|
||||||
`a_author_id` int not null comment '作者id',
|
`a_author_id` int not null comment '作者id',
|
||||||
`a_is_original` boolean default true comment '文章是否原创',
|
`a_is_original` boolean default true comment '文章是否原创',
|
||||||
@@ -35,13 +35,14 @@ CREATE TABLE `tag_category`
|
|||||||
`t_id` bigint(20) primary key auto_increment,
|
`t_id` bigint(20) primary key auto_increment,
|
||||||
`t_name` varchar(255) not null,
|
`t_name` varchar(255) not null,
|
||||||
`is_category` boolean not null default true,
|
`is_category` boolean not null default true,
|
||||||
|
`is_delete` boolean not null default false comment '该数据是否被删除'
|
||||||
) comment '标签和分类表';
|
) comment '标签和分类表';
|
||||||
|
|
||||||
CREATE TABLE `comment`
|
CREATE TABLE `comment`
|
||||||
(
|
(
|
||||||
`co_id` bigint(20) primary key auto_increment,
|
`co_id` bigint(20) primary key auto_increment,
|
||||||
`co_page_path` varchar(255) not null comment '评论/留言的页面',
|
`co_page_path` varchar(255) not null comment '评论/留言的页面',
|
||||||
`co_content` text not null comment '评论/留言内容',
|
`co_content` text COLLATE utf8mb4_unicode_ci not null comment '评论/留言内容',
|
||||||
`co_date` datetime not null comment '评论/留言的日期',
|
`co_date` datetime not null comment '评论/留言的日期',
|
||||||
`co_status` tinyint not null default 0 comment '评论的状态',
|
`co_status` tinyint not null default 0 comment '评论的状态',
|
||||||
`co_pid` bigint not null default -1 comment '评论/留言的父id',
|
`co_pid` bigint not null default -1 comment '评论/留言的父id',
|
||||||
@@ -51,16 +52,14 @@ CREATE TABLE `comment`
|
|||||||
) DEFAULT CHARSET = utf8mb4
|
) DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE utf8mb4_general_ci,comment '评论/留言表';
|
COLLATE utf8mb4_general_ci,comment '评论/留言表';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `links`
|
CREATE TABLE `links`
|
||||||
(
|
(
|
||||||
`l_id` bigint(20) primary key auto_increment,
|
`l_id` bigint(20) primary key auto_increment,
|
||||||
`l_name` varchar(255) not null comment '友站名称',
|
`l_name` varchar(255) COLLATE utf8mb4_unicode_ci not null comment '友站名称',
|
||||||
`l_is_open` boolean default true comment '是否公开',
|
`l_is_open` boolean default true comment '是否公开',
|
||||||
`l_url` varchar(255) not null comment '首页地址',
|
`l_url` varchar(255) not null comment '首页地址',
|
||||||
`l_icon_path` varchar(255) not null comment '友链的icon地址',
|
`l_icon_path` varchar(255) not null comment '友链的icon地址',
|
||||||
`l_desc` varchar(255) not null comment '友链的说明描述',
|
`l_desc` varchar(255) COLLATE utf8mb4_unicode_ci not null comment '友链的说明描述',
|
||||||
`is_delete` boolean not null default false comment '该数据是否被删除'
|
`is_delete` boolean not null default false comment '该数据是否被删除'
|
||||||
) comment '友站表';
|
) comment '友站表';
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ CREATE TABLE `visitor`
|
|||||||
CREATE TABLE `web_update`
|
CREATE TABLE `web_update`
|
||||||
(
|
(
|
||||||
`wu_id` int primary key auto_increment,
|
`wu_id` int primary key auto_increment,
|
||||||
`wu_info` varchar(255) not null comment '更新内容',
|
`wu_info` varchar(255) COLLATE utf8mb4_unicode_ci not null comment '更新内容',
|
||||||
`wu_time` datetime not null comment '更新时间',
|
`wu_time` datetime not null comment '更新时间',
|
||||||
`is_delete` boolean not null default false comment '该数据是否被删除'
|
`is_delete` boolean not null default false comment '该数据是否被删除'
|
||||||
) comment '更新内容表';
|
) comment '更新内容表';
|
||||||
@@ -88,9 +87,9 @@ CREATE TABLE `user`
|
|||||||
`u_pwd` varchar(40) not null comment '密码',
|
`u_pwd` varchar(40) not null comment '密码',
|
||||||
`u_email_status` boolean default false comment '邮箱验证状态',
|
`u_email_status` boolean default false comment '邮箱验证状态',
|
||||||
`u_avatar` varchar(255) default null comment '用户头像',
|
`u_avatar` varchar(255) default null comment '用户头像',
|
||||||
`u_desc` tinytext default null comment '用户的描述',
|
`u_desc` tinytext COLLATE utf8mb4_unicode_ci default null comment '用户的描述',
|
||||||
`u_recently_landed_time` datetime default null comment '最近的登录时间',
|
`u_recently_landed_time` datetime default null comment '最近的登录时间',
|
||||||
`u_display_name` varchar(30) default null comment '展示的昵称',
|
`u_display_name` varchar(30) COLLATE utf8mb4_unicode_ci default null comment '展示的昵称',
|
||||||
`u_role` varchar(40) not null default 'user' comment '权限组',
|
`u_role` varchar(40) not null default 'user' comment '权限组',
|
||||||
`status` tinyint(1) not null default 0 comment '账户状态',
|
`status` tinyint(1) not null default 0 comment '账户状态',
|
||||||
unique key `uni_user_id` (`u_id`),
|
unique key `uni_user_id` (`u_id`),
|
||||||
|
|||||||
@@ -45,12 +45,20 @@ public class CommentController {
|
|||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@GetMapping("/comments")
|
@GetMapping("/comments/{pagePath}/{pid}")
|
||||||
public Response commentsOfArticle(@RequestParam("pagePath") String pagePath,
|
public Response commentsOfArticle(@PathVariable("pagePath") String pagePath, @PathVariable(value = "pid") long pid,
|
||||||
@RequestParam(value = "pid", required = false, defaultValue = "-1") long pid,
|
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
return Response.success(commentService.retrievePageByPageAndPid(pagePath, pid, page, count));
|
String path = "";
|
||||||
|
if (pagePath.contains("article+")) {
|
||||||
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
|
} else {
|
||||||
|
path = pagePath;
|
||||||
|
}
|
||||||
|
if ("*".equals(pagePath)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
return Response.success(commentService.retrievePageByPageAndPid(path, pid, page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,18 +69,51 @@ public class CommentController {
|
|||||||
* @param page page
|
* @param page page
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
// FIXME:: 左斜线转义的异常
|
|
||||||
@GetMapping("/comment/pagePath/{pagePath}")
|
@GetMapping("/comment/pagePath/{pagePath}")
|
||||||
public Response retrievePage(@PathVariable("pagePath") String pagePath,
|
public Response retrievePage(@PathVariable("pagePath") String pagePath,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
return Response.success(commentService.retrievePage(pagePath, page, count));
|
String path = "";
|
||||||
|
if (pagePath.contains("article+")) {
|
||||||
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
|
} else {
|
||||||
|
path = pagePath;
|
||||||
|
}
|
||||||
|
if ("*".equals(pagePath)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
return Response.success(commentService.retrievePage(path, page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user/comment/pagePath/{pagePath}")
|
@GetMapping("/user/comment/pagePath/{pagePath}")
|
||||||
public Response userComment(@PathVariable("pagePath") String pagePath,
|
public Response userComment(@PathVariable("pagePath") String pagePath,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
return Response.success(commentService.retrievePageByAuthor(pagePath, page, count));
|
String path = "";
|
||||||
|
if (pagePath.contains("article+")) {
|
||||||
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
|
} else {
|
||||||
|
path = pagePath;
|
||||||
|
}
|
||||||
|
if ("*".equals(pagePath)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
return Response.success(commentService.retrievePageByAuthor(path, page, count));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/admin/comment/pagePath/{pagePath}")
|
||||||
|
public Response adminComment(@PathVariable("pagePath") String pagePath,
|
||||||
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
|
String path = "";
|
||||||
|
if (pagePath.contains("article+")) {
|
||||||
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
|
} else {
|
||||||
|
path = pagePath;
|
||||||
|
}
|
||||||
|
if ("*".equals(pagePath)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
return Response.success(commentService.retrievePageByPage(path, page, count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class ArticleServiceImpl implements ArticleService {
|
|||||||
|
|
||||||
//数据判断
|
//数据判断
|
||||||
if (reqBody.getTitle() != null && !reqBody.getTitle().replaceAll(" ", "").isEmpty()) {
|
if (reqBody.getTitle() != null && !reqBody.getTitle().replaceAll(" ", "").isEmpty()) {
|
||||||
if (articleMapper.existsByTitle(reqBody.getTitle())) {
|
if (!article.getTitle().equals(reqBody.getTitle()) && articleMapper.existsByTitle(reqBody.getTitle())) {
|
||||||
throw new MyException(ResponseEnum.ARTICLE_HAS_EXIST);
|
throw new MyException(ResponseEnum.ARTICLE_HAS_EXIST);
|
||||||
}
|
}
|
||||||
article.setTitle(reqBody.getTitle());
|
article.setTitle(reqBody.getTitle());
|
||||||
@@ -176,7 +176,7 @@ public class ArticleServiceImpl implements ArticleService {
|
|||||||
throw new MyException(ResponseEnum.PARAMETERS_ERROR);
|
throw new MyException(ResponseEnum.PARAMETERS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RegexUtil.urlMatch(reqBody.getUrl())) {
|
if (!reqBody.getType() && !RegexUtil.urlMatch(reqBody.getUrl())) {
|
||||||
throw new MyException(ResponseEnum.PARAMETERS_URL_ERROR);
|
throw new MyException(ResponseEnum.PARAMETERS_URL_ERROR);
|
||||||
}
|
}
|
||||||
article.setType(reqBody.getType());
|
article.setType(reqBody.getType());
|
||||||
@@ -278,7 +278,7 @@ public class ArticleServiceImpl implements ArticleService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PageData<ArticleModel> adminArticles(int count, int page) {
|
public PageData<ArticleModel> adminArticles(int count, int page) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count, "articleId desc");
|
||||||
List<Article> articleList = articleMapper.findAll();
|
List<Article> articleList = articleMapper.findAll();
|
||||||
PageData<ArticleModel> pageData = new PageData<ArticleModel>(new PageInfo<Article>(articleList));
|
PageData<ArticleModel> pageData = new PageData<ArticleModel>(new PageInfo<Article>(articleList));
|
||||||
List<ArticleModel> articleModelList = new ArrayList<>();
|
List<ArticleModel> articleModelList = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package cn.celess.blog.service.serviceimpl;
|
package cn.celess.blog.service.serviceimpl;
|
||||||
|
|
||||||
import cn.celess.blog.enmu.ResponseEnum;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
|
import cn.celess.blog.entity.Article;
|
||||||
import cn.celess.blog.entity.Category;
|
import cn.celess.blog.entity.Category;
|
||||||
|
import cn.celess.blog.entity.model.ArticleModel;
|
||||||
import cn.celess.blog.entity.model.CategoryModel;
|
import cn.celess.blog.entity.model.CategoryModel;
|
||||||
import cn.celess.blog.entity.model.PageData;
|
import cn.celess.blog.entity.model.PageData;
|
||||||
import cn.celess.blog.exception.MyException;
|
import cn.celess.blog.exception.MyException;
|
||||||
@@ -67,7 +69,21 @@ public class CategoryServiceImpl implements CategoryService {
|
|||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<Category> all = categoryMapper.findAll();
|
List<Category> all = categoryMapper.findAll();
|
||||||
List<CategoryModel> modelList = new ArrayList<>();
|
List<CategoryModel> modelList = new ArrayList<>();
|
||||||
all.forEach(e -> modelList.add(ModalTrans.category(e)));
|
all.forEach(e -> {
|
||||||
|
CategoryModel model = ModalTrans.category(e);
|
||||||
|
List<Article> allByCategoryId = articleMapper.findAllByCategoryId(e.getId());
|
||||||
|
List<ArticleModel> articleModelList = new ArrayList<>();
|
||||||
|
allByCategoryId.forEach(article -> {
|
||||||
|
ArticleModel articleModel = ModalTrans.article(article, true);
|
||||||
|
articleModel.setPreArticle(null);
|
||||||
|
articleModel.setNextArticle(null);
|
||||||
|
articleModel.setTags(null);
|
||||||
|
articleModelList.add(articleModel);
|
||||||
|
});
|
||||||
|
model.setArticles(articleModelList);
|
||||||
|
modelList.add(model);
|
||||||
|
});
|
||||||
|
|
||||||
return new PageData<CategoryModel>(new PageInfo<Category>(all), modelList);
|
return new PageData<CategoryModel>(new PageInfo<Category>(all), modelList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class CommentServiceImpl implements CommentService {
|
|||||||
@Override
|
@Override
|
||||||
public PageData<CommentModel> retrievePage(String pagePath, int page, int count) {
|
public PageData<CommentModel> retrievePage(String pagePath, int page, int count) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<Comment> list = commentMapper.findAllByPagePath(pagePath);
|
List<Comment> list = commentMapper.findAllByPagePathAndPid(pagePath, -1);
|
||||||
return pageTrans(list);
|
return pageTrans(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,23 +122,29 @@ public class CommentServiceImpl implements CommentService {
|
|||||||
@Override
|
@Override
|
||||||
public PageData<CommentModel> retrievePageByPageAndPid(String pagePath, long pid, int page, int count) {
|
public PageData<CommentModel> retrievePageByPageAndPid(String pagePath, long pid, int page, int count) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<Comment> list = commentMapper.findAllByPagePathAndPid(pagePath, pid);
|
List<Comment> list = commentMapper.findAllByPagePath(pagePath);
|
||||||
return pageTrans(list);
|
return pageTrans(list, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<CommentModel> retrievePageByPage(String pagePath, int page, int count) {
|
public PageData<CommentModel> retrievePageByPage(String pagePath, int page, int count) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<Comment> list = commentMapper.findAllByPagePathAndPid(pagePath, -1);
|
List<Comment> list = commentMapper.findAllByPagePath(pagePath);
|
||||||
return pageTrans(list);
|
return pageTrans(list, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PageData<CommentModel> pageTrans(List<Comment> commentList) {
|
private PageData<CommentModel> pageTrans(List<Comment> commentList) {
|
||||||
|
return pageTrans(commentList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PageData<CommentModel> pageTrans(List<Comment> commentList, boolean noResponseList) {
|
||||||
PageInfo<Comment> p = PageInfo.of(commentList);
|
PageInfo<Comment> p = PageInfo.of(commentList);
|
||||||
List<CommentModel> modelList = new ArrayList<>();
|
List<CommentModel> modelList = new ArrayList<>();
|
||||||
commentList.forEach(l -> {
|
commentList.forEach(l -> {
|
||||||
CommentModel model = ModalTrans.comment(l);
|
CommentModel model = ModalTrans.comment(l);
|
||||||
|
if (!noResponseList) {
|
||||||
model.setRespComment(this.retrievePageByPid(model.getId()));
|
model.setRespComment(this.retrievePageByPid(model.getId()));
|
||||||
|
}
|
||||||
modelList.add(model);
|
modelList.add(model);
|
||||||
});
|
});
|
||||||
return new PageData<CommentModel>(p, modelList);
|
return new PageData<CommentModel>(p, modelList);
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
redisUtil.setEx(loginReq.getEmail() + "-passwordWrongTime", count + "", 2, TimeUnit.HOURS);
|
redisUtil.setEx(loginReq.getEmail() + "-passwordWrongTime", count + "", 2, TimeUnit.HOURS);
|
||||||
throw new MyException(ResponseEnum.LOGIN_FAILURE);
|
throw new MyException(ResponseEnum.LOGIN_FAILURE);
|
||||||
}
|
}
|
||||||
UserModel trans = ModalTrans.user(user);
|
UserModel trans = ModalTrans.userFullInfo(user);
|
||||||
trans.setToken(token);
|
trans.setToken(token);
|
||||||
return trans;
|
return trans;
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
userMapper.updateInfo(desc, displayName, user.getId());
|
userMapper.updateInfo(desc, displayName, user.getId());
|
||||||
redisUserUtil.set(user);
|
redisUserUtil.set(user);
|
||||||
return ModalTrans.user(user);
|
return ModalTrans.userFullInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -192,7 +192,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
@Override
|
@Override
|
||||||
public UserModel getUserInfoBySession() {
|
public UserModel getUserInfoBySession() {
|
||||||
User user = redisUserUtil.get();
|
User user = redisUserUtil.get();
|
||||||
return ModalTrans.user(user);
|
return ModalTrans.userFullInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -346,7 +346,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
List<User> all = userMapper.findAll();
|
List<User> all = userMapper.findAll();
|
||||||
List<UserModel> modelList = new ArrayList<>();
|
List<UserModel> modelList = new ArrayList<>();
|
||||||
all.forEach(user -> modelList.add(ModalTrans.user(user)));
|
all.forEach(user -> modelList.add(ModalTrans.userFullInfo(user)));
|
||||||
return new PageData<UserModel>(PageInfo.of(all), modelList);
|
return new PageData<UserModel>(PageInfo.of(all), modelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
redisUserUtil.set(user);
|
redisUserUtil.set(user);
|
||||||
}
|
}
|
||||||
logger.info("修改了用户 [id={}] 的用户的资料", userReq.getId());
|
logger.info("修改了用户 [id={}] 的用户的资料", userReq.getId());
|
||||||
return ModalTrans.user(user);
|
return ModalTrans.userFullInfo(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -416,6 +416,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
throw new MyException(ResponseEnum.PWD_NOT_SAME);
|
throw new MyException(ResponseEnum.PWD_NOT_SAME);
|
||||||
}
|
}
|
||||||
userMapper.updatePwd(user.getEmail(), MD5Util.getMD5(newPwd));
|
userMapper.updatePwd(user.getEmail(), MD5Util.getMD5(newPwd));
|
||||||
return ModalTrans.user(userMapper.findByEmail(user.getEmail()));
|
return ModalTrans.userFullInfo(userMapper.findByEmail(user.getEmail()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public class ModalTrans {
|
|||||||
return article1;
|
return article1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UserModel userFullInfo(User user) {
|
||||||
public static UserModel user(User user) {
|
|
||||||
if (user == null || user.getId() == -1) {
|
if (user == null || user.getId() == -1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -50,13 +49,21 @@ public class ModalTrans {
|
|||||||
userModel.setAvatarImgUrl(user.getAvatarImgUrl() == null || user.getAvatarImgUrl().length() == 0 ?
|
userModel.setAvatarImgUrl(user.getAvatarImgUrl() == null || user.getAvatarImgUrl().length() == 0 ?
|
||||||
null :
|
null :
|
||||||
"http://cdn.celess.cn/" + user.getAvatarImgUrl());
|
"http://cdn.celess.cn/" + user.getAvatarImgUrl());
|
||||||
userModel.setRole(null);
|
|
||||||
userModel.setEmailStatus(null);
|
|
||||||
userModel.setDisplayName(user.getDisplayName() == null ? user.getEmail() : user.getDisplayName());
|
userModel.setDisplayName(user.getDisplayName() == null ? user.getEmail() : user.getDisplayName());
|
||||||
userModel.setRecentlyLandedDate(DateFormatUtil.get(user.getRecentlyLandedDate()));
|
userModel.setRecentlyLandedDate(DateFormatUtil.get(user.getRecentlyLandedDate()));
|
||||||
return userModel;
|
return userModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UserModel user(User user) {
|
||||||
|
UserModel model = userFullInfo(user);
|
||||||
|
if (model == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
model.setRole(null);
|
||||||
|
model.setEmailStatus(null);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
public static CategoryModel category(Category category) {
|
public static CategoryModel category(Category category) {
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -86,21 +86,29 @@
|
|||||||
<select id="findAllByPagePath" resultMap="commentViewResultMap">
|
<select id="findAllByPagePath" resultMap="commentViewResultMap">
|
||||||
select *
|
select *
|
||||||
from commentView
|
from commentView
|
||||||
|
<if test="pagePath!= null ">
|
||||||
where pagePath = #{pagePath}
|
where pagePath = #{pagePath}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllByPagePathAndFromUser" resultMap="commentViewResultMap">
|
<select id="findAllByPagePathAndFromUser" resultMap="commentViewResultMap">
|
||||||
select *
|
select *
|
||||||
from commentView
|
from commentView
|
||||||
where pagePath = #{pagePath}
|
where
|
||||||
and fromAuthorId = #{userId}
|
<if test="pagePath!= null ">
|
||||||
|
pagePath = #{pagePath} and
|
||||||
|
</if>
|
||||||
|
fromAuthorId = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllByPagePathAndPid" resultMap="commentViewResultMap">
|
<select id="findAllByPagePathAndPid" resultMap="commentViewResultMap">
|
||||||
select *
|
select *
|
||||||
from commentView
|
from commentView
|
||||||
where pagePath = #{pagePath}
|
where
|
||||||
and pid = #{pid}
|
<if test="pagePath!= null ">
|
||||||
|
pagePath = #{pagePath} and
|
||||||
|
</if>
|
||||||
|
pid = #{pid}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countByPagePath" resultType="java.lang.Long">
|
<select id="countByPagePath" resultType="java.lang.Long">
|
||||||
@@ -108,6 +116,7 @@
|
|||||||
from commentView
|
from commentView
|
||||||
where pagePath = #{pagePath}
|
where pagePath = #{pagePath}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getLastestComment" resultMap="commentViewResultMap">
|
<select id="getLastestComment" resultMap="commentViewResultMap">
|
||||||
select *
|
select *
|
||||||
from commentView
|
from commentView
|
||||||
@@ -117,7 +126,7 @@
|
|||||||
|
|
||||||
<select id="count" resultType="long">
|
<select id="count" resultType="long">
|
||||||
select count(*)
|
select count(*)
|
||||||
from article
|
from comment
|
||||||
where is_delete = false;
|
where is_delete = false;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,6 @@
|
|||||||
select *
|
select *
|
||||||
from articleView
|
from articleView
|
||||||
where isDelete = false
|
where isDelete = false
|
||||||
order by articleId desc
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user