添加CMS的栏目权限

This commit is contained in:
thinkgem
2023-04-07 19:17:17 +08:00
parent 1113198a9f
commit 302c518829
5 changed files with 22 additions and 17 deletions

View File

@@ -60,7 +60,7 @@ import java.util.Date;
@Column(name = "site_code"),
@Column(name = "site_name"),
})
}, orderBy = "a.update_date DESC"
}, orderBy = "a.update_date DESC", extWhereKeys = "dsfCategory"
)
public class Article extends DataEntity<Article> {

View File

@@ -4,12 +4,6 @@
*/
package com.jeesite.modules.cms.entity;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.entity.Extend;
@@ -20,6 +14,10 @@ import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.cms.utils.CmsUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;
/**
* 栏目表Entity
* @author 长春叭哥、ThinkGem
@@ -45,7 +43,7 @@ import com.jeesite.modules.cms.utils.CmsUtils;
on = "s.site_code = a.site_code", columns = {
@Column(name = "site_name"),
})
}, orderBy = "a.tree_sorts, a.category_code"
}, orderBy = "a.tree_sorts, a.category_code", extWhereKeys = "dsfCategory"
)
public class Category extends TreeEntity<Category> {

View File

@@ -71,8 +71,9 @@ public class ArticleService extends CrudService<ArticleDao, Article> {
* 添加数据权限
*/
@Override
public void addDataScopeFilter(Article entity) {
public void addDataScopeFilter(Article entity, String ctrlPermi) {
entity.sqlMap().getDataScope().addFilter("dsfCategory",
"Category", "a.category_code", "a.create_by", ctrlPermi);
}
/**

View File

@@ -4,13 +4,11 @@
*/
package com.jeesite.modules.cms.service;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.service.TreeService;
import com.jeesite.modules.cms.dao.CategoryDao;
import com.jeesite.modules.cms.entity.Category;
import com.jeesite.modules.cms.utils.CmsUtils;
import com.jeesite.modules.file.utils.FileUploadUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,8 +36,9 @@ public class CategoryService extends TreeService<CategoryDao, Category> {
* 添加数据权限
*/
@Override
public void addDataScopeFilter(Category entity) {
public void addDataScopeFilter(Category entity, String ctrlPermi) {
entity.sqlMap().getDataScope().addFilter("dsfCategory",
"Category", "a.category_code", "a.create_by", ctrlPermi);
}
/**
@@ -59,9 +58,6 @@ public class CategoryService extends TreeService<CategoryDao, Category> {
@Override
@Transactional
public void save(Category category) {
if (StringUtils.isNotBlank(category.getViewConfig())){
category.setViewConfig(StringEscapeUtils.unescapeHtml4(category.getViewConfig()));
}
super.save(category);
CmsUtils.removeCache("mainNavList_"+category.getSite().getId());
// 保存上传图片