From 7eff471080b4a4a83481e79ab3117f001dee9e3a Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Tue, 19 Dec 2023 10:28:34 +0800
Subject: [PATCH] 上传图片、留言模块
---
src/main/java/org/springblade/common/config/BladeConfiguration.java | 1
src/main/java/org/springblade/modules/leave/entity/LeaveWordsEntity.java | 70 +++++
src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.xml | 46 +++
src/main/java/org/springblade/modules/leave/dto/LeaveWordsDTO.java | 34 ++
src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.java | 61 ++++
src/main/java/org/springblade/modules/leave/service/ILeaveWordsService.java | 59 ++++
src/main/java/org/springblade/modules/leave/service/impl/LeaveWordsServiceImpl.java | 59 ++++
src/main/java/org/springblade/modules/leave/controller/LeaveWordsController.java | 166 ++++++++++++
src/main/java/org/springblade/modules/leave/excel/LeaveWordsExcel.java | 87 ++++++
src/main/java/org/springblade/modules/leave/vo/LeaveWordsVO.java | 78 ++++++
src/main/java/org/springblade/modules/leave/wrapper/LeaveWordsWrapper.java | 69 +++++
src/main/resources/application.yml | 36 +-
12 files changed, 752 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/springblade/common/config/BladeConfiguration.java b/src/main/java/org/springblade/common/config/BladeConfiguration.java
index badd1bb..308d891 100644
--- a/src/main/java/org/springblade/common/config/BladeConfiguration.java
+++ b/src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -51,6 +51,7 @@
secureRegistry.excludePathPatterns("/webjars/**");
secureRegistry.excludePathPatterns("/swagger-resources/**");
secureRegistry.excludePathPatterns("/druid/**");
+ secureRegistry.excludePathPatterns("/leave/leaveWords/**");
return secureRegistry;
}
diff --git a/src/main/java/org/springblade/modules/leave/controller/LeaveWordsController.java b/src/main/java/org/springblade/modules/leave/controller/LeaveWordsController.java
new file mode 100644
index 0000000..3b87e65
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/controller/LeaveWordsController.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.assessment.entity.AssessmentScoreEntity;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.modules.leave.vo.LeaveWordsVO;
+import org.springblade.modules.leave.excel.LeaveWordsExcel;
+import org.springblade.modules.leave.wrapper.LeaveWordsWrapper;
+import org.springblade.modules.leave.service.ILeaveWordsService;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.tool.constant.BladeConstant;
+import springfox.documentation.annotations.ApiIgnore;
+import java.util.Map;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 留言板块 控制器
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("leave/leaveWords")
+@Api(value = "留言板块", tags = "留言板块接口")
+public class LeaveWordsController extends BladeController {
+
+ private final ILeaveWordsService leaveWordsService;
+
+ /**
+ * 留言板块 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入leaveWords")
+ public R<LeaveWordsVO> detail(LeaveWordsEntity leaveWords) {
+ LeaveWordsEntity detail = leaveWordsService.getOne(Condition.getQueryWrapper(leaveWords));
+ return R.data(LeaveWordsWrapper.build().entityVO(detail));
+ }
+ /**
+ * 留言板块 树列表
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入leaveWords")
+// public R<List<LeaveWordsVO>> list(@ApiIgnore @RequestParam Map<String, Object> leaveWords, BladeUser bladeUser) {
+ public R<IPage<LeaveWordsVO>> list(@ApiIgnore @RequestParam Map<String, Object> leaveWords, Query query) {
+ QueryWrapper<LeaveWordsEntity> queryWrapper = Condition.getQueryWrapper(leaveWords, LeaveWordsEntity.class);
+// List<LeaveWordsEntity> list = leaveWordsService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(LeaveWordsEntity::getTenantId, bladeUser.getTenantId()) : queryWrapper);
+// List<LeaveWordsEntity> list = leaveWordsService.list(queryWrapper);
+ IPage<LeaveWordsEntity> pages = leaveWordsService.page(Condition.getPage(query), Condition.getQueryWrapper(leaveWords, LeaveWordsEntity.class));
+ return R.data(LeaveWordsWrapper.build().treeNodePageVO(pages));
+ }
+
+ /**
+ * 留言板块 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入leaveWords")
+ public R<IPage<LeaveWordsVO>> page(LeaveWordsVO leaveWords, Query query) {
+ IPage<LeaveWordsVO> pages = leaveWordsService.selectLeaveWordsPage(Condition.getPage(query), leaveWords);
+ return R.data(pages);
+ }
+
+ /**
+ * 留言板块 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入leaveWords")
+ public R save(@Valid @RequestBody LeaveWordsEntity leaveWords) {
+ return R.status(leaveWordsService.save(leaveWords));
+ }
+
+ /**
+ * 留言板块 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入leaveWords")
+ public R update(@Valid @RequestBody LeaveWordsEntity leaveWords) {
+ return R.status(leaveWordsService.updateById(leaveWords));
+ }
+
+ /**
+ * 留言板块 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入leaveWords")
+ public R submit(@Valid @RequestBody LeaveWordsEntity leaveWords) {
+ return R.status(leaveWordsService.saveOrUpdate(leaveWords));
+ }
+
+ /**
+ * 留言板块 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 7)
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(leaveWordsService.deleteLogic(Func.toLongList(ids)));
+ }
+
+ /**
+ * 留言板块 树形结构
+ */
+ @GetMapping("/tree")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "树形结构", notes = "树形结构")
+ public R<List<LeaveWordsVO>> tree(String tenantId, BladeUser bladeUser) {
+ List<LeaveWordsVO> tree = leaveWordsService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()));
+ return R.data(tree);
+ }
+
+ /**
+ * 导出数据
+ */
+ @GetMapping("/export-leaveWords")
+ @ApiOperationSupport(order = 9)
+ @ApiOperation(value = "导出数据", notes = "传入leaveWords")
+ public void exportLeaveWords(@ApiIgnore @RequestParam Map<String, Object> leaveWords, BladeUser bladeUser, HttpServletResponse response) {
+ QueryWrapper<LeaveWordsEntity> queryWrapper = Condition.getQueryWrapper(leaveWords, LeaveWordsEntity.class);
+ //if (!AuthUtil.isAdministrator()) {
+ // queryWrapper.lambda().eq(LeaveWords::getTenantId, bladeUser.getTenantId());
+ //}
+ queryWrapper.lambda().eq(LeaveWordsEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
+ List<LeaveWordsExcel> list = leaveWordsService.exportLeaveWords(queryWrapper);
+ ExcelUtil.export(response, "留言板块数据" + DateUtil.time(), "留言板块数据表", list, LeaveWordsExcel.class);
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/dto/LeaveWordsDTO.java b/src/main/java/org/springblade/modules/leave/dto/LeaveWordsDTO.java
new file mode 100644
index 0000000..44cbbf2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/dto/LeaveWordsDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.dto;
+
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 留言板块 数据传输对象实体类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class LeaveWordsDTO extends LeaveWordsEntity {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/entity/LeaveWordsEntity.java b/src/main/java/org/springblade/modules/leave/entity/LeaveWordsEntity.java
new file mode 100644
index 0000000..35c0829
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/entity/LeaveWordsEntity.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Date;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+/**
+ * 留言板块 实体类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@Data
+@TableName("yw_leave_words")
+@ApiModel(value = "LeaveWords对象", description = "留言板块")
+@EqualsAndHashCode(callSuper = true)
+public class LeaveWordsEntity extends TenantEntity {
+
+ /**
+ * 父id
+ */
+ @ApiModelProperty(value = "父id")
+ private Long parentId;
+ /**
+ * 留言人名称
+ */
+ @ApiModelProperty(value = "留言人名称")
+ private String userName;
+ /**
+ * 留言人职位
+ */
+ @ApiModelProperty(value = "留言人部门")
+ private String userDept;
+ /**
+ * 留言人职位
+ */
+ @ApiModelProperty(value = "留言人职位")
+ private String userPost;
+ /**
+ * 留言内容
+ */
+ @ApiModelProperty(value = "留言内容")
+ private String content;
+ /**
+ * 图片数组
+ */
+ @ApiModelProperty(value = "图片数组")
+ private String imageUrls;
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/excel/LeaveWordsExcel.java b/src/main/java/org/springblade/modules/leave/excel/LeaveWordsExcel.java
new file mode 100644
index 0000000..a36259f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/excel/LeaveWordsExcel.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.excel;
+
+
+import lombok.Data;
+
+import java.util.Date;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import java.io.Serializable;
+
+
+/**
+ * 留言板块 Excel实体类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class LeaveWordsExcel implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 租户ID
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("租户ID")
+ private String tenantId;
+ /**
+ * 父id
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("父id")
+ private Long parentId;
+ /**
+ * 留言人名称
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("留言人名称")
+ private String userName;
+ /**
+ * 留言人职位
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("留言人职位")
+ private String userPost;
+ /**
+ * 留言内容
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("留言内容")
+ private String content;
+ /**
+ * 图片数组
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("图片数组")
+ private String imageUrls;
+ /**
+ * 是否已删除
+ */
+ @ColumnWidth(20)
+ @ExcelProperty("是否已删除")
+ private Integer isDeleted;
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.java b/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.java
new file mode 100644
index 0000000..18b15a3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.mapper;
+
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.modules.leave.vo.LeaveWordsVO;
+import org.springblade.modules.leave.excel.LeaveWordsExcel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+/**
+ * 留言板块 Mapper 接口
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+public interface LeaveWordsMapper extends BaseMapper<LeaveWordsEntity> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param leaveWords
+ * @return
+ */
+ List<LeaveWordsVO> selectLeaveWordsPage(IPage page, LeaveWordsVO leaveWords);
+
+ /**
+ * 获取树形节点
+ *
+ * @param tenantId
+ * @return
+ */
+ List<LeaveWordsVO> tree(String tenantId);
+
+ /**
+ * 获取导出数据
+ *
+ * @param queryWrapper
+ * @return
+ */
+ List<LeaveWordsExcel> exportLeaveWords(@Param("ew") Wrapper<LeaveWordsEntity> queryWrapper);
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.xml b/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.xml
new file mode 100644
index 0000000..bd0dfb7
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/mapper/LeaveWordsMapper.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.leave.mapper.LeaveWordsMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="leaveWordsResultMap" type="org.springblade.modules.leave.entity.LeaveWordsEntity">
+ <result column="id" property="id"/>
+ <result column="tenant_id" property="tenantId"/>
+ <result column="parent_id" property="parentId"/>
+ <result column="user_name" property="userName"/>
+ <result column="user_post" property="userPost"/>
+ <result column="content" property="content"/>
+ <result column="image_urls" property="imageUrls"/>
+ <result column="create_user" property="createUser"/>
+ <result column="create_dept" property="createDept"/>
+ <result column="create_time" property="createTime"/>
+ <result column="update_user" property="updateUser"/>
+ <result column="update_time" property="updateTime"/>
+ <result column="status" property="status"/>
+ <result column="is_deleted" property="isDeleted"/>
+ </resultMap>
+
+ <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
+ <id column="id" property="id"/>
+ <result column="parent_id" property="parentId"/>
+ <result column="title" property="title"/>
+ <result column="value" property="value"/>
+ <result column="key" property="key"/>
+ </resultMap>
+
+ <select id="selectLeaveWordsPage" resultMap="leaveWordsResultMap">
+ select * from yw_leave_words where is_deleted = 0
+ </select>
+
+ <select id="tree" resultMap="treeNodeResultMap">
+ select id as id, parent_id as parent_id, user_name as title, id as 'value', id as 'key' from yw_leave_words where is_deleted = 0
+ <if test="_parameter!=null">
+ and tenant_id = #{_parameter}
+ </if>
+ </select>
+
+ <select id="exportLeaveWords" resultType="org.springblade.modules.leave.excel.LeaveWordsExcel">
+ SELECT * FROM yw_leave_words ${ew.customSqlSegment}
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/leave/service/ILeaveWordsService.java b/src/main/java/org/springblade/modules/leave/service/ILeaveWordsService.java
new file mode 100644
index 0000000..b0e7d59
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/service/ILeaveWordsService.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.modules.leave.vo.LeaveWordsVO;
+import org.springblade.modules.leave.excel.LeaveWordsExcel;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import java.util.List;
+
+/**
+ * 留言板块 服务类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+public interface ILeaveWordsService extends BaseService<LeaveWordsEntity> {
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param leaveWords
+ * @return
+ */
+ IPage<LeaveWordsVO> selectLeaveWordsPage(IPage<LeaveWordsVO> page, LeaveWordsVO leaveWords);
+
+ /**
+ * 树形结构
+ *
+ * @param tenantId
+ * @return
+ */
+ List<LeaveWordsVO> tree(String tenantId);
+
+ /**
+ * 导出数据
+ *
+ * @param queryWrapper
+ * @return
+ */
+ List<LeaveWordsExcel> exportLeaveWords(Wrapper<LeaveWordsEntity> queryWrapper);
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/service/impl/LeaveWordsServiceImpl.java b/src/main/java/org/springblade/modules/leave/service/impl/LeaveWordsServiceImpl.java
new file mode 100644
index 0000000..7f9644e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/service/impl/LeaveWordsServiceImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.service.impl;
+
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.modules.leave.vo.LeaveWordsVO;
+import org.springblade.modules.leave.excel.LeaveWordsExcel;
+import org.springblade.modules.leave.mapper.LeaveWordsMapper;
+import org.springblade.modules.leave.service.ILeaveWordsService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import java.util.List;
+
+/**
+ * 留言板块 服务实现类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@Service
+public class LeaveWordsServiceImpl extends BaseServiceImpl<LeaveWordsMapper, LeaveWordsEntity> implements ILeaveWordsService {
+
+ @Override
+ public IPage<LeaveWordsVO> selectLeaveWordsPage(IPage<LeaveWordsVO> page, LeaveWordsVO leaveWords) {
+ return page.setRecords(baseMapper.selectLeaveWordsPage(page, leaveWords));
+ }
+
+ @Override
+ public List<LeaveWordsVO> tree(String tenantId) {
+ return ForestNodeMerger.merge(baseMapper.tree(tenantId));
+ }
+
+ @Override
+ public List<LeaveWordsExcel> exportLeaveWords(Wrapper<LeaveWordsEntity> queryWrapper) {
+ List<LeaveWordsExcel> leaveWordsList = baseMapper.exportLeaveWords(queryWrapper);
+ //leaveWordsList.forEach(leaveWords -> {
+ // leaveWords.setTypeName(DictCache.getValue(DictEnum.YES_NO, LeaveWords.getType()));
+ //});
+ return leaveWordsList;
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/vo/LeaveWordsVO.java b/src/main/java/org/springblade/modules/leave/vo/LeaveWordsVO.java
new file mode 100644
index 0000000..b07b3ca
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/vo/LeaveWordsVO.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.vo;
+
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.core.tool.node.INode;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 留言板块 视图实体类
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class LeaveWordsVO extends LeaveWordsEntity implements INode<LeaveWordsVO> {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键ID
+ */
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long id;
+
+ /**
+ * 父节点ID
+ */
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long parentId;
+
+ /**
+ * 父节点名称
+ */
+ private String parentName;
+
+ /**
+ * 子孙节点
+ */
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private List<LeaveWordsVO> children;
+
+ /**
+ * 是否有子孙节点
+ */
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ private Boolean hasChildren;
+
+ @Override
+ public List<LeaveWordsVO> getChildren() {
+ if (this.children == null) {
+ this.children = new ArrayList<>();
+ }
+ return this.children;
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/leave/wrapper/LeaveWordsWrapper.java b/src/main/java/org/springblade/modules/leave/wrapper/LeaveWordsWrapper.java
new file mode 100644
index 0000000..45b4ed3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/leave/wrapper/LeaveWordsWrapper.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.leave.wrapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.assessment.vo.AssessmentScoreVO;
+import org.springblade.modules.leave.entity.LeaveWordsEntity;
+import org.springblade.modules.leave.vo.LeaveWordsVO;
+import java.util.Objects;
+import org.springblade.core.tool.node.ForestNodeMerger;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 留言板块 包装类,返回视图层所需的字段
+ *
+ * @author aix
+ * @since 2023-12-18
+ */
+public class LeaveWordsWrapper extends BaseEntityWrapper<LeaveWordsEntity, LeaveWordsVO> {
+
+ public static LeaveWordsWrapper build() {
+ return new LeaveWordsWrapper();
+ }
+
+ @Override
+ public LeaveWordsVO entityVO(LeaveWordsEntity leaveWords) {
+ LeaveWordsVO leaveWordsVO = Objects.requireNonNull(BeanUtil.copy(leaveWords, LeaveWordsVO.class));
+
+ //User createUser = UserCache.getUser(leaveWords.getCreateUser());
+ //User updateUser = UserCache.getUser(leaveWords.getUpdateUser());
+ //leaveWordsVO.setCreateUserName(createUser.getName());
+ //leaveWordsVO.setUpdateUserName(updateUser.getName());
+
+ return leaveWordsVO;
+ }
+
+ public List<LeaveWordsVO> treeNodeVO(List<LeaveWordsEntity> list) {
+ List<LeaveWordsVO> collect = list.stream().map(leaveWords -> BeanUtil.copy(leaveWords, LeaveWordsVO.class)).collect(Collectors.toList());
+ return ForestNodeMerger.merge(collect);
+ }
+
+ public IPage<LeaveWordsVO> treeNodePageVO(IPage<LeaveWordsEntity> pages) {
+ List<LeaveWordsVO> records = listVO(pages.getRecords());
+ IPage<LeaveWordsVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
+
+ List<LeaveWordsVO> collect = records.stream().map(leaveWords -> BeanUtil.copy(leaveWords, LeaveWordsVO.class)).collect(Collectors.toList());
+ pageVo.setRecords(ForestNodeMerger.merge(collect));
+ return pageVo;
+ }
+
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 1cb50d7..8b73ee1 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -131,22 +131,29 @@
#oss默认配置
oss:
#开启oss配置
+# enabled: true
+# #开启oss类型
+# #minio、s3、qiniu、alioss、huaweiobs、tencentcos
+# name: qiniu
+# #租户模式
+# tenant-mode: true
+# #oss服务地址
+# endpoint: http://prt1thnw3.bkt.clouddn.com
+# #minio转换服务地址,用于内网上传后将返回地址改为转换的外网地址
+# transform-endpoint: http://localhost:9000
+# #访问key
+# access-key: N_Loh1ngBqcJovwiAJqR91Ifj2vgOWHOf8AwBA_h
+# #密钥key
+# secret-key: AuzuA1KHAbkIndCU0dB3Zfii2O3crHNODDmpxHRS
+# #存储桶
+# bucket-name: bladex
enabled: true
- #开启oss类型
- #minio、s3、qiniu、alioss、huaweiobs、tencentcos
- name: qiniu
- #租户模式
+ name: minio
tenant-mode: true
- #oss服务地址
- endpoint: http://prt1thnw3.bkt.clouddn.com
- #minio转换服务地址,用于内网上传后将返回地址改为转换的外网地址
- transform-endpoint: http://localhost:9000
- #访问key
- access-key: N_Loh1ngBqcJovwiAJqR91Ifj2vgOWHOf8AwBA_h
- #密钥key
- secret-key: AuzuA1KHAbkIndCU0dB3Zfii2O3crHNODDmpxHRS
- #存储桶
- bucket-name: bladex
+ endpoint: http://dev.jxpskj.com:9000/
+ access-key: pskj
+ secret-key: pskj@2021
+ bucket-name: ztzh
#第三方登陆配置
social:
@@ -229,6 +236,7 @@
#接口放行
skip-url:
- /blade-test/**
+# - /leave/leaveWords/**
#授权认证配置
auth:
- method: ALL
--
Gitblit v1.9.3