2024.5.14 纪念馆新后台

This commit is contained in:
libao 2024-05-14 14:44:13 +08:00
parent d4df1bd230
commit bdc336f8f9
7 changed files with 73 additions and 39 deletions

View File

@ -89,7 +89,7 @@ public class DoorController extends BaseController {
@ApiOperation("照片查询")
@PostMapping("/MaterialList")
public TableDataInfo list() {
startPage();
// startPage();
List<CmsMaterial> list = materialMapper.selectCmsMaterialList(new CmsMaterial());
return getDataTable(list);
}

View File

@ -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()

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.CmsCategoryMapper">
<resultMap type="CmsCategory" id="CmsCategoryResult">
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_name" />
@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="categoryTags" column="category_tags" />
</resultMap>
@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCmsCategoryList" parameterType="CmsCategory" resultMap="CmsCategoryResult">
<include refid="selectCmsCategoryVo"/>
<where>
<where>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
@ -35,13 +36,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and status = #{status}</if>
<if test="categoryTags != null and categoryTags != ''"> and category_tags = #{categoryTags}</if>
</where>
order by sort
</select>
<select id="selectCmsCategoryByCategoryId" parameterType="Long" resultMap="CmsCategoryResult">
<include refid="selectCmsCategoryVo"/>
where category_id = #{categoryId}
<!-- <select id="selectCmsCategoryByCategoryId" parameterType="Long" resultMap="CmsCategoryResult">-->
<!-- <include refid="selectCmsCategoryVo"/>-->
<!-- where category_id = #{categoryId}-->
<!-- </select>-->
<select id="selectCmsCategoryByCategoryId" resultMap="CmsCategoryResult">
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}
</select>
<insert id="insertCmsCategory" parameterType="CmsCategory" useGeneratedKeys="true" keyProperty="categoryId">
insert into cms_category
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -98,9 +106,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteCmsCategoryByCategoryIds" parameterType="String">
delete from cms_category where category_id in
delete from cms_category where category_id in
<foreach item="categoryId" collection="array" open="(" separator="," close=")">
#{categoryId}
</foreach>
</delete>
</mapper>
</mapper>

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="CmsMaterial" id="CmsMaterialResult">
<result property="materialId" column="material_id" />
<result property="groupId" column="group_id" />
<result property="groupName" column="group_name" />
<result property="materialName" column="material_name" />
<result property="materialType" column="material_type" />
<result property="description" column="description" />
@ -24,26 +25,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectCmsMaterialVo">
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
</sql>
<select id="selectCmsMaterialList" parameterType="CmsMaterial" resultMap="CmsMaterialResult">
<include refid="selectCmsMaterialVo"/>
<where>
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="materialSize != null and materialSize != ''"> and material_size = #{materialSize}</if>
<if test="savePath != null and savePath != ''"> and save_path = #{savePath}</if>
<if test="thumbnail != null and thumbnail != ''"> and thumbnail = #{thumbnail}</if>
<if test="auditState != null and auditState != ''"> and audit_state = #{auditState}</if>
<if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
<if test="useState != null and useState != ''"> and use_state = #{useState}</if>
<if test="width != null and width != ''"> and width = #{width}</if>
<if test="height != null and height != ''"> and height = #{height}</if>
<if test="uploaderId != null and uploaderId != ''"> and uploader_id = #{uploaderId}</if>
<if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
<if test="groupId != null and groupId != ''"> and a.group_id = #{groupId}</if>
<if test="materialName != null and materialName != ''"> and a.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null and materialType != ''"> and a.material_type = #{materialType}</if>
<if test="auditState != null and auditState != ''"> and a.audit_state = #{auditState}</if>
<if test="useState != null and useState != ''"> and a.use_state = #{useState}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>