文件上传权限优化;租户主键自增;删除冗余代码
This commit is contained in:
parent
546e4be756
commit
1f72880806
|
@ -1,13 +1,11 @@
|
||||||
package org.dromara.system.controller.file;
|
package org.dromara.system.controller.file;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
@ -44,17 +42,6 @@ public class SysCatalogPersonController extends BaseController {
|
||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出目录-我的空间列表
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("catalog:person:export")
|
|
||||||
@Log(title = "目录-我的空间", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(SysCatalogPersonBo bo, HttpServletResponse response) {
|
|
||||||
List<SysCatalogPersonVo> list = personService.queryList(bo);
|
|
||||||
ExcelUtil.exportExcel(list, "目录-我的空间", SysCatalogPersonVo.class, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取目录-我的空间详细信息
|
* 获取目录-我的空间详细信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -44,8 +44,6 @@ public class SysHomeShowController extends BaseController {
|
||||||
return sysHomeShowService.queryPageList(bo, pageQuery);
|
return sysHomeShowService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取学校名师详细信息
|
* 获取学校名师详细信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class SysHomeTrendController extends BaseController {
|
||||||
return sysHomeTrendService.queryPageList(bo, pageQuery);
|
return sysHomeTrendService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取学校动态详细信息
|
* 获取学校动态详细信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -7,7 +7,6 @@ import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
@ -39,29 +38,18 @@ public class SysOssPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询资源-我的空间列表
|
* 查询资源-我的空间列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("oss:person:pageList")
|
@SaCheckPermission("file:person:pageList")
|
||||||
@GetMapping("/pageList")
|
@GetMapping("/pageList")
|
||||||
public TableDataInfo<SysOssPersonVo> list(SysOssPersonBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysOssPersonVo> list(SysOssPersonBo bo, PageQuery pageQuery) {
|
||||||
return sysOssPersonService.queryPageList(bo, pageQuery);
|
return sysOssPersonService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出资源-我的空间列表
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("oss:person:export")
|
|
||||||
@Log(title = "资源-我的空间", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(SysOssPersonBo bo, HttpServletResponse response) {
|
|
||||||
List<SysOssPersonVo> list = sysOssPersonService.queryList(bo);
|
|
||||||
ExcelUtil.exportExcel(list, "资源-我的空间", SysOssPersonVo.class, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取资源-我的空间详细信息
|
* 获取资源-我的空间详细信息
|
||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("oss:person:query")
|
@SaCheckPermission("file:person:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<SysOssPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<SysOssPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long id) {
|
@PathVariable Long id) {
|
||||||
|
@ -71,7 +59,7 @@ public class SysOssPersonController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 新增资源-我的空间
|
* 新增资源-我的空间
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("oss:person:add")
|
@SaCheckPermission("file:person:add")
|
||||||
@Log(title = "资源-我的空间", businessType = BusinessType.INSERT)
|
@Log(title = "资源-我的空间", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
|
@ -79,23 +67,13 @@ public class SysOssPersonController extends BaseController {
|
||||||
return toAjax(sysOssPersonService.insertByBo(bo));
|
return toAjax(sysOssPersonService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改资源-我的空间
|
|
||||||
*/
|
|
||||||
// @SaCheckPermission("oss:person:edit")
|
|
||||||
// @Log(title = "资源-我的空间", businessType = BusinessType.UPDATE)
|
|
||||||
// @RepeatSubmit()
|
|
||||||
// @PutMapping()
|
|
||||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssPersonBo bo) {
|
|
||||||
// return toAjax(sysOssPersonService.updateByBo(bo));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除资源-我的空间
|
* 删除资源-我的空间
|
||||||
*
|
*
|
||||||
* @param ids 主键串
|
* @param ids 主键串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("oss:person:remove")
|
@SaCheckPermission("file:person:remove")
|
||||||
@Log(title = "资源-我的空间", businessType = BusinessType.DELETE)
|
@Log(title = "资源-我的空间", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
|
|
@ -76,16 +76,6 @@ public class SysOssResourceController extends BaseController {
|
||||||
return toAjax(sysOssResourceService.insertByBo(bo));
|
return toAjax(sysOssResourceService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改专题资源文件
|
|
||||||
*/
|
|
||||||
// @SaCheckPermission("file:resource:edit")
|
|
||||||
// @Log(title = "【更新专题资源】", businessType = BusinessType.UPDATE)
|
|
||||||
// @RepeatSubmit()
|
|
||||||
// @PutMapping()
|
|
||||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssResourceBo bo) {
|
|
||||||
// return toAjax(sysOssResourceService.updateByBo(bo));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除专题资源文件
|
* 删除专题资源文件
|
||||||
|
|
|
@ -77,17 +77,6 @@ public class SysOssTextbookController extends BaseController {
|
||||||
return toAjax(sysOssTextbookService.insertByBo(bo));
|
return toAjax(sysOssTextbookService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改同步教材的文件
|
|
||||||
*/
|
|
||||||
// @SaCheckPermission("file:textbook:edit")
|
|
||||||
// @Log(title = "【更新同步教材】", businessType = BusinessType.UPDATE)
|
|
||||||
// @RepeatSubmit()
|
|
||||||
// @PutMapping()
|
|
||||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssTextbookBo bo) {
|
|
||||||
// return toAjax(sysOssTextbookService.updateByBo(bo));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除同步教材的文件
|
* 删除同步教材的文件
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.dromara.system.controller.system;
|
||||||
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.annotation.SaMode;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
@ -42,7 +43,12 @@ public class SysOssController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询OSS对象存储列表
|
* 查询OSS对象存储列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:oss:list")
|
@SaCheckPermission(value = {
|
||||||
|
"system:oss:list",
|
||||||
|
"file:person:pageList",
|
||||||
|
"file:resource:pageList",
|
||||||
|
"file:textbook:pageList"},
|
||||||
|
mode = SaMode.OR)
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) {
|
public TableDataInfo<SysOssVo> list(@Validated(QueryGroup.class) SysOssBo bo, PageQuery pageQuery) {
|
||||||
return ossService.queryPageList(bo, pageQuery);
|
return ossService.queryPageList(bo, pageQuery);
|
||||||
|
@ -53,7 +59,12 @@ public class SysOssController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param ossIds OSS对象ID串
|
* @param ossIds OSS对象ID串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:oss:list")
|
@SaCheckPermission(value = {
|
||||||
|
"system:oss:list",
|
||||||
|
"file:person:pageList",
|
||||||
|
"file:resource:pageList",
|
||||||
|
"file:textbook:pageList"},
|
||||||
|
mode = SaMode.OR)
|
||||||
@GetMapping("/listByIds/{ossIds}")
|
@GetMapping("/listByIds/{ossIds}")
|
||||||
public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空")
|
public R<List<SysOssVo>> listByIds(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] ossIds) {
|
@PathVariable Long[] ossIds) {
|
||||||
|
@ -66,7 +77,12 @@ public class SysOssController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:oss:upload")
|
@SaCheckPermission(value = {
|
||||||
|
"system:oss:upload",
|
||||||
|
"file:person:add",
|
||||||
|
"file:resource:add",
|
||||||
|
"file:textbook:add"},
|
||||||
|
mode = SaMode.OR)
|
||||||
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
|
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
|
||||||
|
@ -97,7 +113,12 @@ public class SysOssController extends BaseController {
|
||||||
*
|
*
|
||||||
* @param ossIds OSS对象ID串
|
* @param ossIds OSS对象ID串
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:oss:remove")
|
@SaCheckPermission(value = {
|
||||||
|
"system:oss:remove",
|
||||||
|
"file:person:remove",
|
||||||
|
"file:resource:remove",
|
||||||
|
"file:textbook:remove"},
|
||||||
|
mode = SaMode.OR)
|
||||||
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
@Log(title = "OSS对象存储", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ossIds}")
|
@DeleteMapping("/{ossIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.dromara.system.domain;
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
@ -26,7 +27,7 @@ public class SysTenant extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id")
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package org.dromara.system.domain;
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.io.Serial;
|
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户套餐对象 sys_tenant_package
|
* 租户套餐对象 sys_tenant_package
|
||||||
*
|
*
|
||||||
|
@ -23,7 +26,7 @@ public class SysTenantPackage extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 租户套餐id
|
* 租户套餐id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "package_id")
|
@TableId(value = "package_id", type = IdType.AUTO)
|
||||||
private Long packageId;
|
private Long packageId;
|
||||||
/**
|
/**
|
||||||
* 套餐名称
|
* 套餐名称
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package org.dromara.system.domain.vo;
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
import org.dromara.system.domain.SysCatalogPerson;
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.system.domain.SysCatalogPerson;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +16,6 @@ import java.util.Date;
|
||||||
* @date 2024-06-13
|
* @date 2024-06-13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
@AutoMapper(target = SysCatalogPerson.class)
|
@AutoMapper(target = SysCatalogPerson.class)
|
||||||
public class SysCatalogPersonVo implements Serializable {
|
public class SysCatalogPersonVo implements Serializable {
|
||||||
|
|
||||||
|
@ -31,37 +25,31 @@ public class SysCatalogPersonVo implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 目录id
|
* 目录id
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "目录id")
|
|
||||||
private Long catalogId;
|
private Long catalogId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "用户编号")
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父目录id
|
* 父目录id
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "父目录id")
|
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 祖级列表
|
* 祖级列表
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "祖级列表")
|
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目录名称
|
* 目录名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "目录名称")
|
|
||||||
private String catalogName;
|
private String catalogName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示顺序
|
* 显示顺序
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "显示顺序")
|
|
||||||
private Long orderNum;
|
private Long orderNum;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -344,8 +344,6 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||||
xls.save(os, com.aspose.cells.SaveFormat.XLSX);
|
xls.save(os, com.aspose.cells.SaveFormat.XLSX);
|
||||||
}
|
}
|
||||||
if ((".ppt").equals(sysOss.getFileSuffix())) {
|
if ((".ppt").equals(sysOss.getFileSuffix())) {
|
||||||
//LoadOptions options = new LoadOptions();
|
|
||||||
//options.set
|
|
||||||
Presentation ppt = new Presentation(is);
|
Presentation ppt = new Presentation(is);
|
||||||
ppt.save(os, com.aspose.slides.SaveFormat.Pdf);
|
ppt.save(os, com.aspose.slides.SaveFormat.Pdf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||||
schoolVolume.setTenantId(tenantId);
|
schoolVolume.setTenantId(tenantId);
|
||||||
schoolVolume.setType(1);
|
schoolVolume.setType(1);
|
||||||
schoolVolume.setTotalVolume(volume);
|
schoolVolume.setTotalVolume(volume);
|
||||||
ossVolumeMapper.insert(personVolume);
|
ossVolumeMapper.insert(schoolVolume);
|
||||||
// 创建部门: 公司名是部门名称
|
// 创建部门: 公司名是部门名称
|
||||||
SysDept dept = new SysDept();
|
SysDept dept = new SysDept();
|
||||||
dept.setTenantId(tenantId);
|
dept.setTenantId(tenantId);
|
||||||
|
|
Loading…
Reference in New Issue