commit
b369889400
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -15,6 +17,7 @@ import com.ruoyi.common.config.RuoYiConfig;
|
|||
import com.ruoyi.common.config.ServerConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.FileInfo;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
|
|
@ -65,7 +68,7 @@ public class CommonController
|
|||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/common/upload")
|
||||
@ResponseBody
|
||||
|
|
@ -89,6 +92,33 @@ public class CommonController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/common/uploads")
|
||||
@ResponseBody
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<FileInfo> fileInfos = new LinkedList<FileInfo>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
fileInfos.add(new FileInfo(fileName, url));
|
||||
}
|
||||
return AjaxResult.success(fileInfos);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ public class SysRoleController extends BaseController
|
|||
/**
|
||||
* 取消授权
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancel")
|
||||
@ResponseBody
|
||||
|
|
@ -254,6 +255,7 @@ public class SysRoleController extends BaseController
|
|||
/**
|
||||
* 批量取消授权
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancelAll")
|
||||
@ResponseBody
|
||||
|
|
@ -288,6 +290,7 @@ public class SysRoleController extends BaseController
|
|||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/selectAll")
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public class SysUserController extends BaseController
|
|||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authRole/insertAuthRole")
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -3136,4 +3136,3 @@
|
|||
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=bootstrap-select.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,4 @@
|
|||
(function($) {
|
||||
(function ($) {
|
||||
$.extend($.summernote.lang, {
|
||||
'zh-CN': {
|
||||
font: {
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
strikethrough: '删除线',
|
||||
subscript: '下标',
|
||||
superscript: '上标',
|
||||
size: '字号',
|
||||
size: '字号'
|
||||
},
|
||||
image: {
|
||||
image: '图片',
|
||||
|
|
@ -33,14 +33,14 @@
|
|||
maximumFileSizeError: '文件大小超出最大值。',
|
||||
url: '图片地址',
|
||||
remove: '移除图片',
|
||||
original: '原始图片',
|
||||
original: '原始图片'
|
||||
},
|
||||
video: {
|
||||
video: '视频',
|
||||
videoLink: '视频链接',
|
||||
insert: '插入视频',
|
||||
url: '视频地址',
|
||||
providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)',
|
||||
providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)'
|
||||
},
|
||||
link: {
|
||||
link: '链接',
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
edit: '编辑链接',
|
||||
textToDisplay: '显示文本',
|
||||
url: '链接地址',
|
||||
openInNewWindow: '在新窗口打开',
|
||||
openInNewWindow: '在新窗口打开'
|
||||
},
|
||||
table: {
|
||||
table: '表格',
|
||||
|
|
@ -59,10 +59,10 @@
|
|||
addColRight: '在右侧插入列',
|
||||
delRow: '删除行',
|
||||
delCol: '删除列',
|
||||
delTable: '删除表格',
|
||||
delTable: '删除表格'
|
||||
},
|
||||
hr: {
|
||||
insert: '水平线',
|
||||
insert: '水平线'
|
||||
},
|
||||
style: {
|
||||
style: '样式',
|
||||
|
|
@ -74,16 +74,16 @@
|
|||
h3: '标题 3',
|
||||
h4: '标题 4',
|
||||
h5: '标题 5',
|
||||
h6: '标题 6',
|
||||
h6: '标题 6'
|
||||
},
|
||||
lists: {
|
||||
unordered: '无序列表',
|
||||
ordered: '有序列表',
|
||||
ordered: '有序列表'
|
||||
},
|
||||
options: {
|
||||
help: '帮助',
|
||||
fullscreen: '全屏',
|
||||
codeview: '源代码',
|
||||
codeview: '源代码'
|
||||
},
|
||||
paragraph: {
|
||||
paragraph: '段落',
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
left: '左对齐',
|
||||
center: '居中对齐',
|
||||
right: '右对齐',
|
||||
justify: '两端对齐',
|
||||
justify: '两端对齐'
|
||||
},
|
||||
color: {
|
||||
recent: '最近使用',
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
transparent: '透明',
|
||||
setTransparent: '透明',
|
||||
reset: '重置',
|
||||
resetToDefault: '默认',
|
||||
resetToDefault: '默认'
|
||||
},
|
||||
shortcut: {
|
||||
shortcuts: '快捷键',
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
action: '动作',
|
||||
paragraphFormatting: '段落格式',
|
||||
documentStyle: '文档样式',
|
||||
extraKeys: '额外按键',
|
||||
extraKeys: '额外按键'
|
||||
},
|
||||
help: {
|
||||
insertParagraph: '插入段落',
|
||||
|
|
@ -140,16 +140,16 @@
|
|||
formatH5: '设置选中内容样式为 标题5',
|
||||
formatH6: '设置选中内容样式为 标题6',
|
||||
insertHorizontalRule: '插入水平线',
|
||||
'linkDialog.show': '显示链接对话框',
|
||||
'linkDialog.show': '显示链接对话框'
|
||||
},
|
||||
history: {
|
||||
undo: '撤销',
|
||||
redo: '重做',
|
||||
redo: '重做'
|
||||
},
|
||||
specialChar: {
|
||||
specialChar: '特殊字符',
|
||||
select: '选取特殊字符',
|
||||
},
|
||||
},
|
||||
select: '选取特殊字符'
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -14,16 +14,16 @@
|
|||
</div>
|
||||
<div class="ibox-content">
|
||||
<div class="form-group">
|
||||
<label class="font-noraml">简单示例</label>
|
||||
<label class="font-noraml">单文件上传</label>
|
||||
<div class="file-loading">
|
||||
<input class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
|
||||
<input id="singleFile" name="file" type="file">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="font-noraml">多文件上传</label>
|
||||
<div class="file-loading">
|
||||
<input id="fileinput-demo-1" type="file" multiple>
|
||||
<input id="multipleFile" name="files" type="file" multiple>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
|
@ -38,25 +38,36 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-js" />
|
||||
<script type="text/javascript">
|
||||
<script th:inline="javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#fileinput-demo-1").fileinput({
|
||||
'theme': 'explorer-fas',
|
||||
'uploadUrl': '#',
|
||||
overwriteInitial: false,
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: [
|
||||
"/img/profile.jpg"
|
||||
]
|
||||
});
|
||||
|
||||
$("#fileinput-demo-1").on("fileuploaded", function(event, data, proviewId, index) {
|
||||
console.info(event);
|
||||
console.info(data);
|
||||
console.info(proviewId);
|
||||
console.info(index);
|
||||
});
|
||||
// 单图上传
|
||||
$("#singleFile").fileinput({
|
||||
uploadUrl: ctx + 'common/upload',
|
||||
maxFileCount: 1,
|
||||
autoReplace: true
|
||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||
var rsp = data.response;
|
||||
log.info("return url:" + rsp.url)
|
||||
log.info("reutrn fileName:" + rsp.fileName)
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
|
||||
// 多图上传
|
||||
$("#multipleFile").fileinput({
|
||||
uploadUrl: ctx + 'common/uploads',
|
||||
uploadAsync: false
|
||||
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
|
||||
var rsp = data.response;
|
||||
var fileJson = rsp.data;
|
||||
for (var i in fileJson) {
|
||||
log.info("return data.url:" + fileJson[i].url)
|
||||
log.info("reutrn data.name:" + fileJson[i].name)
|
||||
}
|
||||
}).on('fileremoved', function (event, id, index) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@
|
|||
<!-- summernote富文本编辑器插件 -->
|
||||
<div th:fragment="summernote-css">
|
||||
<link th:href="@{/ajax/libs/summernote/summernote.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/summernote/summernote-bs3.css}" rel="stylesheet"/>
|
||||
</div>
|
||||
<div th:fragment="summernote-js">
|
||||
<script th:src="@{/ajax/libs/summernote/summernote.min.js}"></script>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
height : 192,
|
||||
lang : 'zh-CN',
|
||||
followingToolbar: false,
|
||||
dialogsInBody: true,
|
||||
callbacks: {
|
||||
onImageUpload: function (files) {
|
||||
sendFile(files[0], this);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.common.core.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class FileInfo
|
||||
{
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
public FileInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FileInfo(String name, String url)
|
||||
{
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("url", getUrl())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public interface ISysRoleService
|
|||
public List<SysRole> selectRoleList(SysRole role);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
* 根据用户ID查询角色列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
|
|
@ -29,7 +29,7 @@ public interface ISysRoleService
|
|||
public Set<String> selectRoleKeys(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
* 根据用户ID查询角色权限
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
* @param roleIds 角色组
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void insertUserAuth(Long userId, Long[] roleIds)
|
||||
{
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
|
|
@ -286,7 +287,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
* @param user 用户对象
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
public void insertUserRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue