更改为构造注入并完善方法注释
This commit is contained in:
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
|
||||
/**
|
||||
* 文章表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticleData;
|
||||
|
||||
/**
|
||||
* 文章详情表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticlePosid;
|
||||
|
||||
/**
|
||||
* 文章推荐位DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.ArticleTag;
|
||||
|
||||
/**
|
||||
* 文章与标签关系DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
|
||||
/**
|
||||
* 栏目表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Comment;
|
||||
|
||||
/**
|
||||
* 文章评论表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Report;
|
||||
|
||||
/**
|
||||
* 内容举报表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Site;
|
||||
|
||||
/**
|
||||
* 站点表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.Tag;
|
||||
|
||||
/**
|
||||
* 内容标签DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.jeesite.modules.cms.entity.VisitLog;
|
||||
|
||||
/**
|
||||
* 访问日志表DAO接口
|
||||
* @author 长春叭哥
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2018-10-15
|
||||
*/
|
||||
@MyBatisDao
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -280,7 +281,6 @@ public class Article extends DataEntity<Article> {
|
||||
|
||||
/**
|
||||
* 是否查询文章内容
|
||||
* @return
|
||||
*/
|
||||
public Boolean getIsQueryArticleData() {
|
||||
return isQueryArticleData;
|
||||
|
||||
@@ -4,19 +4,17 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jeesite.common.entity.BaseEntity;
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章评论表Entity
|
||||
@@ -45,7 +43,7 @@ public class Comment extends DataEntity<Comment> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Category category;// 分类编号
|
||||
private Category category; // 分类编号
|
||||
|
||||
private String categoryCode; // 栏目编码
|
||||
private String articleId; // 内容编号 (Article.id、Photo.id、Download.id)
|
||||
|
||||
@@ -187,7 +187,6 @@ public class Site extends DataEntity<Site> {
|
||||
|
||||
/**
|
||||
* 获得模板方案路径。如:/WEB-INF/views/modules/cmsfront/themes/jeesite
|
||||
* @return
|
||||
*/
|
||||
public String getSolutionPath() {
|
||||
return TEMPLATE_BASE_DIRECTION + "/" + getTheme();
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -32,19 +32,24 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 文章表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 文章Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
@Autowired
|
||||
private ArticleDataDao articleDataDao;
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleDataDao articleDataDao;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public ArticleService(ArticleDataDao articleDataDao,
|
||||
ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleDataDao = articleDataDao;
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
private static final ExecutorService updateExpiredWeightThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
|
||||
@@ -52,8 +57,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param article
|
||||
* @return
|
||||
* @param article 主键
|
||||
*/
|
||||
@Override
|
||||
public Article get(Article article) {
|
||||
@@ -84,7 +88,6 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
* 查询分页数据
|
||||
* @param article 查询条件
|
||||
* @param article page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Article> findPage(Article article) {
|
||||
@@ -94,6 +97,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 通过编号获取内容标题
|
||||
* @param ids 主键,使用逗号分隔
|
||||
* @return new Object[]{栏目Id,内容Id,内容标题}
|
||||
*/
|
||||
public List<Object[]> findByIds(String ids) {
|
||||
@@ -111,7 +115,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 权重更新
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
* @author ThinkGem
|
||||
*/
|
||||
@Transactional
|
||||
@@ -127,7 +131,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -173,7 +177,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param article
|
||||
* @param article 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -210,7 +214,7 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param article
|
||||
* @param article 文章
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -10,24 +10,28 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 栏目表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 栏目Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class CategoryService extends TreeService<CategoryDao, Category> {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public CategoryService(ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
|
||||
@@ -23,8 +23,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param comment
|
||||
* @return
|
||||
* @param comment 主键
|
||||
*/
|
||||
@Override
|
||||
public Comment get(Comment comment) {
|
||||
@@ -35,7 +34,6 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
* 查询分页数据
|
||||
* @param comment 查询条件
|
||||
* @param comment page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Comment> findPage(Comment comment) {
|
||||
@@ -44,7 +42,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class CommentService extends CrudService<CommentDao, Comment> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param comment
|
||||
* @param comment 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FileTemplateService {
|
||||
|
||||
/**
|
||||
* 获取对应视图模板列表,兼容 Select 字典
|
||||
* @param prefix
|
||||
* @param prefix 路径前缀
|
||||
*/
|
||||
public List<DictData> getTemplateContentDict(String prefix) throws IOException {
|
||||
List<DictData> listSite = ListUtils.newArrayList();
|
||||
|
||||
@@ -23,8 +23,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param report
|
||||
* @return
|
||||
* @param report 主键
|
||||
*/
|
||||
@Override
|
||||
public Report get(Report report) {
|
||||
@@ -35,7 +34,6 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
* 查询分页数据
|
||||
* @param report 查询条件
|
||||
* @param report page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Report> findPage(Report report) {
|
||||
@@ -44,7 +42,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class ReportService extends CrudService<ReportDao, Report> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param report
|
||||
* @param report 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -12,26 +12,30 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 站点表Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2023-4-10
|
||||
* 站点Service
|
||||
* @author ThinkGem
|
||||
* @version 2025-10-12
|
||||
*/
|
||||
@Service
|
||||
public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
@Autowired(required = false)
|
||||
private ArticleIndexService articleIndexService;
|
||||
@Autowired(required = false)
|
||||
private PageCacheService pageCacheService;
|
||||
private final ArticleIndexService articleIndexService;
|
||||
private final PageCacheService pageCacheService;
|
||||
|
||||
public SiteService(ObjectProvider<ArticleIndexService> articleIndexService,
|
||||
ObjectProvider<PageCacheService> pageCacheService) {
|
||||
this.articleIndexService = articleIndexService.getIfAvailable();
|
||||
this.pageCacheService = pageCacheService.getIfAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param site
|
||||
* @param site 主键
|
||||
*/
|
||||
@Override
|
||||
public Site get(Site site) {
|
||||
@@ -50,6 +54,7 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -62,7 +67,7 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param site
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -74,7 +79,7 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param site
|
||||
* @param site 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -85,18 +90,6 @@ public class SiteService extends CrudService<SiteDao, Site> {
|
||||
clearCache(site);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 删除站点
|
||||
// * @param site
|
||||
// * @param isRe
|
||||
// */
|
||||
// @Transactional
|
||||
// public void delete(Site site, Boolean isRe) {
|
||||
// site.setStatus(isRe != null && isRe ? Site.STATUS_NORMAL : Site.STATUS_DELETE);
|
||||
// super.delete(site);
|
||||
// CmsUtils.removeCache("siteList");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 清理站点缓存
|
||||
*/
|
||||
|
||||
@@ -22,8 +22,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param tag
|
||||
* @return
|
||||
* @param tag 主键
|
||||
*/
|
||||
@Override
|
||||
public Tag get(Tag tag) {
|
||||
@@ -34,7 +33,6 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
* 查询分页数据
|
||||
* @param tag 查询条件
|
||||
* @param tag page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<Tag> findPage(Tag tag) {
|
||||
@@ -43,7 +41,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -53,7 +51,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -63,7 +61,7 @@ public class TagService extends CrudService<TagDao, Tag> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param tag
|
||||
* @param tag 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -23,8 +23,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param visitLog
|
||||
* @return
|
||||
* @param visitLog 主键
|
||||
*/
|
||||
@Override
|
||||
public VisitLog get(VisitLog visitLog) {
|
||||
@@ -35,7 +34,6 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
* 查询分页数据
|
||||
* @param visitLog 查询条件
|
||||
* @param visitLog page 分页对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<VisitLog> findPage(VisitLog visitLog) {
|
||||
@@ -44,7 +42,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -58,7 +56,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -68,7 +66,7 @@ public class VisitLogService extends CrudService<VisitLogDao, VisitLog> {
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param visitLog
|
||||
* @param visitLog 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
|
||||
@@ -24,7 +24,7 @@ public class FileTemplateUtils {
|
||||
|
||||
/**
|
||||
* 获取模版文件
|
||||
* @param fileName
|
||||
* @param fileName 模块名称
|
||||
*/
|
||||
public static FileTemplate getFileTemplateByResource(String fileName) {
|
||||
if (!StringUtils.startsWith(fileName, "views/modules/cmsfront")) {
|
||||
|
||||
@@ -17,8 +17,9 @@ import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -27,8 +28,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,12 +40,15 @@ import java.util.List;
|
||||
@RequestMapping(value = "${adminPath}/cms/article")
|
||||
public class ArticleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
private final ArticleService articleService;
|
||||
private final CategoryService categoryService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
public ArticleController(ArticleService articleService, CategoryService categoryService, FileTemplateService fileTemplateService) {
|
||||
this.articleService = articleService;
|
||||
this.categoryService = categoryService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -58,7 +60,6 @@ public class ArticleController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:article:view")
|
||||
@RequestMapping(value = { "list", "" })
|
||||
@@ -73,7 +74,7 @@ public class ArticleController extends BaseController {
|
||||
Page<Article> page = new Page<>(1, 1, -1);
|
||||
article.setPage(page);
|
||||
page = articleService.findPage(article);
|
||||
if (page.getList().size() > 0) {
|
||||
if (!page.getList().isEmpty()) {
|
||||
article = page.getList().get(0);
|
||||
article.setArticleData(articleService.get(new ArticleData(article.getId())));
|
||||
}
|
||||
@@ -116,7 +117,6 @@ public class ArticleController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:article:view")
|
||||
@RequestMapping(value = "form")
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -42,11 +41,13 @@ import java.util.Map;
|
||||
@RequestMapping(value = "${adminPath}/cms/category")
|
||||
public class CategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
public CategoryController(CategoryService categoryService, FileTemplateService fileTemplateService) {
|
||||
this.categoryService = categoryService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -108,7 +109,6 @@ public class CategoryController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequiresPermissions("cms:category:view")
|
||||
@RequestMapping(value = "form")
|
||||
@@ -121,7 +121,7 @@ public class CategoryController extends BaseController {
|
||||
Category categoryChild = new Category();
|
||||
categoryChild.setParent(new Category(category.getParentCode()));
|
||||
List<Category> list = categoryService.findList(category);
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
category.setTreeSort(list.get(list.size() - 1).getTreeSort());
|
||||
if (category.getTreeSort() != null) {
|
||||
category.setTreeSort(category.getTreeSort() + 30);
|
||||
@@ -274,7 +274,6 @@ public class CategoryController extends BaseController {
|
||||
* 获取树结构数据
|
||||
* @param excludeCode 排除的Code
|
||||
* @param isShowCode 是否显示编码(true or 1:显示在左侧;2:显示在右侧;false or null:不显示)
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value = {"cms:category:view", "cms:article:view"}, logical = Logical.OR)
|
||||
@RequestMapping(value = "treeData")
|
||||
|
||||
@@ -19,19 +19,28 @@ import com.jeesite.common.web.BaseController;
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/cms")
|
||||
public class CmsIndexController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 管理内容页
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "index")
|
||||
public String index() {
|
||||
return "modules/cms/cmsIndex";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看内容页
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "view")
|
||||
public String view(Model model) {
|
||||
return "modules/cms/cmsView";
|
||||
}
|
||||
|
||||
/**
|
||||
* 空内容页面
|
||||
*/
|
||||
@RequiresPermissions("cms:view")
|
||||
@RequestMapping(value = "none")
|
||||
public String none() {
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Comment;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,12 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Comment;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
|
||||
/**
|
||||
* 文章评论表Controller
|
||||
* @author 长春叭哥、ThinkGem
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.service.CommentService;
|
||||
@RequestMapping(value = "${adminPath}/cms/comment")
|
||||
public class CommentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
|
||||
private final CommentService commentService;
|
||||
|
||||
public CommentController(CommentService commentService) {
|
||||
this.commentService = commentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@@ -120,5 +120,5 @@ public class CommentController extends BaseController {
|
||||
commentService.delete(comment);
|
||||
return renderResult(Global.TRUE, text("删除文章评论表成功!"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import com.jeesite.modules.cms.entity.FileTemplate;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -30,15 +29,24 @@ import java.util.Map;
|
||||
@RequestMapping(value = "${adminPath}/cms/template")
|
||||
public class FileTemplateController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
public FileTemplateController(FileTemplateService fileTemplateService) {
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版管理页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String index() {
|
||||
return "modules/cms/tplIndex";
|
||||
}
|
||||
|
||||
/**
|
||||
* 模版查看页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(String name, Model model) throws IOException {
|
||||
@@ -75,6 +83,9 @@ public class FileTemplateController extends BaseController {
|
||||
return renderResult(Global.FALSE, "模版文件不存在!");
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 模版帮助页
|
||||
*/
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = "help")
|
||||
public String help() {
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Report;
|
||||
import com.jeesite.modules.cms.service.ReportService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -17,12 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Report;
|
||||
import com.jeesite.modules.cms.service.ReportService;
|
||||
|
||||
/**
|
||||
* 内容举报表Controller
|
||||
* @author 长春叭哥、ThinkGem
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.service.ReportService;
|
||||
@RequestMapping(value = "${adminPath}/cms/report")
|
||||
public class ReportController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ReportService reportService;
|
||||
|
||||
private final ReportService reportService;
|
||||
|
||||
public ReportController(ReportService reportService) {
|
||||
this.reportService = reportService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@@ -120,5 +120,5 @@ public class ReportController extends BaseController {
|
||||
reportService.delete(report);
|
||||
return renderResult(Global.TRUE, text("删除内容举报表成功!"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -35,11 +34,13 @@ import java.io.IOException;
|
||||
@RequestMapping(value = "${adminPath}/cms/site")
|
||||
public class SiteController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SiteService siteService;
|
||||
private final SiteService siteService;
|
||||
private final FileTemplateService fileTemplateService;
|
||||
|
||||
@Autowired
|
||||
private FileTemplateService fileTemplateService;
|
||||
public SiteController(SiteService siteService, FileTemplateService fileTemplateService) {
|
||||
this.siteService = siteService;
|
||||
this.fileTemplateService = fileTemplateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
|
||||
@@ -16,13 +16,12 @@ import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.CommentService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.ValidCodeUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,12 +34,15 @@ import java.util.List;
|
||||
@RequestMapping(value = "${frontPath}")
|
||||
public class FrontController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
@Autowired
|
||||
private CommentService commentService;
|
||||
private final CategoryService categoryService;
|
||||
private final ArticleService articleService;
|
||||
private final CommentService commentService;
|
||||
|
||||
public FrontController(CategoryService categoryService, ArticleService articleService, CommentService commentService) {
|
||||
this.categoryService = categoryService;
|
||||
this.articleService = articleService;
|
||||
this.commentService = commentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主站首页
|
||||
@@ -75,7 +77,7 @@ public class FrontController extends BaseController {
|
||||
|
||||
// 否则显示子站第一个栏目
|
||||
List<Category> mainNavList = CmsUtils.getMainNavList(siteCode);
|
||||
if (mainNavList.size() > 0) {
|
||||
if (!mainNavList.isEmpty()) {
|
||||
String firstCategoryCode = CmsUtils.getMainNavList(siteCode).get(0).getId();
|
||||
return REDIRECT + frontPath + "/list-" + firstCategoryCode + ".html";
|
||||
}
|
||||
@@ -142,7 +144,7 @@ public class FrontController extends BaseController {
|
||||
if (Category.SHOW_MODES_CENTENT_LIST.equals(category.getShowModes()) || categoryList.size() <= 1) {
|
||||
|
||||
// 有子栏目并展现方式为2,则获取第一个子栏目;无子栏目,则获取同级分类列表。
|
||||
if (categoryList.size() > 0) {
|
||||
if (!categoryList.isEmpty()) {
|
||||
category = categoryList.get(0);
|
||||
}
|
||||
|
||||
@@ -231,15 +233,15 @@ public class FrontController extends BaseController {
|
||||
// 文章模型
|
||||
if ("article".equals(category.getModuleType())) {
|
||||
|
||||
// // 获取当前级别的栏目列表
|
||||
// List<Category> categoryList = Lists.newArrayList();
|
||||
//// if (category.getIsRoot()){
|
||||
//// categoryList.add(category);
|
||||
//// }else{
|
||||
//// categoryList = categoryService.findListByParentCode(category.getParentCode(), category.getSite().getId());
|
||||
// categoryList = CmsUtils.getCategoryList(category.getSite().getSiteCode(), category.getParentCode(), -1, null);
|
||||
//// }
|
||||
// model.addAttribute("categoryList", categoryList);
|
||||
/*// 获取当前级别的栏目列表
|
||||
List<Category> categoryList = ListUtils.newArrayList();
|
||||
// if (category.getIsRoot()){
|
||||
// categoryList.add(category);
|
||||
// }else{
|
||||
// categoryList = categoryService.findListByParentCode(category.getParentCode(), category.getSite().getId());
|
||||
categoryList = CmsUtils.getCategoryList(category.getSite().getSiteCode(), category.getParentCode(), -1, null);
|
||||
// }
|
||||
model.addAttribute("categoryList", categoryList);*/
|
||||
|
||||
// 获取文章
|
||||
Article article = null;
|
||||
@@ -254,7 +256,7 @@ public class FrontController extends BaseController {
|
||||
Article entity = new Article(category);
|
||||
entity.setPage(page);
|
||||
page = articleService.findPage(entity);
|
||||
if (page.getList().size() > 0) {
|
||||
if (!page.getList().isEmpty()) {
|
||||
article = page.getList().get(0);
|
||||
article.setArticleData(articleService.get(new ArticleData(article.getId())));
|
||||
}
|
||||
|
||||
@@ -4,16 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.cmsfront.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
@@ -22,6 +12,13 @@ import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.ArticleService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网站搜索Controller
|
||||
@@ -32,9 +29,12 @@ import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
@RequestMapping(value = "${frontPath}/search")
|
||||
public class FrontSearchController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
private final ArticleService articleService;
|
||||
|
||||
public FrontSearchController(ArticleService articleService) {
|
||||
this.articleService = articleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全站搜索
|
||||
* @param t 搜索类型(article、guestbook)
|
||||
|
||||
Reference in New Issue
Block a user