整理代码和调通了文件更新
This commit is contained in:
parent
07e9ae9d23
commit
e2ca481ee5
|
|
@ -75,7 +75,7 @@ public class EdFileInfoController {
|
||||||
@RequestMapping("versionView")
|
@RequestMapping("versionView")
|
||||||
public ElectromagneticResult<?> versionView(@RequestParam String fileId) {
|
public ElectromagneticResult<?> versionView(@RequestParam String fileId) {
|
||||||
return edFileInfoService.versionView(fileId);
|
return edFileInfoService.versionView(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("versionBack")
|
@RequestMapping("versionBack")
|
||||||
public ElectromagneticResult<?> versionBack(@RequestParam String fileId, @RequestParam int targetVersion) {
|
public ElectromagneticResult<?> versionBack(@RequestParam String fileId, @RequestParam int targetVersion) {
|
||||||
|
|
@ -87,19 +87,19 @@ public class EdFileInfoController {
|
||||||
return edFileInfoService.batchExport(dataIdArr, response);
|
return edFileInfoService.batchExport(dataIdArr, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/mergeChunks",method = RequestMethod.GET)
|
@RequestMapping(value = "/mergeChunks", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> mergeChunks(@RequestParam String identifier,
|
public ElectromagneticResult<?> mergeChunks(@RequestParam String identifier,
|
||||||
@RequestParam String fileName,
|
@RequestParam String fileName,
|
||||||
@RequestParam Integer totalChunks) {
|
@RequestParam Integer totalChunks) {
|
||||||
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks);
|
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/batchImport",method = RequestMethod.POST)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.batchImport(fileChunkDTO);
|
return edFileInfoService.batchImport(fileChunkDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/batchImport",method = RequestMethod.GET)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ public class RoleController {
|
||||||
return ElectromagneticResultUtil.success(roleService.deleteRole(roleId));
|
return ElectromagneticResultUtil.success(roleService.deleteRole(roleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value="查看角色", notes = "")
|
@ApiOperation(value = "查看角色", notes = "")
|
||||||
@GetMapping(value="/getSingleRole/{roleId}")
|
@GetMapping(value = "/getSingleRole/{roleId}")
|
||||||
public ElectromagneticResult<?> getRole(@PathVariable("roleId") String roleId) {
|
public ElectromagneticResult<?> getRole(@PathVariable("roleId") String roleId) {
|
||||||
return ElectromagneticResultUtil.success(roleService.getRole(roleId));
|
return ElectromagneticResultUtil.success(roleService.getRole(roleId));
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +47,7 @@ public class RoleController {
|
||||||
return ElectromagneticResultUtil.success(roleService.getRoles(rolePageDTO));
|
return ElectromagneticResultUtil.success(roleService.getRoles(rolePageDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value="通过角色名查看角色权限", notes = "")
|
@ApiOperation(value = "通过角色名查看角色权限", notes = "")
|
||||||
@GetMapping(value = "/getRoleByName")
|
@GetMapping(value = "/getRoleByName")
|
||||||
public ElectromagneticResult<?> getRoleByName(@RequestParam("roleName") String roleName) {
|
public ElectromagneticResult<?> getRoleByName(@RequestParam("roleName") String roleName) {
|
||||||
return ElectromagneticResultUtil.success(roleService.getRoleByName(roleName));
|
return ElectromagneticResultUtil.success(roleService.getRoleByName(roleName));
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ public interface UserMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找用户角色名称
|
* 查找用户角色名称
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,103 @@ import java.util.Date;
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@Data
|
@Data
|
||||||
@FieldNameConstants
|
@FieldNameConstants
|
||||||
public class EdFileInfo extends BaseModel{
|
public class EdFileInfo extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "id")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 文件id,如果是第一个版本,则和id一致,同一个文件不同版本,file_id是一致的
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_id")
|
||||||
|
private String fileId;
|
||||||
|
/**
|
||||||
|
* 父目录id
|
||||||
|
*/
|
||||||
|
@TableField(value = "parent_id")
|
||||||
|
private String parentId;
|
||||||
|
/**
|
||||||
|
* 文件类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_type")
|
||||||
|
private String fileType;
|
||||||
|
/**
|
||||||
|
* 文件名
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_name")
|
||||||
|
private String fileName;
|
||||||
|
/**
|
||||||
|
* 文件备注
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_note")
|
||||||
|
private String fileNote;
|
||||||
|
/**
|
||||||
|
* 文件内容
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_content")
|
||||||
|
private String fileContent;
|
||||||
|
/**
|
||||||
|
* 文件当前版本,文件版本号默认从100开始
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_version")
|
||||||
|
private Integer fileVersion;
|
||||||
|
/**
|
||||||
|
* 文件时间,文件编号的最后15位,精确到毫秒
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_time")
|
||||||
|
private String fileTime;
|
||||||
|
/**
|
||||||
|
* 文件路径,指到文件的父目录,有各个父目录的id加下划线组成
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_path")
|
||||||
|
private String filePath;
|
||||||
|
/**
|
||||||
|
* 数据类型,0-文件夹 1-文件
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_type")
|
||||||
|
private Integer dataType;
|
||||||
|
/**
|
||||||
|
* 数据状态,0-发布 1-占用
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_status")
|
||||||
|
private Integer dataStatus;
|
||||||
|
/**
|
||||||
|
* 文件的上一个版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "pre_version")
|
||||||
|
private Integer preVersion;
|
||||||
|
/**
|
||||||
|
* 是否有效 0-无效 1-有效
|
||||||
|
*/
|
||||||
|
@TableField(value = "effect_flag")
|
||||||
|
private Integer effectFlag;
|
||||||
|
/**
|
||||||
|
* 保存状态,0-上传中 1-上传成功 2-上传失败
|
||||||
|
*/
|
||||||
|
@TableField(value = "save_status")
|
||||||
|
private Integer saveStatus;
|
||||||
|
/**
|
||||||
|
* 文件大小
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_size")
|
||||||
|
private Long fileSize;
|
||||||
|
/**
|
||||||
|
* 文件夹顺序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 文件编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_code")
|
||||||
|
private String fileCode;
|
||||||
|
/**
|
||||||
|
* 是否是管理员定义的系统层级目录
|
||||||
|
*/
|
||||||
|
@TableField(value = "prj_dir")
|
||||||
|
private Boolean prjDir;
|
||||||
|
|
||||||
public void newInit() {
|
public void newInit() {
|
||||||
String userId = UserThreadLocal.getUserId();
|
String userId = UserThreadLocal.getUserId();
|
||||||
|
|
@ -34,119 +130,4 @@ public class EdFileInfo extends BaseModel{
|
||||||
this.setFileId(newFileDbId);
|
this.setFileId(newFileDbId);
|
||||||
this.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
this.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@TableField(value = "id")
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件id,如果是第一个版本,则和id一致,同一个文件不同版本,file_id是一致的
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_id")
|
|
||||||
private String fileId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父目录id
|
|
||||||
*/
|
|
||||||
@TableField(value = "parent_id")
|
|
||||||
private String parentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类型
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_type")
|
|
||||||
private String fileType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件名
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_name")
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件备注
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_note")
|
|
||||||
private String fileNote;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件内容
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_content")
|
|
||||||
private String fileContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件当前版本,文件版本号默认从100开始
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_version")
|
|
||||||
private Integer fileVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件时间,文件编号的最后15位,精确到毫秒
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_time")
|
|
||||||
private String fileTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件路径,指到文件的父目录,有各个父目录的id加下划线组成
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_path")
|
|
||||||
private String filePath;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据类型,0-文件夹 1-文件
|
|
||||||
*/
|
|
||||||
@TableField(value = "data_type")
|
|
||||||
private Integer dataType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据状态,0-发布 1-占用
|
|
||||||
*/
|
|
||||||
@TableField(value = "data_status")
|
|
||||||
private Integer dataStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件的上一个版本号
|
|
||||||
*/
|
|
||||||
@TableField(value = "pre_version")
|
|
||||||
private Integer preVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否有效 0-无效 1-有效
|
|
||||||
*/
|
|
||||||
@TableField(value = "effect_flag")
|
|
||||||
private Integer effectFlag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存状态,0-上传中 1-上传成功 2-上传失败
|
|
||||||
*/
|
|
||||||
@TableField(value = "save_status")
|
|
||||||
private Integer saveStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件大小
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_size")
|
|
||||||
private Long fileSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件夹顺序
|
|
||||||
*/
|
|
||||||
@TableField(value = "sort")
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件编码
|
|
||||||
*/
|
|
||||||
@TableField(value = "file_code")
|
|
||||||
private String fileCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否是管理员定义的系统层级目录
|
|
||||||
*/
|
|
||||||
@TableField(value = "prj_dir")
|
|
||||||
private Boolean prjDir;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class Role {
|
||||||
/**
|
/**
|
||||||
* 是否有效:0-无效 1-有效
|
* 是否有效:0-无效 1-有效
|
||||||
*/
|
*/
|
||||||
@TableField(value="effect_flag")
|
@TableField(value = "effect_flag")
|
||||||
private Integer effectFlag;
|
private Integer effectFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,48 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class FileInfoQueryDTO {
|
public class FileInfoQueryDTO {
|
||||||
|
|
||||||
/** 父文件夹id */
|
/**
|
||||||
|
* 父文件夹id
|
||||||
|
*/
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
/** 当前页码 */
|
/**
|
||||||
|
* 当前页码
|
||||||
|
*/
|
||||||
private Integer pageNum;
|
private Integer pageNum;
|
||||||
|
|
||||||
/** 每页的数量 */
|
/**
|
||||||
|
* 每页的数量
|
||||||
|
*/
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
/** 搜索关键词 */
|
/**
|
||||||
|
* 搜索关键词
|
||||||
|
*/
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
/** 文件类型 (0-文件夹 1-文件)*/
|
/**
|
||||||
|
* 文件类型 (0-文件夹 1-文件)
|
||||||
|
*/
|
||||||
private Integer fileType;
|
private Integer fileType;
|
||||||
|
|
||||||
/** 上传时间(0-升序,1-降序)*/
|
/**
|
||||||
|
* 上传时间(0-升序,1-降序)
|
||||||
|
*/
|
||||||
private Integer createdTime;
|
private Integer createdTime;
|
||||||
|
|
||||||
/** 版本号(0-升序,1-降序 */
|
/**
|
||||||
|
* 版本号(0-升序,1-降序
|
||||||
|
*/
|
||||||
private Integer fileVersion;
|
private Integer fileVersion;
|
||||||
|
|
||||||
/** 文件大小0-升序,1-降序) */
|
/**
|
||||||
|
* 文件大小0-升序,1-降序)
|
||||||
|
*/
|
||||||
private Integer fileSize;
|
private Integer fileSize;
|
||||||
|
|
||||||
/** 状态(0-未发布 1-已发布 2-占用) */
|
/**
|
||||||
|
* 状态(0-未发布 1-已发布 2-占用)
|
||||||
|
*/
|
||||||
private Integer dataStatus;
|
private Integer dataStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@ public class RolePermissionDTO {
|
||||||
/**
|
/**
|
||||||
* 数据权限
|
* 数据权限
|
||||||
*/
|
*/
|
||||||
private Map<String,Boolean> dataAuth;
|
private Map<String, Boolean> dataAuth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限哈希
|
* 权限哈希
|
||||||
*/
|
*/
|
||||||
private Map<String,Boolean> permission;
|
private Map<String, Boolean> permission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子目录
|
* 子目录
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文件列表
|
* 查询文件列表
|
||||||
|
*
|
||||||
* @param fileInfoQueryDTO
|
* @param fileInfoQueryDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -22,6 +23,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建文件夹
|
* 新建文件夹
|
||||||
|
*
|
||||||
* @param parentId
|
* @param parentId
|
||||||
* @param newFolderName
|
* @param newFolderName
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -30,6 +32,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目层级结构查询
|
* 项目层级结构查询
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> tree();
|
ElectromagneticResult<?> tree();
|
||||||
|
|
@ -44,6 +47,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,12 +55,14 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件信息
|
* 更新文件信息
|
||||||
|
*
|
||||||
* @param updateFileInfoDTO
|
* @param updateFileInfoDTO
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO);
|
ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版本回退
|
* 版本回退
|
||||||
|
*
|
||||||
* @param fileId
|
* @param fileId
|
||||||
* @param targetVersion
|
* @param targetVersion
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -65,6 +71,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看分片是否存在
|
* 查看分片是否存在
|
||||||
|
*
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -72,6 +79,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入
|
* 批量导入
|
||||||
|
*
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,6 +87,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合并分片
|
* 合并分片
|
||||||
|
*
|
||||||
* @param identifier
|
* @param identifier
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param totalChunks
|
* @param totalChunks
|
||||||
|
|
@ -88,6 +97,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
|
*
|
||||||
* @param dataIdArr
|
* @param dataIdArr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,6 +105,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
|
*
|
||||||
* @param parentId
|
* @param parentId
|
||||||
* @param file
|
* @param file
|
||||||
* @param strategy
|
* @param strategy
|
||||||
|
|
@ -104,6 +115,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版本查看
|
* 版本查看
|
||||||
|
*
|
||||||
* @param fileId
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -111,6 +123,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动文件
|
* 移动文件
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param targetFolderId
|
* @param targetFolderId
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -119,6 +132,7 @@ public interface EdFileInfoService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复制文件
|
* 复制文件
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param targetFolderId
|
* @param targetFolderId
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public interface PermissionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得当前角色权限
|
* 获得当前角色权限
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @param fileId
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -31,6 +32,7 @@ public interface PermissionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户权限列表 转换为 哈希
|
* 用户权限列表 转换为 哈希
|
||||||
|
*
|
||||||
* @param permissionCodes
|
* @param permissionCodes
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
import com.electromagnetic.industry.software.manage.pojo.models.Role;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -13,6 +12,7 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建角色
|
* 新建角色
|
||||||
|
*
|
||||||
* @param roleDTO
|
* @param roleDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -20,6 +20,7 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新角色
|
* 更新角色
|
||||||
|
*
|
||||||
* @param roleDTO
|
* @param roleDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,6 +28,7 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除角色
|
* 删除角色
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -34,6 +36,7 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看角色
|
* 查看角色
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -41,6 +44,7 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看角色列表
|
* 查看角色列表
|
||||||
|
*
|
||||||
* @param rolePageDTO
|
* @param rolePageDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -48,12 +52,14 @@ public interface RoleService extends IService<Role> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有角色名
|
* 获取所有角色名
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> getAllRoleNames();
|
List<String> getAllRoleNames();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色名称查看角色权限
|
* 通过角色名称查看角色权限
|
||||||
|
*
|
||||||
* @param roleName
|
* @param roleName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ package com.electromagnetic.industry.software.manage.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.UserRole;
|
import com.electromagnetic.industry.software.manage.pojo.models.UserRole;
|
||||||
|
|
||||||
public interface UserRoleService extends IService<UserRole> {
|
public interface UserRoleService extends IService<UserRole> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ public interface UserService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
*/
|
*/
|
||||||
Boolean resetPassword(String userId);
|
Boolean resetPassword(String userId);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||||
import cn.hutool.core.lang.tree.TreeUtil;
|
import cn.hutool.core.lang.tree.TreeUtil;
|
||||||
import cn.hutool.core.text.StrFormatter;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
@ -42,14 +41,9 @@ import static com.electromagnetic.industry.software.common.cons.ElectromagneticC
|
||||||
@Component
|
@Component
|
||||||
public class CommonService {
|
public class CommonService {
|
||||||
|
|
||||||
private final EleLog log = new EleLog(CommonService.class);
|
|
||||||
private static final Map<String, String> FILE_TYPE_ENUM = new HashMap<>();
|
private static final Map<String, String> FILE_TYPE_ENUM = new HashMap<>();
|
||||||
|
|
||||||
private static final Map<String, String> ID_NAME = new ConcurrentHashMap<>();
|
private static final Map<String, String> ID_NAME = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Value("${prj.folder.max.length}")
|
|
||||||
private int prjFolderMaxLength;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
FILE_TYPE_ENUM.put(EleDataTypeEnum.FOLDER.desc, "01");
|
FILE_TYPE_ENUM.put(EleDataTypeEnum.FOLDER.desc, "01");
|
||||||
FILE_TYPE_ENUM.put("py", "02");
|
FILE_TYPE_ENUM.put("py", "02");
|
||||||
|
|
@ -72,6 +66,9 @@ public class CommonService {
|
||||||
FILE_TYPE_ENUM.put("pptx", "19");
|
FILE_TYPE_ENUM.put("pptx", "19");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final EleLog log = new EleLog(CommonService.class);
|
||||||
|
@Value("${prj.folder.max.length}")
|
||||||
|
private int prjFolderMaxLength;
|
||||||
@Getter
|
@Getter
|
||||||
private String eleDataPath;
|
private String eleDataPath;
|
||||||
|
|
||||||
|
|
@ -167,7 +164,7 @@ public class CommonService {
|
||||||
// 判断文件夹名称是否存在
|
// 判断文件夹名称是否存在
|
||||||
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> edFileInfos = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId, EdFileInfo::getFileName)
|
.select(EdFileInfo::getId, EdFileInfo::getFileName)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getParentId, parentId));
|
.eq(EdFileInfo::getParentId, parentId));
|
||||||
List<String> names = edFileInfos.stream().map(EdFileInfo::getFileName).collect(Collectors.toList());
|
List<String> names = edFileInfos.stream().map(EdFileInfo::getFileName).collect(Collectors.toList());
|
||||||
if (names.contains(folderName)) {
|
if (names.contains(folderName)) {
|
||||||
|
|
@ -258,9 +255,9 @@ public class CommonService {
|
||||||
EdFileInfo fileInfo = edFileInfoMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, id));
|
EdFileInfo fileInfo = edFileInfoMapper.selectOne(Wrappers.<EdFileInfo>lambdaQuery().eq(EdFileInfo::getId, id));
|
||||||
if (fileInfo.getPrjDir()) { // 删除的是层级目录
|
if (fileInfo.getPrjDir()) { // 删除的是层级目录
|
||||||
long count = edFileInfoMapper.selectCount(Wrappers.<EdFileInfo>lambdaQuery()
|
long count = edFileInfoMapper.selectCount(Wrappers.<EdFileInfo>lambdaQuery()
|
||||||
.eq(EdFileInfo::getPrjDir, false)
|
.eq(EdFileInfo::getPrjDir, false)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.like(EdFileInfo::getFilePath, MYSQL_FILE_PATH_SPLIT + id + MYSQL_FILE_PATH_SPLIT));
|
.like(EdFileInfo::getFilePath, MYSQL_FILE_PATH_SPLIT + id + MYSQL_FILE_PATH_SPLIT));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
String info = "禁止删除非空文件夹";
|
String info = "禁止删除非空文件夹";
|
||||||
log.info(info);
|
log.info(info);
|
||||||
|
|
@ -268,15 +265,15 @@ public class CommonService {
|
||||||
} else {
|
} else {
|
||||||
// 先逻辑删除文件夹
|
// 先逻辑删除文件夹
|
||||||
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
edFileInfoMapper.update(null, Wrappers.<EdFileInfo>lambdaUpdate()
|
||||||
.eq(EdFileInfo::getId, id)
|
.eq(EdFileInfo::getId, id)
|
||||||
.set(EdFileInfo::getSort, -1)
|
.set(EdFileInfo::getSort, -1)
|
||||||
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code));
|
||||||
// 层级文件夹重排序
|
// 层级文件夹重排序
|
||||||
List<EdFileInfo> edFileInfos1 = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> edFileInfos1 = edFileInfoMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo::getId, EdFileInfo::getSort)
|
.select(EdFileInfo::getId, EdFileInfo::getSort)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getParentId, parentId)
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
.orderByAsc(EdFileInfo::getSort));
|
.orderByAsc(EdFileInfo::getSort));
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
for (int i = 0; i < edFileInfos1.size(); i++) {
|
for (int i = 0; i < edFileInfos1.size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文件列表
|
* 查询文件列表
|
||||||
|
*
|
||||||
* @param fileInfoQueryDTO
|
* @param fileInfoQueryDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -123,6 +124,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建文件夹
|
* 新建文件夹
|
||||||
|
*
|
||||||
* @param parentId
|
* @param parentId
|
||||||
* @param newFolderName
|
* @param newFolderName
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -135,6 +137,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目层级结构查询
|
* 项目层级结构查询
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -144,6 +147,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除目录
|
* 删除目录
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -163,6 +167,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -179,7 +184,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
headers.add("Pragma", "no-cache");
|
headers.add("Pragma", "no-cache");
|
||||||
headers.add("Expires", "0");
|
headers.add("Expires", "0");
|
||||||
String fileName = Base64.encode(fileSystemResource.getFilename());
|
String fileName = Base64.encode(fileSystemResource.getFilename());
|
||||||
response.setHeader("content-disposition","attachment;filename=" + fileName);
|
response.setHeader("content-disposition", "attachment;filename=" + fileName);
|
||||||
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
||||||
return ResponseEntity
|
return ResponseEntity
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -196,19 +201,32 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新文件信息
|
* 更新文件信息
|
||||||
|
*
|
||||||
* @param updateFileInfoDTO
|
* @param updateFileInfoDTO
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO) {
|
public ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO) {
|
||||||
try {
|
try {
|
||||||
|
// 首先检查新名称是否存在
|
||||||
EdFileInfo fileInfo = this.baseMapper.selectById(updateFileInfoDTO.getId());
|
EdFileInfo fileInfo = this.baseMapper.selectById(updateFileInfoDTO.getId());
|
||||||
|
|
||||||
|
String parentId = fileInfo.getParentId();
|
||||||
|
long count = this.baseMapper.selectCount(Wrappers.<EdFileInfo>lambdaQuery()
|
||||||
|
.select(EdFileInfo::getFileName)
|
||||||
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
|
.eq(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
||||||
|
.eq(EdFileInfo::getFileType, fileInfo.getFileType())
|
||||||
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||||
|
Assert.isTrue(count == 0, "文件名已存在");
|
||||||
|
|
||||||
|
String srcFilePath = commonService.getFileSysPath(fileInfo.getFilePath());
|
||||||
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getId, updateFileInfoDTO.getId())
|
.eq(EdFileInfo::getId, updateFileInfoDTO.getId())
|
||||||
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
.set(EdFileInfo::getFileName, updateFileInfoDTO.getFileName())
|
||||||
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
||||||
String sysFilePath = commonService.getFileSysPath(fileInfo.getFilePath()); // file or folder
|
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
||||||
fileSystemService.renameFile(sysFilePath, updateFileInfoDTO.getFileName());
|
fileSystemService.renameFile(srcFilePath, newName);
|
||||||
return ElectromagneticResultUtil.success(true);
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = "更新文件信息失败。";
|
String info = "更新文件信息失败。";
|
||||||
|
|
@ -246,6 +264,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看分片是否存在
|
* 查看分片是否存在
|
||||||
|
*
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -273,6 +292,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入
|
* 批量导入
|
||||||
|
*
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -303,6 +323,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
* case1: 用户上传的新文件
|
* case1: 用户上传的新文件
|
||||||
* case2: 用户上传的带版本号的文件
|
* case2: 用户上传的带版本号的文件
|
||||||
* case3: 用户上传的文件在线上已经被移动到其他目录
|
* case3: 用户上传的文件在线上已经被移动到其他目录
|
||||||
|
*
|
||||||
* @param identifier
|
* @param identifier
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param totalChunks
|
* @param totalChunks
|
||||||
|
|
@ -317,8 +338,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String parentDir = FileUtil.getParent(destColibPath, 1);
|
String parentDir = FileUtil.getParent(destColibPath, 1);
|
||||||
String zipDirPath = parentDir + File.separator + mainName + ".zip";
|
String zipDirPath = parentDir + File.separator + mainName + ".zip";
|
||||||
AES aes = SecureUtil.aes(password.getBytes());
|
AES aes = SecureUtil.aes(password.getBytes());
|
||||||
try(
|
try (
|
||||||
InputStream inputStream = Files.newInputStream(Paths.get(destColibPath));
|
InputStream inputStream = Files.newInputStream(Paths.get(destColibPath));
|
||||||
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath));
|
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath));
|
||||||
) {
|
) {
|
||||||
aes.decrypt(inputStream, outputStream, true);
|
aes.decrypt(inputStream, outputStream, true);
|
||||||
|
|
@ -354,8 +375,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
if (folderNames.contains(fileName)) { // 有同名文件夹
|
if (folderNames.contains(fileName)) { // 有同名文件夹
|
||||||
// 判断id是否相同
|
// 判断id是否相同
|
||||||
if (foldersMap.get(fileName).getId().equals(edFileInfo.getId())) { // id相同,不做处理
|
if (foldersMap.get(fileName).getId().equals(edFileInfo.getId())) { // id相同,不做处理
|
||||||
log.info("id相同,不做处理");
|
log.info("id相同,不做处理");
|
||||||
} else { // 文件名重复,导入的文件名需要添加“_1”
|
} else { // 文件名重复,导入的文件名需要添加“_1”
|
||||||
edFileInfo.setFileNote(fileName + "_1");
|
edFileInfo.setFileNote(fileName + "_1");
|
||||||
this.baseMapper.insert(edFileInfo);
|
this.baseMapper.insert(edFileInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -476,12 +497,13 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
private List<EdFileInfo> queryChildFolders(String parentId) {
|
private List<EdFileInfo> queryChildFolders(String parentId) {
|
||||||
return this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, parentId)
|
return this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getParentId, parentId)
|
||||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
||||||
.eq(EdFileInfo::getEffectFlag, false));
|
.eq(EdFileInfo::getEffectFlag, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
|
*
|
||||||
* @param dataIdArr
|
* @param dataIdArr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -520,8 +542,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String exportColibFile = downloadDataDir + File.separator + prjName + EXPORT_FILE_SUFFIX;
|
String exportColibFile = downloadDataDir + File.separator + prjName + EXPORT_FILE_SUFFIX;
|
||||||
ZipUtil.zip(downloadDataDir + File.separator + prjName + File.separator + prjName, exportZipFile);
|
ZipUtil.zip(downloadDataDir + File.separator + prjName + File.separator + prjName, exportZipFile);
|
||||||
AES aes = SecureUtil.aes(password.getBytes());
|
AES aes = SecureUtil.aes(password.getBytes());
|
||||||
try(
|
try (
|
||||||
InputStream inputStream = Files.newInputStream(Paths.get(exportZipFile));
|
InputStream inputStream = Files.newInputStream(Paths.get(exportZipFile));
|
||||||
OutputStream outputStream = Files.newOutputStream(Paths.get(exportColibFile));
|
OutputStream outputStream = Files.newOutputStream(Paths.get(exportColibFile));
|
||||||
) {
|
) {
|
||||||
aes.encrypt(inputStream, outputStream, true);
|
aes.encrypt(inputStream, outputStream, true);
|
||||||
|
|
@ -539,7 +561,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String fileName = Base64.encode(fileSystemResource.getFilename());
|
String fileName = Base64.encode(fileSystemResource.getFilename());
|
||||||
headers.add("Pragma", "no-cache");
|
headers.add("Pragma", "no-cache");
|
||||||
headers.add("Expires", "0");
|
headers.add("Expires", "0");
|
||||||
response.setHeader("content-disposition","attachment;filename=" + fileName);
|
response.setHeader("content-disposition", "attachment;filename=" + fileName);
|
||||||
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
// 构建响应实体(可以返回<byte[]或Resource,返回类型取决body入参类型)
|
||||||
return ResponseEntity
|
return ResponseEntity
|
||||||
.ok()
|
.ok()
|
||||||
|
|
@ -551,6 +573,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
|
*
|
||||||
* @param parentId
|
* @param parentId
|
||||||
* @param file
|
* @param file
|
||||||
* @param strategy 1-跳过冲突文件 2-做版本更新 3-重命名,文件名加“_1"
|
* @param strategy 1-跳过冲突文件 2-做版本更新 3-重命名,文件名加“_1"
|
||||||
|
|
@ -569,10 +592,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String suffix = FileUtil.getSuffix(fileName);
|
String suffix = FileUtil.getSuffix(fileName);
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
||||||
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getParentId, parentId)
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
.eq(EdFileInfo::getFileName, mainName)
|
.eq(EdFileInfo::getFileName, mainName)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
.eq(EdFileInfo::getFileType, suffix));
|
.eq(EdFileInfo::getFileType, suffix));
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
handUploadRepeatFile(parentId, file, strategy);
|
handUploadRepeatFile(parentId, file, strategy);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -680,9 +703,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
if (strategy == 2) {
|
if (strategy == 2) {
|
||||||
// 做版本更新
|
// 做版本更新
|
||||||
List<EdFileInfo> sameFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> sameFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.eq(EdFileInfo::getParentId, targetFolderId)
|
.eq(EdFileInfo::getParentId, targetFolderId)
|
||||||
.eq(EdFileInfo::getFileName, srcFileInfo.getFileName())
|
.eq(EdFileInfo::getFileName, srcFileInfo.getFileName())
|
||||||
.eq(EdFileInfo::getFileType, srcFileInfo.getFileType()));
|
.eq(EdFileInfo::getFileType, srcFileInfo.getFileType()));
|
||||||
Integer maxFileVersion = Collections.max(sameFileInfos, Comparator.comparing(EdFileInfo::getFileVersion)).getFileVersion();
|
Integer maxFileVersion = Collections.max(sameFileInfos, Comparator.comparing(EdFileInfo::getFileVersion)).getFileVersion();
|
||||||
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
||||||
String fileTime = EleCommonUtil.getNowTimeStr();
|
String fileTime = EleCommonUtil.getNowTimeStr();
|
||||||
|
|
@ -728,6 +751,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复制文件
|
* 复制文件
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param targetFolderId
|
* @param targetFolderId
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改项目名称
|
* 修改项目名称
|
||||||
|
*
|
||||||
* @param prjId
|
* @param prjId
|
||||||
* @param newPrjName
|
* @param newPrjName
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -163,6 +164,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除一个项目,做逻辑删除
|
* 删除一个项目,做逻辑删除
|
||||||
|
*
|
||||||
* @param prjId
|
* @param prjId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -198,6 +200,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加子集
|
* 添加子集
|
||||||
|
*
|
||||||
* @param parentId
|
* @param parentId
|
||||||
* @param folderName
|
* @param folderName
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -212,6 +215,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有项目
|
* 查询所有项目
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -351,6 +355,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改子集名称
|
* 修改子集名称
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param newFolderName
|
* @param newFolderName
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,11 @@ public class PermissionServiceImpl implements PermissionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户获得角色
|
* 根据用户获得角色
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<String> getRoles (String userId) {
|
private List<String> getRoles(String userId) {
|
||||||
LambdaQueryWrapper<UserRole> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<UserRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.select(UserRole::getRoleId).eq(UserRole::getUserId, userId);
|
queryWrapper.select(UserRole::getRoleId).eq(UserRole::getUserId, userId);
|
||||||
return userRoleMapper.selectObjs(queryWrapper).stream().map(Object::toString).collect(Collectors.toList());
|
return userRoleMapper.selectObjs(queryWrapper).stream().map(Object::toString).collect(Collectors.toList());
|
||||||
|
|
@ -75,6 +76,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得角色权限
|
* 获得角色权限
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @param fileId
|
* @param fileId
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -90,6 +92,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户权限列表 转换为 哈希
|
* 用户权限列表 转换为 哈希
|
||||||
|
*
|
||||||
* @param permissionCodes
|
* @param permissionCodes
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,19 @@ import com.electromagnetic.industry.software.manage.pojo.models.UserRole;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.req.RolePermissionDTO;
|
import com.electromagnetic.industry.software.manage.pojo.req.RolePermissionDTO;
|
||||||
import com.electromagnetic.industry.software.manage.service.*;
|
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.RolePermissionService;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.RoleService;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.UserRoleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
|
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
|
||||||
|
|
@ -49,12 +55,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建角色
|
* 新建角色
|
||||||
|
*
|
||||||
* @param roleDTO
|
* @param roleDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean createRole(RoleDTO roleDTO){
|
public Boolean createRole(RoleDTO roleDTO) {
|
||||||
|
|
||||||
checkRoleNameUnique(roleDTO);
|
checkRoleNameUnique(roleDTO);
|
||||||
|
|
||||||
|
|
@ -80,12 +87,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新角色
|
* 更新角色
|
||||||
|
*
|
||||||
* @param roleDTO
|
* @param roleDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateRole(RoleDTO roleDTO){
|
public Boolean updateRole(RoleDTO roleDTO) {
|
||||||
|
|
||||||
checkRoleNameUnique(roleDTO);
|
checkRoleNameUnique(roleDTO);
|
||||||
|
|
||||||
|
|
@ -113,12 +121,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除角色
|
* 删除角色
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteRole(String roleId){
|
public Boolean deleteRole(String roleId) {
|
||||||
|
|
||||||
// 保留角色权限关联表
|
// 保留角色权限关联表
|
||||||
// 删除用户角色关联表
|
// 删除用户角色关联表
|
||||||
|
|
@ -135,12 +144,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看角色
|
* 查看角色
|
||||||
|
*
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public RoleDTO getRole(String roleId){
|
public RoleDTO getRole(String roleId) {
|
||||||
RoleDTO roleDTO = new RoleDTO();
|
RoleDTO roleDTO = new RoleDTO();
|
||||||
|
|
||||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
@ -180,12 +190,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过角色名查看角色
|
* 通过角色名查看角色
|
||||||
|
*
|
||||||
* @param roleName
|
* @param roleName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public RoleDTO getRoleByName(String roleName){
|
public RoleDTO getRoleByName(String roleName) {
|
||||||
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Role> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(Role::getRoleName, roleName);
|
queryWrapper.eq(Role::getRoleName, roleName);
|
||||||
Role role = this.getOne(queryWrapper);
|
Role role = this.getOne(queryWrapper);
|
||||||
|
|
@ -194,6 +205,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看角色列表
|
* 查看角色列表
|
||||||
|
*
|
||||||
* @param rolePageDTO
|
* @param rolePageDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -205,10 +217,10 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
Page<RoleDTO> page = new Page<>(rolePageDTO.getPageIndex(), rolePageDTO.getPageSize());
|
Page<RoleDTO> page = new Page<>(rolePageDTO.getPageIndex(), rolePageDTO.getPageSize());
|
||||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(rolePageDTO.getRoleId())){
|
if (StringUtils.isNotBlank(rolePageDTO.getRoleId())) {
|
||||||
queryWrapper.eq("r.role_id", rolePageDTO.getRoleId());
|
queryWrapper.eq("r.role_id", rolePageDTO.getRoleId());
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())){
|
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) {
|
||||||
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
|
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
|
||||||
}
|
}
|
||||||
queryWrapper.eq("r.effect_flag", EffectFlagEnum.EFFECT.code);
|
queryWrapper.eq("r.effect_flag", EffectFlagEnum.EFFECT.code);
|
||||||
|
|
@ -218,6 +230,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有角色名
|
* 获取所有角色名
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -242,12 +255,13 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
if (role != null && !role.getRoleId().equals(roleDTO.getRoleId())) {
|
if (role != null && !role.getRoleId().equals(roleDTO.getRoleId())) {
|
||||||
String info = "当前角色名称已存在:" + roleDTO.getRoleName();
|
String info = "当前角色名称已存在:" + roleDTO.getRoleName();
|
||||||
log.error(info);
|
log.error(info);
|
||||||
throw new BizException(-1,info);
|
throw new BizException(-1, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限层级数据扁平化
|
* 权限层级数据扁平化
|
||||||
|
*
|
||||||
* @param nodes
|
* @param nodes
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -267,7 +281,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
flatList.add(new RolePermission(roleId, node.getId(), code));
|
flatList.add(new RolePermission(roleId, node.getId(), code));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 添加当前节点
|
// 添加当前节点
|
||||||
if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
||||||
for (RolePermissionDTO child : node.getChildren()) {
|
for (RolePermissionDTO child : node.getChildren()) {
|
||||||
flattenNode(child, flatList, roleId); // 递归处理子节点
|
flattenNode(child, flatList, roleId); // 递归处理子节点
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.date.SystemClock;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.electromagnetic.industry.software.common.cons.UserConstants;
|
import com.electromagnetic.industry.software.common.cons.UserConstants;
|
||||||
import com.electromagnetic.industry.software.common.enums.ActiveEnum;
|
import com.electromagnetic.industry.software.common.enums.ActiveEnum;
|
||||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||||
|
|
@ -267,10 +266,10 @@ public class UserServiceImpl implements UserService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean bindRoles(UserRoleRequest userRolesRequest) {
|
public Boolean bindRoles(UserRoleRequest userRolesRequest) {
|
||||||
if (userRolesRequest==null || userRolesRequest.getBindData().isEmpty()) {
|
if (userRolesRequest == null || userRolesRequest.getBindData().isEmpty()) {
|
||||||
throw new BizException(HttpStatus.BAD_REQUEST.value(), "请勿发布空数据");
|
throw new BizException(HttpStatus.BAD_REQUEST.value(), "请勿发布空数据");
|
||||||
}
|
}
|
||||||
for (UserBindRoleDTO dto: userRolesRequest.getBindData()) {
|
for (UserBindRoleDTO dto : userRolesRequest.getBindData()) {
|
||||||
activeRole(dto);
|
activeRole(dto);
|
||||||
bindRole(dto);
|
bindRole(dto);
|
||||||
}
|
}
|
||||||
|
|
@ -279,6 +278,7 @@ public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -286,10 +286,10 @@ public class UserServiceImpl implements UserService {
|
||||||
public Boolean resetPassword(String userId) {
|
public Boolean resetPassword(String userId) {
|
||||||
User user = userMapper.getSingleUser(userId);
|
User user = userMapper.getSingleUser(userId);
|
||||||
user.setUserPwd(SignUtils.MD5(UserConstants.DEFAULT_PASSWORD + user.getSalt()));
|
user.setUserPwd(SignUtils.MD5(UserConstants.DEFAULT_PASSWORD + user.getSalt()));
|
||||||
return userMapper.modify(user)>0;
|
return userMapper.modify(user) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void activeRole (UserBindRoleDTO dto) {
|
private void activeRole(UserBindRoleDTO dto) {
|
||||||
User user = userMapper.getSingleUser(dto.getUserId());
|
User user = userMapper.getSingleUser(dto.getUserId());
|
||||||
if (user.getIsActivated().equals(ActiveEnum.UNACTIVATED.getCode())) {
|
if (user.getIsActivated().equals(ActiveEnum.UNACTIVATED.getCode())) {
|
||||||
user.setIsActivated(ActiveEnum.ACTIVATED.getCode());
|
user.setIsActivated(ActiveEnum.ACTIVATED.getCode());
|
||||||
|
|
@ -297,7 +297,7 @@ public class UserServiceImpl implements UserService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindRole (UserBindRoleDTO dto) {
|
private void bindRole(UserBindRoleDTO dto) {
|
||||||
String userId = dto.getUserId();
|
String userId = dto.getUserId();
|
||||||
List<String> roleNames = dto.getRoleList();
|
List<String> roleNames = dto.getRoleList();
|
||||||
// 删除当前用户原绑定角色
|
// 删除当前用户原绑定角色
|
||||||
|
|
|
||||||
|
|
@ -253,10 +253,12 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectUserRoles" parameterType="String" resultType="String">
|
<select id="selectUserRoles" parameterType="String" resultType="String">
|
||||||
select r.role_name from ed_role r where r.role_id in (
|
select r.role_name
|
||||||
select ur.role_id from ed_users u
|
from ed_role r
|
||||||
left join ed_user_role ur on u.user_id = ur.user_id
|
where r.role_id in (select ur.role_id
|
||||||
where u.user_id = #{userId})
|
from ed_users u
|
||||||
|
left join ed_user_role ur on u.user_id = ur.user_id
|
||||||
|
where u.user_id = #{userId})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue