文件管理
This commit is contained in:
parent
3388d64fcd
commit
489397fee3
@ -9,6 +9,15 @@ export function listFiles(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询文件管理列表
|
||||||
|
export function listFilesByRole(query) {
|
||||||
|
return request({
|
||||||
|
url: '/benyi/files/listbyrole',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询文件管理详细
|
// 查询文件管理详细
|
||||||
export function getFiles(id) {
|
export function getFiles(id) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listFiles, getFiles } from "@/api/benyi/files";
|
import { listFilesByRole, getFiles } from "@/api/benyi/files";
|
||||||
|
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ export default {
|
|||||||
/** 查询文件管理列表 */
|
/** 查询文件管理列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listFiles(this.queryParams).then((response) => {
|
listFilesByRole(this.queryParams).then((response) => {
|
||||||
this.filesList = response.rows;
|
this.filesList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="文件名称" prop="name">
|
<el-form-item label="文件名称" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
@ -11,7 +16,12 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="所属类型" prop="type">
|
<el-form-item label="所属类型" prop="type">
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择文件所属类型" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择文件所属类型"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in typeOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -21,8 +31,16 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -34,7 +52,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['benyi:files:add']"
|
v-hasPermi="['benyi:files:add']"
|
||||||
>新增</el-button>
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -44,7 +63,8 @@
|
|||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['benyi:files:edit']"
|
v-hasPermi="['benyi:files:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -54,17 +74,37 @@
|
|||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['benyi:files:remove']"
|
v-hasPermi="['benyi:files:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="filesList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="filesList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="编号" align="center" prop="id" />
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
<el-table-column label="文件名称" align="center" prop="name" />
|
<el-table-column label="文件名称" align="center" prop="name" />
|
||||||
<el-table-column label="文件类型" align="center" prop="filetype" />
|
<el-table-column label="文件类型" align="center" prop="filetype" />
|
||||||
<el-table-column label="文件所属类型" align="center" prop="type" :formatter="typeFormat" />
|
<el-table-column
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
label="文件所属类型"
|
||||||
|
align="center"
|
||||||
|
prop="type"
|
||||||
|
:formatter="typeFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="适用角色"
|
||||||
|
align="center"
|
||||||
|
:formatter="rolesFormat"
|
||||||
|
prop="roles"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -72,20 +112,22 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['benyi:files:edit']"
|
v-hasPermi="['benyi:files:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['benyi:files:remove']"
|
v-hasPermi="['benyi:files:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total > 0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@ -125,6 +167,21 @@
|
|||||||
<el-button size="small" type="primary">选择文件</el-button>
|
<el-button size="small" type="primary">选择文件</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="适用角色" prop="roles">
|
||||||
|
<el-select
|
||||||
|
v-model="form.roles"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择适用角色"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in rolesOptions"
|
||||||
|
:key="dict.roleId"
|
||||||
|
:label="dict.roleName"
|
||||||
|
:value="dict.roleId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
@ -142,6 +199,7 @@ import {
|
|||||||
addFiles,
|
addFiles,
|
||||||
updateFiles,
|
updateFiles,
|
||||||
} from "@/api/benyi/files";
|
} from "@/api/benyi/files";
|
||||||
|
import { listRole } from "@/api/system/role";
|
||||||
|
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
@ -162,6 +220,8 @@ export default {
|
|||||||
// 文件管理表格数据
|
// 文件管理表格数据
|
||||||
filesList: [],
|
filesList: [],
|
||||||
fileList: [],
|
fileList: [],
|
||||||
|
//角色
|
||||||
|
rolesOptions: [],
|
||||||
//文件类型
|
//文件类型
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||||
@ -182,6 +242,9 @@ export default {
|
|||||||
fileurl: undefined,
|
fileurl: undefined,
|
||||||
createuserid: undefined,
|
createuserid: undefined,
|
||||||
},
|
},
|
||||||
|
queryParams_roles: {
|
||||||
|
roleKey: "school",
|
||||||
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
@ -203,6 +266,39 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getRoles() {
|
||||||
|
listRole(this.queryParams_roles).then((response) => {
|
||||||
|
this.rolesOptions = response.rows;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 适用role--字典状态字典翻译
|
||||||
|
rolesFormat(row, column) {
|
||||||
|
//alert(row.scope.split(';').length);
|
||||||
|
if (row.roles == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var ilength = row.roles.split(";").length;
|
||||||
|
var names = "";
|
||||||
|
for (var i = 0; i < ilength - 1; i++) {
|
||||||
|
names =
|
||||||
|
names +
|
||||||
|
this.selectRolesLabel(this.rolesOptions, row.roles.split(";")[i]) +
|
||||||
|
";";
|
||||||
|
}
|
||||||
|
//this.selectDictLabel(this.scopeOptions, row.xnxq);
|
||||||
|
return names;
|
||||||
|
},
|
||||||
|
// 回显数据字典
|
||||||
|
selectRolesLabel(datas, value) {
|
||||||
|
var actions = [];
|
||||||
|
Object.keys(datas).map((key) => {
|
||||||
|
if (datas[key].roleId == "" + value) {
|
||||||
|
actions.push(datas[key].roleName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return actions.join("");
|
||||||
|
},
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
//console.log(res);
|
//console.log(res);
|
||||||
if (res.code == "200") {
|
if (res.code == "200") {
|
||||||
@ -243,6 +339,7 @@ export default {
|
|||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
this.getRoles();
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -290,7 +387,15 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids;
|
||||||
getFiles(id).then((response) => {
|
getFiles(id).then((response) => {
|
||||||
|
console.log(response);
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
var roleArr = [];
|
||||||
|
if (response.roles != null) {
|
||||||
|
response.roles.forEach((element) => {
|
||||||
|
roleArr.push(parseInt(element));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.form.roles = roleArr;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改文件管理";
|
this.title = "修改文件管理";
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
@ -303,6 +408,8 @@ export default {
|
|||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
var arrscope = this.form.roles;
|
||||||
|
this.form.roles = arrscope.join(";") + ";";
|
||||||
if (this.form.id != undefined) {
|
if (this.form.id != undefined) {
|
||||||
updateFiles(this.form).then((response) => {
|
updateFiles(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
border
|
border
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="userList"
|
:data="userList"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<el-table-column type="selection" width="40" align="center" />
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
<!-- <el-table-column label="用户编号" align="center" prop="userId" /> -->
|
<!-- <el-table-column label="用户编号" align="center" prop="userId" /> -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
fixed
|
fixed
|
||||||
label="登录账号"
|
label="登录账号"
|
||||||
align="center"
|
align="center"
|
||||||
prop="userName"
|
prop="userName"
|
||||||
@ -188,7 +188,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
fixed="right"
|
fixed="right"
|
||||||
label="操作"
|
label="操作"
|
||||||
align="center"
|
align="center"
|
||||||
width="60"
|
width="60"
|
||||||
@ -289,8 +289,8 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-select v-model="form.status" placeholder="请选择">
|
<el-select v-model="form.status" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in statusOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
|
@ -3,6 +3,8 @@ package com.ruoyi.project.benyi.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.project.common.SchoolCommon;
|
||||||
|
import com.ruoyi.project.system.domain.SysRole;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -33,14 +35,37 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
|||||||
public class ByFilesController extends BaseController {
|
public class ByFilesController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IByFilesService byFilesService;
|
private IByFilesService byFilesService;
|
||||||
|
@Autowired
|
||||||
|
private SchoolCommon schoolCommon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文件管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('benyi:files:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ByFiles byFiles) {
|
||||||
|
startPage();
|
||||||
|
List<ByFiles> list = byFilesService.selectByFilesList(byFiles);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文件管理列表
|
* 查询文件管理列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('benyi:files:list')")
|
@PreAuthorize("@ss.hasPermi('benyi:files:list')")
|
||||||
@Log(title = "查询文件", businessType = BusinessType.QUERY)
|
@Log(title = "查询文件", businessType = BusinessType.QUERY)
|
||||||
@GetMapping("/list")
|
@GetMapping("/listbyrole")
|
||||||
public TableDataInfo list(ByFiles byFiles) {
|
public TableDataInfo listbyrole(ByFiles byFiles) {
|
||||||
|
|
||||||
|
String strRoles = "";
|
||||||
|
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
|
||||||
|
System.out.println(roles.size());
|
||||||
|
if (roles != null && roles.size() > 0) {
|
||||||
|
for (int i = 0; i < roles.size(); i++) {
|
||||||
|
strRoles = strRoles + roles.get(i).getRoleId() + ";";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
byFiles.setRoles(strRoles);
|
||||||
startPage();
|
startPage();
|
||||||
List<ByFiles> list = byFilesService.selectByFilesList(byFiles);
|
List<ByFiles> list = byFilesService.selectByFilesList(byFiles);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@ -64,7 +89,15 @@ public class ByFilesController extends BaseController {
|
|||||||
@PreAuthorize("@ss.hasPermi('benyi:files:query')")
|
@PreAuthorize("@ss.hasPermi('benyi:files:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
return AjaxResult.success(byFilesService.selectByFilesById(id));
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ByFiles byFiles = byFilesService.selectByFilesById(id);
|
||||||
|
ajax.put(AjaxResult.DATA_TAG, byFiles);
|
||||||
|
if (!schoolCommon.isStringEmpty(byFiles.getRoles())) {
|
||||||
|
ajax.put("roles", byFiles.getRoles().split(";"));
|
||||||
|
} else {
|
||||||
|
ajax.put("roles", null);
|
||||||
|
}
|
||||||
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,6 +49,22 @@ public class ByFiles extends BaseEntity {
|
|||||||
@Excel(name = "创建人")
|
@Excel(name = "创建人")
|
||||||
private Long createuserid;
|
private Long createuserid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适用角色
|
||||||
|
*/
|
||||||
|
@Excel(name = "适用角色")
|
||||||
|
private String roles;
|
||||||
|
|
||||||
|
public String[] getRoleArr() {
|
||||||
|
return roleArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleArr(String[] roleArr) {
|
||||||
|
this.roleArr = roleArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] roleArr;
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -97,6 +113,14 @@ public class ByFiles extends BaseEntity {
|
|||||||
return createuserid;
|
return createuserid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRoles(String roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -107,6 +131,8 @@ public class ByFiles extends BaseEntity {
|
|||||||
.append("fileurl", getFileurl())
|
.append("fileurl", getFileurl())
|
||||||
.append("createuserid", getCreateuserid())
|
.append("createuserid", getCreateuserid())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
|
.append("roles", getRoles())
|
||||||
|
.append("roleArr", getRoleArr())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,13 @@ public class ByFilesServiceImpl implements IByFilesService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ByFiles> selectByFilesList(ByFiles byFiles) {
|
public List<ByFiles> selectByFilesList(ByFiles byFiles) {
|
||||||
|
if (byFiles.getRoles() == null || "".equals(byFiles.getRoles())) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
String strArr = byFiles.getRoles();
|
||||||
|
byFiles.setRoleArr(strArr.split(";"));
|
||||||
|
}
|
||||||
|
|
||||||
return byFilesMapper.selectByFilesList(byFiles);
|
return byFilesMapper.selectByFilesList(byFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,20 +12,29 @@
|
|||||||
<result property="fileurl" column="fileurl"/>
|
<result property="fileurl" column="fileurl"/>
|
||||||
<result property="createuserid" column="createuserid"/>
|
<result property="createuserid" column="createuserid"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="roles" column="roles"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectByFilesVo">
|
<sql id="selectByFilesVo">
|
||||||
select id, name, filetype, type, fileurl, createuserid, create_time from by_files
|
select id, name, filetype, type, fileurl, createuserid, create_time, roles from by_files
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectByFilesList" parameterType="ByFiles" resultMap="ByFilesResult">
|
<select id="selectByFilesList" parameterType="ByFiles" resultMap="ByFilesResult">
|
||||||
<include refid="selectByFilesVo"/>
|
<include refid="selectByFilesVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
and 1=1
|
||||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||||
<if test="filetype != null and filetype != ''">and filetype = #{filetype}</if>
|
<if test="filetype != null and filetype != ''">and filetype = #{filetype}</if>
|
||||||
<if test="type != null and type != ''">and type = #{type}</if>
|
<if test="type != null and type != ''">and type = #{type}</if>
|
||||||
<if test="fileurl != null and fileurl != ''">and fileurl = #{fileurl}</if>
|
<if test="fileurl != null and fileurl != ''">and fileurl = #{fileurl}</if>
|
||||||
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
|
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
|
||||||
|
<if test="roles != null and roles != ''">
|
||||||
|
and (
|
||||||
|
<foreach collection="roleArr" item="item" index="index" separator=" or ">
|
||||||
|
roles like concat('%', #{item}, '%')
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by type
|
order by type
|
||||||
</select>
|
</select>
|
||||||
@ -44,6 +53,7 @@
|
|||||||
<if test="fileurl != null and fileurl != ''">fileurl,</if>
|
<if test="fileurl != null and fileurl != ''">fileurl,</if>
|
||||||
<if test="createuserid != null ">createuserid,</if>
|
<if test="createuserid != null ">createuserid,</if>
|
||||||
<if test="createTime != null ">create_time,</if>
|
<if test="createTime != null ">create_time,</if>
|
||||||
|
<if test="roles != null and roles != ''">roles,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
@ -52,6 +62,7 @@
|
|||||||
<if test="fileurl != null and fileurl != ''">#{fileurl},</if>
|
<if test="fileurl != null and fileurl != ''">#{fileurl},</if>
|
||||||
<if test="createuserid != null ">#{createuserid},</if>
|
<if test="createuserid != null ">#{createuserid},</if>
|
||||||
<if test="createTime != null ">#{createTime},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
||||||
|
<if test="roles != null and roles != ''">#{roles},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -64,6 +75,7 @@
|
|||||||
<if test="fileurl != null and fileurl != ''">fileurl = #{fileurl},</if>
|
<if test="fileurl != null and fileurl != ''">fileurl = #{fileurl},</if>
|
||||||
<if test="createuserid != null ">createuserid = #{createuserid},</if>
|
<if test="createuserid != null ">createuserid = #{createuserid},</if>
|
||||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||||
|
<if test="roles != null and roles != ''">roles = #{roles},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user