20200407-lc-1
This commit is contained in:
parent
64a6caf923
commit
d56ad93516
@ -1,319 +1,339 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :inline="true">
|
<el-form :inline="true">
|
||||||
<el-form-item label="部门名称">
|
<el-form-item label="部门名称">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.deptName"
|
v-model="queryParams.deptName"
|
||||||
placeholder="请输入部门名称"
|
placeholder="请输入部门名称"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small">
|
||||||
<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"
|
||||||
:value="dict.dictValue"
|
:value="dict.dictValue"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleQuery"
|
@click="handleQuery"
|
||||||
>搜索</el-button>
|
>搜索</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['system:dept:add']"
|
v-hasPermi="['system:dept:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="deptList"
|
:data="deptList"
|
||||||
row-key="deptId"
|
row-key="deptId"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
||||||
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
|
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<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"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:dept:edit']"
|
v-hasPermi="['system:dept:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="handleAdd(scope.row)"
|
@click="handleAdd(scope.row)"
|
||||||
v-hasPermi="['system:dept:add']"
|
v-hasPermi="['system:dept:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.parentId != 0"
|
v-if="scope.row.parentId != 0"
|
||||||
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="['system:dept:remove']"
|
v-hasPermi="['system:dept:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加或修改部门对话框 -->
|
<!-- 添加或修改部门对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="600px">
|
<el-dialog :title="title" :visible.sync="open" width="600px">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24" v-if="form.parentId !== 0">
|
<el-col :span="24" v-if="form.parentId !== 0">
|
||||||
<el-form-item label="上级部门" prop="parentId">
|
<el-form-item label="上级部门" prop="parentId">
|
||||||
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
|
<treeselect
|
||||||
</el-form-item>
|
v-model="form.parentId"
|
||||||
</el-col>
|
:options="deptOptions"
|
||||||
<el-col :span="12">
|
:normalizer="normalizer"
|
||||||
<el-form-item label="部门名称" prop="deptName">
|
placeholder="选择上级部门"
|
||||||
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
|
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="负责人" prop="leader">
|
<el-form-item label="显示排序" prop="orderNum">
|
||||||
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
|
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="联系电话" prop="phone">
|
<el-form-item label="负责人" prop="leader">
|
||||||
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
|
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="邮箱" prop="email">
|
<el-form-item label="联系电话" prop="phone">
|
||||||
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
|
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="部门状态">
|
<el-form-item label="邮箱" prop="email">
|
||||||
<el-radio-group v-model="form.status">
|
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
|
||||||
<el-radio
|
</el-form-item>
|
||||||
v-for="dict in statusOptions"
|
</el-col>
|
||||||
:key="dict.dictValue"
|
<el-col :span="12">
|
||||||
:label="dict.dictValue"
|
<el-form-item label="部门状态">
|
||||||
>{{dict.dictLabel}}</el-radio>
|
<el-radio-group v-model="form.status">
|
||||||
</el-radio-group>
|
<el-radio
|
||||||
</el-form-item>
|
v-for="dict in statusOptions"
|
||||||
</el-col>
|
:key="dict.dictValue"
|
||||||
</el-row>
|
:label="dict.dictValue"
|
||||||
</el-form>
|
>{{dict.dictLabel}}</el-radio>
|
||||||
<div slot="footer" class="dialog-footer">
|
</el-radio-group>
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
</el-form-item>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
</el-col>
|
||||||
</div>
|
</el-row>
|
||||||
</el-dialog>
|
</el-form>
|
||||||
</div>
|
<div slot="footer" class="dialog-footer">
|
||||||
</template>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
<script>
|
</div>
|
||||||
import { listDept, getDept, delDept, addDept, updateDept } from "@/api/system/dept";
|
</el-dialog>
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
</div>
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
</template>
|
||||||
|
|
||||||
export default {
|
<script>
|
||||||
name: "Dept",
|
import {
|
||||||
components: { Treeselect },
|
listDept,
|
||||||
data() {
|
getDept,
|
||||||
return {
|
delDept,
|
||||||
// 遮罩层
|
addDept,
|
||||||
loading: true,
|
updateDept
|
||||||
// 表格树数据
|
} from "@/api/system/dept";
|
||||||
deptList: [],
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
// 部门树选项
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
deptOptions: [],
|
|
||||||
// 弹出层标题
|
export default {
|
||||||
title: "",
|
name: "Dept",
|
||||||
// 是否显示弹出层
|
components: { Treeselect },
|
||||||
open: false,
|
data() {
|
||||||
// 状态数据字典
|
return {
|
||||||
statusOptions: [],
|
// 遮罩层
|
||||||
// 查询参数
|
loading: true,
|
||||||
queryParams: {
|
// 表格树数据
|
||||||
deptName: undefined,
|
deptList: [],
|
||||||
status: undefined
|
// 部门树选项
|
||||||
},
|
deptOptions: [],
|
||||||
// 表单参数
|
// 弹出层标题
|
||||||
form: {},
|
title: "",
|
||||||
// 表单校验
|
// 是否显示弹出层
|
||||||
rules: {
|
open: false,
|
||||||
parentId: [
|
// 状态数据字典
|
||||||
{ required: true, message: "上级部门不能为空", trigger: "blur" }
|
statusOptions: [],
|
||||||
],
|
// 查询参数
|
||||||
deptName: [
|
queryParams: {
|
||||||
{ required: true, message: "部门名称不能为空", trigger: "blur" }
|
deptName: undefined,
|
||||||
],
|
status: undefined,
|
||||||
orderNum: [
|
schoolId: undefined
|
||||||
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
},
|
||||||
],
|
// 表单参数
|
||||||
email: [
|
form: {},
|
||||||
{
|
// 表单校验
|
||||||
type: "email",
|
rules: {
|
||||||
message: "'请输入正确的邮箱地址",
|
parentId: [
|
||||||
trigger: ["blur", "change"]
|
{ required: true, message: "上级部门不能为空", trigger: "blur" }
|
||||||
}
|
],
|
||||||
],
|
deptName: [
|
||||||
phone: [
|
{ required: true, message: "部门名称不能为空", trigger: "blur" }
|
||||||
{
|
],
|
||||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
orderNum: [
|
||||||
message: "请输入正确的手机号码",
|
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
||||||
trigger: "blur"
|
],
|
||||||
}
|
email: [
|
||||||
]
|
{
|
||||||
}
|
type: "email",
|
||||||
};
|
message: "'请输入正确的邮箱地址",
|
||||||
},
|
trigger: ["blur", "change"]
|
||||||
created() {
|
}
|
||||||
this.getList();
|
],
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
phone: [
|
||||||
this.statusOptions = response.data;
|
{
|
||||||
});
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||||
},
|
message: "请输入正确的手机号码",
|
||||||
methods: {
|
trigger: "blur"
|
||||||
/** 查询部门列表 */
|
}
|
||||||
getList() {
|
]
|
||||||
this.loading = true;
|
}
|
||||||
listDept(this.queryParams).then(response => {
|
};
|
||||||
this.deptList = this.handleTree(response.data, "deptId");
|
},
|
||||||
this.loading = false;
|
created() {
|
||||||
});
|
this.getList();
|
||||||
},
|
this.getDicts("sys_normal_disable").then(response => {
|
||||||
/** 转换部门数据结构 */
|
this.statusOptions = response.data;
|
||||||
normalizer(node) {
|
});
|
||||||
if (node.children && !node.children.length) {
|
},
|
||||||
delete node.children;
|
methods: {
|
||||||
}
|
/** 查询部门列表 */
|
||||||
return {
|
getList() {
|
||||||
id: node.deptId,
|
this.loading = true;
|
||||||
label: node.deptName,
|
listDept(this.queryParams).then(response => {
|
||||||
children: node.children
|
this.deptList = this.handleTree(response.data, "deptId");
|
||||||
};
|
this.loading = false;
|
||||||
},
|
});
|
||||||
/** 查询部门下拉树结构 */
|
},
|
||||||
getTreeselect() {
|
/** 转换部门数据结构 */
|
||||||
listDept().then(response => {
|
normalizer(node) {
|
||||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
if (node.children && !node.children.length) {
|
||||||
});
|
delete node.children;
|
||||||
},
|
}
|
||||||
// 字典状态字典翻译
|
return {
|
||||||
statusFormat(row, column) {
|
id: node.deptId,
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
label: node.deptName,
|
||||||
},
|
children: node.children
|
||||||
// 取消按钮
|
};
|
||||||
cancel() {
|
},
|
||||||
this.open = false;
|
/** 查询部门下拉树结构 */
|
||||||
this.reset();
|
getTreeselect() {
|
||||||
},
|
listDept().then(response => {
|
||||||
// 表单重置
|
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||||
reset() {
|
});
|
||||||
this.form = {
|
},
|
||||||
deptId: undefined,
|
// 字典状态字典翻译
|
||||||
parentId: undefined,
|
statusFormat(row, column) {
|
||||||
deptName: undefined,
|
return this.selectDictLabel(this.statusOptions, row.status);
|
||||||
orderNum: undefined,
|
},
|
||||||
leader: undefined,
|
// 取消按钮
|
||||||
phone: undefined,
|
cancel() {
|
||||||
email: undefined,
|
this.open = false;
|
||||||
status: "0"
|
this.reset();
|
||||||
};
|
},
|
||||||
this.resetForm("form");
|
// 表单重置
|
||||||
},
|
reset() {
|
||||||
/** 搜索按钮操作 */
|
this.form = {
|
||||||
handleQuery() {
|
deptId: undefined,
|
||||||
this.getList();
|
parentId: undefined,
|
||||||
},
|
deptName: undefined,
|
||||||
/** 新增按钮操作 */
|
orderNum: undefined,
|
||||||
handleAdd(row) {
|
leader: undefined,
|
||||||
this.reset();
|
phone: undefined,
|
||||||
this.getTreeselect();
|
email: undefined,
|
||||||
if (row != undefined) {
|
status: "0",
|
||||||
this.form.parentId = row.deptId;
|
schoolId: undefined
|
||||||
}
|
};
|
||||||
this.open = true;
|
this.resetForm("form");
|
||||||
this.title = "添加部门";
|
},
|
||||||
},
|
/** 搜索按钮操作 */
|
||||||
/** 修改按钮操作 */
|
handleQuery() {
|
||||||
handleUpdate(row) {
|
this.getList();
|
||||||
this.reset();
|
},
|
||||||
this.getTreeselect();
|
/** 新增按钮操作 */
|
||||||
getDept(row.deptId).then(response => {
|
handleAdd(row) {
|
||||||
this.form = response.data;
|
this.reset();
|
||||||
this.open = true;
|
this.getTreeselect();
|
||||||
this.title = "修改部门";
|
if (row != undefined) {
|
||||||
});
|
this.form.parentId = row.deptId;
|
||||||
},
|
}
|
||||||
/** 提交按钮 */
|
this.open = true;
|
||||||
submitForm: function() {
|
this.title = "添加部门";
|
||||||
this.$refs["form"].validate(valid => {
|
},
|
||||||
if (valid) {
|
/** 修改按钮操作 */
|
||||||
if (this.form.deptId != undefined) {
|
handleUpdate(row) {
|
||||||
updateDept(this.form).then(response => {
|
this.reset();
|
||||||
if (response.code === 200) {
|
this.getTreeselect();
|
||||||
this.msgSuccess("修改成功");
|
getDept(row.deptId).then(response => {
|
||||||
this.open = false;
|
this.form = response.data;
|
||||||
this.getList();
|
this.open = true;
|
||||||
} else {
|
this.title = "修改部门";
|
||||||
this.msgError(response.msg);
|
});
|
||||||
}
|
},
|
||||||
});
|
/** 提交按钮 */
|
||||||
} else {
|
submitForm: function() {
|
||||||
addDept(this.form).then(response => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (response.code === 200) {
|
if (valid) {
|
||||||
this.msgSuccess("新增成功");
|
if (this.form.deptId != undefined) {
|
||||||
this.open = false;
|
updateDept(this.form).then(response => {
|
||||||
this.getList();
|
if (response.code === 200) {
|
||||||
} else {
|
this.msgSuccess("修改成功");
|
||||||
this.msgError(response.msg);
|
this.open = false;
|
||||||
}
|
this.getList();
|
||||||
});
|
} else {
|
||||||
}
|
this.msgError(response.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
/** 删除按钮操作 */
|
addDept(this.form).then(response => {
|
||||||
handleDelete(row) {
|
if (response.code === 200) {
|
||||||
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", {
|
this.msgSuccess("新增成功");
|
||||||
confirmButtonText: "确定",
|
this.open = false;
|
||||||
cancelButtonText: "取消",
|
this.getList();
|
||||||
type: "warning"
|
} else {
|
||||||
}).then(function() {
|
this.msgError(response.msg);
|
||||||
return delDept(row.deptId);
|
}
|
||||||
}).then(() => {
|
});
|
||||||
this.getList();
|
}
|
||||||
this.msgSuccess("删除成功");
|
}
|
||||||
}).catch(function() {});
|
});
|
||||||
}
|
},
|
||||||
}
|
/** 删除按钮操作 */
|
||||||
};
|
handleDelete(row) {
|
||||||
|
this.$confirm(
|
||||||
|
'是否确认删除名称为"' + row.deptName + '"的数据项?',
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(function() {
|
||||||
|
return delDept(row.deptId);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(function() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
@ -206,7 +206,7 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="幼儿园规模" prop="scale">
|
<el-form-item label="幼儿园规模" prop="scale">
|
||||||
<el-select v-model="form.scale" placeholder="请选择">
|
<el-select v-model="form.scale">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in scaleOptions"
|
v-for="dict in scaleOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -334,6 +334,7 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
xxdm: undefined,
|
||||||
schoolName: undefined,
|
schoolName: undefined,
|
||||||
nameShort: undefined,
|
nameShort: undefined,
|
||||||
type: undefined,
|
type: undefined,
|
||||||
@ -428,6 +429,7 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
xxdm: undefined,
|
||||||
schoolName: undefined,
|
schoolName: undefined,
|
||||||
nameShort: undefined,
|
nameShort: undefined,
|
||||||
type: "1",
|
type: "1",
|
||||||
|
@ -1,85 +1,94 @@
|
|||||||
package com.ruoyi.framework.web.controller;
|
package com.ruoyi.framework.web.controller;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
import java.util.UUID;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.web.bind.WebDataBinder;
|
import com.ruoyi.project.system.domain.BySchool;
|
||||||
import org.springframework.web.bind.annotation.InitBinder;
|
import com.ruoyi.project.system.domain.SysDept;
|
||||||
import com.github.pagehelper.PageHelper;
|
import org.slf4j.Logger;
|
||||||
import com.github.pagehelper.PageInfo;
|
import org.slf4j.LoggerFactory;
|
||||||
import com.ruoyi.common.constant.HttpStatus;
|
import org.springframework.web.bind.WebDataBinder;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.common.constant.HttpStatus;
|
||||||
import com.ruoyi.framework.web.page.PageDomain;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.web.page.TableSupport;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||||
/**
|
import com.ruoyi.framework.web.page.PageDomain;
|
||||||
* web层通用数据处理
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
*
|
import com.ruoyi.framework.web.page.TableSupport;
|
||||||
* @author ruoyi
|
|
||||||
*/
|
/**
|
||||||
public class BaseController
|
* web层通用数据处理
|
||||||
{
|
*
|
||||||
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
* @author ruoyi
|
||||||
|
*/
|
||||||
/**
|
public class BaseController
|
||||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
{
|
||||||
*/
|
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
||||||
@InitBinder
|
|
||||||
public void initBinder(WebDataBinder binder)
|
public static String getUUID32()
|
||||||
{
|
{
|
||||||
// Date 类型转换
|
return UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||||
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
|
}
|
||||||
{
|
|
||||||
@Override
|
/**
|
||||||
public void setAsText(String text)
|
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||||
{
|
*/
|
||||||
setValue(DateUtils.parseDate(text));
|
@InitBinder
|
||||||
}
|
public void initBinder(WebDataBinder binder)
|
||||||
});
|
{
|
||||||
}
|
// Date 类型转换
|
||||||
|
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
|
||||||
/**
|
{
|
||||||
* 设置请求分页数据
|
@Override
|
||||||
*/
|
public void setAsText(String text)
|
||||||
protected void startPage()
|
{
|
||||||
{
|
setValue(DateUtils.parseDate(text));
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
}
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
});
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
}
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
|
||||||
{
|
/**
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
* 设置请求分页数据
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
*/
|
||||||
}
|
protected void startPage()
|
||||||
}
|
{
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
/**
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
* 响应请求分页数据
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
*/
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
{
|
||||||
protected TableDataInfo getDataTable(List<?> list)
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
{
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
}
|
||||||
rspData.setCode(HttpStatus.SUCCESS);
|
}
|
||||||
rspData.setRows(list);
|
|
||||||
rspData.setTotal(new PageInfo(list).getTotal());
|
/**
|
||||||
return rspData;
|
* 响应请求分页数据
|
||||||
}
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
/**
|
protected TableDataInfo getDataTable(List<?> list)
|
||||||
* 响应返回结果
|
{
|
||||||
*
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
* @param rows 影响行数
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
* @return 操作结果
|
rspData.setRows(list);
|
||||||
*/
|
rspData.setTotal(new PageInfo(list).getTotal());
|
||||||
protected AjaxResult toAjax(int rows)
|
return rspData;
|
||||||
{
|
}
|
||||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
|
||||||
}
|
/**
|
||||||
}
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param rows 影响行数
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(int rows)
|
||||||
|
{
|
||||||
|
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.project.system.service.ISysDeptService;
|
||||||
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;
|
||||||
@ -22,6 +23,7 @@ import com.ruoyi.framework.web.controller.BaseController;
|
|||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.project.system.domain.SysDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 幼儿园机构Controller
|
* 幼儿园机构Controller
|
||||||
@ -36,6 +38,11 @@ public class BySchoolController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IBySchoolService bySchoolService;
|
private IBySchoolService bySchoolService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询幼儿园机构列表
|
* 查询幼儿园机构列表
|
||||||
*/
|
*/
|
||||||
@ -79,9 +86,27 @@ public class BySchoolController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody BySchool bySchool)
|
public AjaxResult add(@RequestBody BySchool bySchool)
|
||||||
{
|
{
|
||||||
|
String uuid = getUUID32();
|
||||||
|
|
||||||
|
//将UUID赋值给xxdm
|
||||||
|
bySchool.setXxdm(uuid);
|
||||||
bySchool.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId());
|
bySchool.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
bySchool.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId());
|
bySchool.setApprovalUser(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
bySchool.setCreateTime(new Date());
|
bySchool.setCreateTime(new Date());
|
||||||
|
//bySchoolService.insertBySchool(bySchool);
|
||||||
|
|
||||||
|
SysDept dept = new SysDept();
|
||||||
|
dept.setSchoolId(bySchool.getXxdm());
|
||||||
|
dept.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
//dept.setDeptId(bySchool.getDept().getDeptId());
|
||||||
|
dept.setParentId(200L);
|
||||||
|
dept.setAncestors("0,100,200");
|
||||||
|
dept.setDeptName(bySchool.getSchoolName());
|
||||||
|
//dept.setPhone(bySchool.getTel());
|
||||||
|
//dept.setOrderNum(String.valueOf(bySchool.getId()));
|
||||||
|
dept.setLeader(SecurityUtils.getUsername());
|
||||||
|
deptService.insertDept(dept);
|
||||||
|
|
||||||
return toAjax(bySchoolService.insertBySchool(bySchool));
|
return toAjax(bySchoolService.insertBySchool(bySchool));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,134 +1,137 @@
|
|||||||
package com.ruoyi.project.system.controller;
|
package com.ruoyi.project.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import com.ruoyi.project.system.service.IBySchoolService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.framework.web.controller.BaseController;
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.ruoyi.project.system.domain.SysDept;
|
import com.ruoyi.framework.web.controller.BaseController;
|
||||||
import com.ruoyi.project.system.service.ISysDeptService;
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.project.system.domain.SysDept;
|
||||||
/**
|
import com.ruoyi.project.system.service.ISysDeptService;
|
||||||
* 部门信息
|
|
||||||
*
|
/**
|
||||||
* @author ruoyi
|
* 部门信息
|
||||||
*/
|
*
|
||||||
@RestController
|
* @author ruoyi
|
||||||
@RequestMapping("/system/dept")
|
*/
|
||||||
public class SysDeptController extends BaseController
|
@RestController
|
||||||
{
|
@RequestMapping("/system/dept")
|
||||||
@Autowired
|
public class SysDeptController extends BaseController
|
||||||
private ISysDeptService deptService;
|
{
|
||||||
|
@Autowired
|
||||||
/**
|
private ISysDeptService deptService;
|
||||||
* 获取部门列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
/**
|
||||||
@GetMapping("/list")
|
* 获取部门列表
|
||||||
public AjaxResult list(SysDept dept)
|
*/
|
||||||
{
|
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
@GetMapping("/list")
|
||||||
return AjaxResult.success(depts);
|
public AjaxResult list(SysDept dept)
|
||||||
}
|
{
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
/**
|
return AjaxResult.success(depts);
|
||||||
* 根据部门编号获取详细信息
|
}
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
/**
|
||||||
@GetMapping(value = "/{deptId}")
|
* 根据部门编号获取详细信息
|
||||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
*/
|
||||||
{
|
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
@GetMapping(value = "/{deptId}")
|
||||||
}
|
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||||
|
{
|
||||||
/**
|
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||||
* 获取部门下拉树列表
|
}
|
||||||
*/
|
|
||||||
@GetMapping("/treeselect")
|
/**
|
||||||
public AjaxResult treeselect(SysDept dept)
|
* 获取部门下拉树列表
|
||||||
{
|
*/
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
@GetMapping("/treeselect")
|
||||||
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
public AjaxResult treeselect(SysDept dept)
|
||||||
}
|
{
|
||||||
|
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||||
/**
|
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
||||||
* 加载对应角色部门列表树
|
}
|
||||||
*/
|
|
||||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
/**
|
||||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
* 加载对应角色部门列表树
|
||||||
{
|
*/
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||||
AjaxResult ajax = AjaxResult.success();
|
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
||||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
{
|
||||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
return ajax;
|
AjaxResult ajax = AjaxResult.success();
|
||||||
}
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
|
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||||
/**
|
return ajax;
|
||||||
* 新增部门
|
}
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
/**
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
* 新增部门
|
||||||
@PostMapping
|
*/
|
||||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||||
{
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
@PostMapping
|
||||||
{
|
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
{
|
||||||
}
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
dept.setCreateBy(SecurityUtils.getUsername());
|
{
|
||||||
return toAjax(deptService.insertDept(dept));
|
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
|
dept.setCreateBy(SecurityUtils.getUsername());
|
||||||
/**
|
return toAjax(deptService.insertDept(dept));
|
||||||
* 修改部门
|
}
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
/**
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
* 修改部门
|
||||||
@PutMapping
|
*/
|
||||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||||
{
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
@PutMapping
|
||||||
{
|
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
{
|
||||||
}
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
{
|
||||||
{
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
}
|
||||||
}
|
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
{
|
||||||
return toAjax(deptService.updateDept(dept));
|
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
}
|
}
|
||||||
|
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||||
/**
|
return toAjax(deptService.updateDept(dept));
|
||||||
* 删除部门
|
}
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
/**
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
* 删除部门
|
||||||
@DeleteMapping("/{deptId}")
|
*/
|
||||||
public AjaxResult remove(@PathVariable Long deptId)
|
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||||
{
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
if (deptService.hasChildByDeptId(deptId))
|
@DeleteMapping("/{deptId}")
|
||||||
{
|
public AjaxResult remove(@PathVariable Long deptId)
|
||||||
return AjaxResult.error("存在下级部门,不允许删除");
|
{
|
||||||
}
|
if (deptService.hasChildByDeptId(deptId))
|
||||||
if (deptService.checkDeptExistUser(deptId))
|
{
|
||||||
{
|
return AjaxResult.error("存在下级部门,不允许删除");
|
||||||
return AjaxResult.error("部门存在用户,不允许删除");
|
}
|
||||||
}
|
if (deptService.checkDeptExistUser(deptId))
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
{
|
||||||
}
|
return AjaxResult.error("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
|
return toAjax(deptService.deleteDeptById(deptId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -19,6 +19,9 @@ public class BySchool extends BaseEntity
|
|||||||
/** 幼儿园ID */
|
/** 幼儿园ID */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
// 学校代码(与dept相关联)
|
||||||
|
private String xxdm;
|
||||||
|
|
||||||
/** 机构名称 */
|
/** 机构名称 */
|
||||||
@Excel(name = "机构名称")
|
@Excel(name = "机构名称")
|
||||||
private String schoolName;
|
private String schoolName;
|
||||||
@ -131,6 +134,17 @@ public class BySchool extends BaseEntity
|
|||||||
@Excel(name = "当前学期")
|
@Excel(name = "当前学期")
|
||||||
private String dqxq;
|
private String dqxq;
|
||||||
|
|
||||||
|
//部门
|
||||||
|
private SysDept dept;
|
||||||
|
|
||||||
|
public SysDept getDept() {
|
||||||
|
return dept;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDept(SysDept dept) {
|
||||||
|
this.dept = dept;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -393,10 +407,21 @@ public class BySchool extends BaseEntity
|
|||||||
return dqxq;
|
return dqxq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getXxdm() {
|
||||||
|
return xxdm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXxdm(String xxdm) {
|
||||||
|
this.xxdm = xxdm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", getId())
|
.append("id", getId())
|
||||||
|
.append("xxdm",getXxdm())
|
||||||
.append("schoolName", getSchoolName())
|
.append("schoolName", getSchoolName())
|
||||||
.append("nameShort", getNameShort())
|
.append("nameShort", getNameShort())
|
||||||
.append("type", getType())
|
.append("type", getType())
|
||||||
@ -427,6 +452,9 @@ public class BySchool extends BaseEntity
|
|||||||
.append("openDeadline", getOpenDeadline())
|
.append("openDeadline", getOpenDeadline())
|
||||||
.append("dqxn", getDqxn())
|
.append("dqxn", getDqxn())
|
||||||
.append("dqxq", getDqxq())
|
.append("dqxq", getDqxq())
|
||||||
|
.append("dept", getDept())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,202 +1,216 @@
|
|||||||
package com.ruoyi.project.system.domain;
|
package com.ruoyi.project.system.domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表 sys_dept
|
* 部门表 sys_dept
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SysDept extends BaseEntity
|
public class SysDept extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 父部门ID */
|
/** 父部门ID */
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
/** 祖级列表 */
|
/** 祖级列表 */
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
||||||
/** 部门名称 */
|
/** 部门名称 */
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/** 显示顺序 */
|
/** 显示顺序 */
|
||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
||||||
/** 负责人 */
|
/** 负责人 */
|
||||||
private String leader;
|
private String leader;
|
||||||
|
|
||||||
/** 联系电话 */
|
/** 联系电话 */
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/** 邮箱 */
|
/** 邮箱 */
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/** 部门状态:0正常,1停用 */
|
/** 部门状态:0正常,1停用 */
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 父部门名称 */
|
/** 父部门名称 */
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
/** 子部门 */
|
/** 子部门 */
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
public Long getDeptId()
|
/** 学校ID(与school表关联) */
|
||||||
{
|
private String schoolId;
|
||||||
return deptId;
|
|
||||||
}
|
public String getSchoolId() {
|
||||||
|
return schoolId;
|
||||||
public void setDeptId(Long deptId)
|
}
|
||||||
{
|
|
||||||
this.deptId = deptId;
|
public void setSchoolId(String schoolId) {
|
||||||
}
|
this.schoolId = schoolId;
|
||||||
|
}
|
||||||
public Long getParentId()
|
|
||||||
{
|
public Long getDeptId()
|
||||||
return parentId;
|
{
|
||||||
}
|
return deptId;
|
||||||
|
}
|
||||||
public void setParentId(Long parentId)
|
|
||||||
{
|
public void setDeptId(Long deptId)
|
||||||
this.parentId = parentId;
|
{
|
||||||
}
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
public String getAncestors()
|
|
||||||
{
|
public Long getParentId()
|
||||||
return ancestors;
|
{
|
||||||
}
|
return parentId;
|
||||||
|
}
|
||||||
public void setAncestors(String ancestors)
|
|
||||||
{
|
public void setParentId(Long parentId)
|
||||||
this.ancestors = ancestors;
|
{
|
||||||
}
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
@NotBlank(message = "部门名称不能为空")
|
|
||||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
public String getAncestors()
|
||||||
public String getDeptName()
|
{
|
||||||
{
|
return ancestors;
|
||||||
return deptName;
|
}
|
||||||
}
|
|
||||||
|
public void setAncestors(String ancestors)
|
||||||
public void setDeptName(String deptName)
|
{
|
||||||
{
|
this.ancestors = ancestors;
|
||||||
this.deptName = deptName;
|
}
|
||||||
}
|
|
||||||
|
@NotBlank(message = "部门名称不能为空")
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||||
public String getOrderNum()
|
public String getDeptName()
|
||||||
{
|
{
|
||||||
return orderNum;
|
return deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrderNum(String orderNum)
|
public void setDeptName(String deptName)
|
||||||
{
|
{
|
||||||
this.orderNum = orderNum;
|
this.deptName = deptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLeader()
|
@NotBlank(message = "显示顺序不能为空")
|
||||||
{
|
public String getOrderNum()
|
||||||
return leader;
|
{
|
||||||
}
|
return orderNum;
|
||||||
|
}
|
||||||
public void setLeader(String leader)
|
|
||||||
{
|
public void setOrderNum(String orderNum)
|
||||||
this.leader = leader;
|
{
|
||||||
}
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
|
||||||
public String getPhone()
|
public String getLeader()
|
||||||
{
|
{
|
||||||
return phone;
|
return leader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhone(String phone)
|
public void setLeader(String leader)
|
||||||
{
|
{
|
||||||
this.phone = phone;
|
this.leader = leader;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Email(message = "邮箱格式不正确")
|
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
public String getPhone()
|
||||||
public String getEmail()
|
{
|
||||||
{
|
return phone;
|
||||||
return email;
|
}
|
||||||
}
|
|
||||||
|
public void setPhone(String phone)
|
||||||
public void setEmail(String email)
|
{
|
||||||
{
|
this.phone = phone;
|
||||||
this.email = email;
|
}
|
||||||
}
|
|
||||||
|
@Email(message = "邮箱格式不正确")
|
||||||
public String getStatus()
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
{
|
public String getEmail()
|
||||||
return status;
|
{
|
||||||
}
|
return email;
|
||||||
|
}
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
public void setEmail(String email)
|
||||||
this.status = status;
|
{
|
||||||
}
|
this.email = email;
|
||||||
|
}
|
||||||
public String getDelFlag()
|
|
||||||
{
|
public String getStatus()
|
||||||
return delFlag;
|
{
|
||||||
}
|
return status;
|
||||||
|
}
|
||||||
public void setDelFlag(String delFlag)
|
|
||||||
{
|
public void setStatus(String status)
|
||||||
this.delFlag = delFlag;
|
{
|
||||||
}
|
this.status = status;
|
||||||
|
}
|
||||||
public String getParentName()
|
|
||||||
{
|
public String getDelFlag()
|
||||||
return parentName;
|
{
|
||||||
}
|
return delFlag;
|
||||||
|
}
|
||||||
public void setParentName(String parentName)
|
|
||||||
{
|
public void setDelFlag(String delFlag)
|
||||||
this.parentName = parentName;
|
{
|
||||||
}
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
public List<SysDept> getChildren()
|
|
||||||
{
|
public String getParentName()
|
||||||
return children;
|
{
|
||||||
}
|
return parentName;
|
||||||
|
}
|
||||||
public void setChildren(List<SysDept> children)
|
|
||||||
{
|
public void setParentName(String parentName)
|
||||||
this.children = children;
|
{
|
||||||
}
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public String toString() {
|
public List<SysDept> getChildren()
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
{
|
||||||
.append("deptId", getDeptId())
|
return children;
|
||||||
.append("parentId", getParentId())
|
}
|
||||||
.append("ancestors", getAncestors())
|
|
||||||
.append("deptName", getDeptName())
|
public void setChildren(List<SysDept> children)
|
||||||
.append("orderNum", getOrderNum())
|
{
|
||||||
.append("leader", getLeader())
|
this.children = children;
|
||||||
.append("phone", getPhone())
|
}
|
||||||
.append("email", getEmail())
|
|
||||||
.append("status", getStatus())
|
@Override
|
||||||
.append("delFlag", getDelFlag())
|
public String toString() {
|
||||||
.append("createBy", getCreateBy())
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("createTime", getCreateTime())
|
.append("deptId", getDeptId())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("parentId", getParentId())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("ancestors", getAncestors())
|
||||||
.toString();
|
.append("deptName", getDeptName())
|
||||||
}
|
.append("orderNum", getOrderNum())
|
||||||
}
|
.append("leader", getLeader())
|
||||||
|
.append("phone", getPhone())
|
||||||
|
.append("email", getEmail())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("school_id", getSchoolId())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<resultMap type="BySchool" id="BySchoolResult">
|
<resultMap type="BySchool" id="BySchoolResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
<result property="xxdm" column="xxdm" />
|
||||||
<result property="schoolName" column="school_name" />
|
<result property="schoolName" column="school_name" />
|
||||||
<result property="nameShort" column="name_short" />
|
<result property="nameShort" column="name_short" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
@ -39,12 +40,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBySchoolVo">
|
<sql id="selectBySchoolVo">
|
||||||
select id, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq from by_school
|
select id, xxdm, school_name, name_short, type, parent_id, province, provincename, regionid, regionname, area, areaname, address, mastername, tel, em_man, em_tel, status, scale, create_time, create_user, approval_user, approval_time, remark, location, is_demonstr, businesslicenseimg, open_book, fee_status, open_deadline, dqxn, dqxq from by_school
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
|
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
|
||||||
<include refid="selectBySchoolVo"/>
|
<include refid="selectBySchoolVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
<if test="xxdm != null and xxdm != ''"> and xxdm like concat('%', #{xxdm}, '%')</if>
|
||||||
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
|
<if test="schoolName != null and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
|
||||||
<if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
|
<if test="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
|
||||||
<if test="type != null "> and type = #{type}</if>
|
<if test="type != null "> and type = #{type}</if>
|
||||||
@ -84,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<insert id="insertBySchool" parameterType="BySchool" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBySchool" parameterType="BySchool" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into by_school
|
insert into by_school
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="xxdm != null and xxdm != ''">xxdm,</if>
|
||||||
<if test="schoolName != null and schoolName != ''">school_name,</if>
|
<if test="schoolName != null and schoolName != ''">school_name,</if>
|
||||||
<if test="nameShort != null and nameShort != ''">name_short,</if>
|
<if test="nameShort != null and nameShort != ''">name_short,</if>
|
||||||
<if test="type != null ">type,</if>
|
<if test="type != null ">type,</if>
|
||||||
@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="dqxq != null and dqxq != ''">dqxq,</if>
|
<if test="dqxq != null and dqxq != ''">dqxq,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="xxdm != null and xxdm != ''">#{xxdm},</if>
|
||||||
<if test="schoolName != null and schoolName != ''">#{schoolName},</if>
|
<if test="schoolName != null and schoolName != ''">#{schoolName},</if>
|
||||||
<if test="nameShort != null and nameShort != ''">#{nameShort},</if>
|
<if test="nameShort != null and nameShort != ''">#{nameShort},</if>
|
||||||
<if test="type != null ">#{type},</if>
|
<if test="type != null ">#{type},</if>
|
||||||
@ -152,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<update id="updateBySchool" parameterType="BySchool">
|
<update id="updateBySchool" parameterType="BySchool">
|
||||||
update by_school
|
update by_school
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="xxdm != null and schoolName != ''">xxdm = #{xxdm},</if>
|
||||||
<if test="schoolName != null and schoolName != ''">school_name = #{schoolName},</if>
|
<if test="schoolName != null and schoolName != ''">school_name = #{schoolName},</if>
|
||||||
<if test="nameShort != null and nameShort != ''">name_short = #{nameShort},</if>
|
<if test="nameShort != null and nameShort != ''">name_short = #{nameShort},</if>
|
||||||
<if test="type != null ">type = #{type},</if>
|
<if test="type != null ">type = #{type},</if>
|
||||||
|
@ -1,151 +1,155 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.project.system.mapper.SysDeptMapper">
|
<mapper namespace="com.ruoyi.project.system.mapper.SysDeptMapper">
|
||||||
|
|
||||||
<resultMap type="SysDept" id="SysDeptResult">
|
<resultMap type="SysDept" id="SysDeptResult">
|
||||||
<id property="deptId" column="dept_id" />
|
<id property="deptId" column="dept_id" />
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id" />
|
||||||
<result property="ancestors" column="ancestors" />
|
<result property="ancestors" column="ancestors" />
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="deptName" column="dept_name" />
|
||||||
<result property="orderNum" column="order_num" />
|
<result property="orderNum" column="order_num" />
|
||||||
<result property="leader" column="leader" />
|
<result property="leader" column="leader" />
|
||||||
<result property="phone" column="phone" />
|
<result property="phone" column="phone" />
|
||||||
<result property="email" column="email" />
|
<result property="email" column="email" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
<result property="parentName" column="parent_name" />
|
<result property="parentName" column="parent_name" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
<result property="schoolId" column="school_id" />
|
||||||
|
</resultMap>
|
||||||
<sql id="selectDeptVo">
|
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
<sql id="selectDeptVo">
|
||||||
from sys_dept d
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time, d.school_id
|
||||||
</sql>
|
from sys_dept d
|
||||||
|
</sql>
|
||||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
|
||||||
<include refid="selectDeptVo"/>
|
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
||||||
where d.del_flag = '0'
|
<include refid="selectDeptVo"/>
|
||||||
<if test="parentId != null and parentId != 0">
|
where d.del_flag = '0'
|
||||||
AND parent_id = #{parentId}
|
<if test="parentId != null and parentId != 0">
|
||||||
</if>
|
AND parent_id = #{parentId}
|
||||||
<if test="deptName != null and deptName != ''">
|
</if>
|
||||||
AND dept_name like concat('%', #{deptName}, '%')
|
<if test="deptName != null and deptName != ''">
|
||||||
</if>
|
AND dept_name like concat('%', #{deptName}, '%')
|
||||||
<if test="status != null and status != ''">
|
</if>
|
||||||
AND status = #{status}
|
<if test="status != null and status != ''">
|
||||||
</if>
|
AND status = #{status}
|
||||||
<!-- 数据范围过滤 -->
|
</if>
|
||||||
${dataScope}
|
<!-- 数据范围过滤 -->
|
||||||
order by d.parent_id, d.order_num
|
${dataScope}
|
||||||
</select>
|
order by d.parent_id, d.order_num
|
||||||
|
</select>
|
||||||
<select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer">
|
|
||||||
select d.dept_id, d.parent_id
|
<select id="selectDeptListByRoleId" parameterType="Long" resultType="Integer">
|
||||||
from sys_dept d
|
select d.dept_id, d.parent_id
|
||||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
from sys_dept d
|
||||||
where rd.role_id = #{roleId}
|
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||||
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
where rd.role_id = #{roleId}
|
||||||
order by d.parent_id, d.order_num
|
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
|
||||||
</select>
|
order by d.parent_id, d.order_num
|
||||||
|
</select>
|
||||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
|
||||||
<include refid="selectDeptVo"/>
|
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||||
where dept_id = #{deptId}
|
<include refid="selectDeptVo"/>
|
||||||
</select>
|
where dept_id = #{deptId}
|
||||||
|
</select>
|
||||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
|
||||||
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
||||||
</select>
|
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
||||||
|
</select>
|
||||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
|
||||||
select count(1) from sys_dept
|
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
||||||
where del_flag = '0' and parent_id = #{deptId}
|
select count(1) from sys_dept
|
||||||
</select>
|
where del_flag = '0' and parent_id = #{deptId}
|
||||||
|
</select>
|
||||||
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
|
||||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
||||||
</select>
|
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||||
|
</select>
|
||||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
|
||||||
<include refid="selectDeptVo"/>
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId}
|
<include refid="selectDeptVo"/>
|
||||||
</select>
|
where dept_name=#{deptName} and parent_id = #{parentId}
|
||||||
|
</select>
|
||||||
<insert id="insertDept" parameterType="SysDept">
|
|
||||||
insert into sys_dept(
|
<insert id="insertDept" parameterType="SysDept">
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
insert into sys_dept(
|
||||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||||
<if test="leader != null and leader != ''">leader,</if>
|
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||||
<if test="phone != null and phone != ''">phone,</if>
|
<if test="leader != null and leader != ''">leader,</if>
|
||||||
<if test="email != null and email != ''">email,</if>
|
<if test="phone != null and phone != ''">phone,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="status != null">status,</if>
|
||||||
create_time
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
)values(
|
<if test="schoolId != null and schoolId != ''">school_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
create_time
|
||||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
)values(
|
||||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||||
<if test="leader != null and leader != ''">#{leader},</if>
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||||
<if test="phone != null and phone != ''">#{phone},</if>
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="leader != null and leader != ''">#{leader},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="phone != null and phone != ''">#{phone},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
sysdate()
|
<if test="status != null">#{status},</if>
|
||||||
)
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
</insert>
|
<if test="schoolId != null and schoolId != ''">#{schoolId},</if>
|
||||||
|
sysdate()
|
||||||
<update id="updateDept" parameterType="SysDept">
|
)
|
||||||
update sys_dept
|
</insert>
|
||||||
<set>
|
|
||||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
<update id="updateDept" parameterType="SysDept">
|
||||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
update sys_dept
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
<set>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||||
<if test="leader != null">leader = #{leader},</if>
|
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||||
<if test="phone != null">phone = #{phone},</if>
|
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
||||||
<if test="email != null">email = #{email},</if>
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="leader != null">leader = #{leader},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
update_time = sysdate()
|
<if test="email != null">email = #{email},</if>
|
||||||
</set>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
where dept_id = #{deptId}
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
</update>
|
<if test="schoolId != null and schoolId != ''">school_id = #{schoolId},</if>
|
||||||
|
update_time = sysdate()
|
||||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
</set>
|
||||||
update sys_dept set ancestors =
|
where dept_id = #{deptId}
|
||||||
<foreach collection="depts" item="item" index="index"
|
</update>
|
||||||
separator=" " open="case dept_id" close="end">
|
|
||||||
when #{item.deptId} then #{item.ancestors}
|
<update id="updateDeptChildren" parameterType="java.util.List">
|
||||||
</foreach>
|
update sys_dept set ancestors =
|
||||||
where dept_id in
|
<foreach collection="depts" item="item" index="index"
|
||||||
<foreach collection="depts" item="item" index="index"
|
separator=" " open="case dept_id" close="end">
|
||||||
separator="," open="(" close=")">
|
when #{item.deptId} then #{item.ancestors}
|
||||||
#{item.deptId}
|
</foreach>
|
||||||
</foreach>
|
where dept_id in
|
||||||
</update>
|
<foreach collection="depts" item="item" index="index"
|
||||||
|
separator="," open="(" close=")">
|
||||||
<update id="updateDeptStatus" parameterType="SysDept">
|
#{item.deptId}
|
||||||
update sys_dept
|
</foreach>
|
||||||
<set>
|
</update>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<update id="updateDeptStatus" parameterType="SysDept">
|
||||||
update_time = sysdate()
|
update sys_dept
|
||||||
</set>
|
<set>
|
||||||
where dept_id in (${ancestors})
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
</update>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
<delete id="deleteDeptById" parameterType="Long">
|
</set>
|
||||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
where dept_id in (${ancestors})
|
||||||
</delete>
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDeptById" parameterType="Long">
|
||||||
|
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user