From bdc336f8f934a8150b94dc1c66869886a6e50b93 Mon Sep 17 00:00:00 2001 From: libao <15050590816@163.com> Date: Tue, 14 May 2024 14:44:13 +0800 Subject: [PATCH] =?UTF-8?q?2024.5.14=20=E7=BA=AA=E5=BF=B5=E9=A6=86?= =?UTF-8?q?=E6=96=B0=E5=90=8E=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/system/DoorController.java | 2 +- .../framework/config/SecurityConfig.java | 10 ++--- .../com/ruoyi/system/domain/CmsCategory.java | 3 +- .../com/ruoyi/system/domain/CmsMaterial.java | 11 +++++ .../service/impl/CmsArticleServiceImpl.java | 18 ++++---- .../mapper/system/CmsCategoryMapper.xml | 26 ++++++++---- .../mapper/system/CmsMaterialMapper.xml | 42 ++++++++++++------- 7 files changed, 73 insertions(+), 39 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java index 6e1bf757..c7f58c21 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/DoorController.java @@ -89,7 +89,7 @@ public class DoorController extends BaseController { @ApiOperation("照片查询") @PostMapping("/MaterialList") public TableDataInfo list() { - startPage(); +// startPage(); List list = materialMapper.selectCmsMaterialList(new CmsMaterial()); return getDataTable(list); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 21258532..c8c51df2 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -22,7 +22,7 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; /** * spring security配置 - * + * * @author ruoyi */ @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -33,7 +33,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private UserDetailsService userDetailsService; - + /** * 认证失败处理类 */ @@ -51,7 +51,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter */ @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; - + /** * 跨域过滤器 */ @@ -111,9 +111,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter // 过滤请求 .authorizeRequests() // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/register", "/captchaImage").permitAll() + .antMatchers("/login", "/register", "/captchaImage","/door/**").permitAll() // 静态资源,可匿名访问 - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/door/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsCategory.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsCategory.java index b7478155..3fd2a848 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsCategory.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsCategory.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain; +import com.ruoyi.common.core.domain.TreeEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -13,7 +14,7 @@ import java.util.List; * @author libao * @date 2024-05-09 */ -public class CmsCategory extends BaseEntity +public class CmsCategory extends TreeEntity { private static final long serialVersionUID = 1L; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsMaterial.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsMaterial.java index 3bed2b2a..b6e8cc84 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsMaterial.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/CmsMaterial.java @@ -34,6 +34,17 @@ public class CmsMaterial extends BaseEntity @Excel(name = "分组id") private String groupId; + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + /** 分组名称 */ + private String groupName;//扩展 + /** 素材名称 */ @Excel(name = "素材名称") private String materialName; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java index 1294d5a9..47c86925 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java @@ -197,12 +197,12 @@ public class CmsArticleServiceImpl implements ICmsArticleService newAticle.setTitle(cmsArticle.getTitle()); newAticle.setAuthor(cmsArticle.getAuthor()); newAticle.setDescription(cmsArticle.getDescription()); - cmsArticle.setYhid(user.getUserId().toString()); - cmsArticle.setDeleted(0); - cmsArticle.setTopFlag(1); - cmsArticle.setAvailable(1); - cmsArticle.setPublishTime(DateUtils.getTime()); - cmsArticle.setCreateTime(DateUtils.getNowDate()); + newAticle.setYhid(user.getUserId().toString()); + newAticle.setDeleted(0); + newAticle.setTopFlag(1); + newAticle.setAvailable(1); + newAticle.setPublishTime(DateUtils.getTime()); + newAticle.setCreateTime(DateUtils.getNowDate()); newAticle.setCoverImage(cmsArticle.getCoverImage()); cmsArticleMapper.insertCmsArticle(newAticle); CmsArticleContent cmsArticleContent = new CmsArticleContent(); @@ -227,8 +227,10 @@ public class CmsArticleServiceImpl implements ICmsArticleService public int updateCmsArticle(CmsArticle cmsArticle) { cmsArticle.setUpdateTime(DateUtils.getNowDate()); - SysUser user = SecurityUtils.getLoginUser().getUser(); - cmsArticle.setYhid(user.getUserId().toString()); + if(SecurityUtils.getLoginUser().getUser() != null){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + cmsArticle.setYhid(user.getUserId().toString()); + } cmsArticle.setDeleted(0); cmsArticle.setTopFlag(1); cmsArticle.setAvailable(1); diff --git a/ruoyi-system/src/main/resources/mapper/system/CmsCategoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/CmsCategoryMapper.xml index b42d1023..94e2f366 100644 --- a/ruoyi-system/src/main/resources/mapper/system/CmsCategoryMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/CmsCategoryMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + select t.category_id, t.category_name, t.parent_id, t.ancestors, t.sort, t.description, t.create_time, t.update_time, t.create_by, t.update_by, t.status, t.del_flag, p.category_name as parent_name + from cms_category t + left join cms_category p on p.category_id = t.parent_id + where t.category_id = #{categoryId} - + insert into cms_category @@ -98,9 +106,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from cms_category where category_id in + delete from cms_category where category_id in #{categoryId} - \ No newline at end of file + diff --git a/ruoyi-system/src/main/resources/mapper/system/CmsMaterialMapper.xml b/ruoyi-system/src/main/resources/mapper/system/CmsMaterialMapper.xml index 79018552..24d3a274 100644 --- a/ruoyi-system/src/main/resources/mapper/system/CmsMaterialMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/CmsMaterialMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -24,26 +25,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select material_id, group_id, material_name, material_type, description, material_size, save_path, thumbnail, audit_state, audit_reason, use_state, width, height, uploader_id, upload_time, remark from cms_material + select a.material_id, + a.group_id, + b.group_name, + a.material_name, + a.material_type, + a.description, + a.material_size, + a.save_path, + a.thumbnail, + a.audit_state, + a.audit_reason, + a.use_state, + a.width, + a.height, + a.uploader_id, + a.upload_time, + a.remark + from cms_material a + inner join cms_material_group b on a.group_id = b.group_id