20200617-zlp-1

多部门切换
视频学习页面 过滤bug
This commit is contained in:
paidaxing444 2020-06-17 17:58:52 +08:00
parent 4b8bf8f5d4
commit 639357f280
17 changed files with 415 additions and 206 deletions

View File

@ -9,6 +9,23 @@ export function listDept(query) {
})
}
// 查询多幼儿园列表
export function getDeptsInfo() {
return request({
url: '/system/dept/getDeptsInfo',
method: 'get'
})
}
// 切换部门
export function changeDept(deptId) {
return request({
url: '/system/dept/changeDept/'+deptId,
method: 'post'
})
}
// 查询部门详细
export function getDept(deptId) {
return request({

View File

@ -1,6 +1,11 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
@ -13,15 +18,17 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/change/dept" v-if="isMoreSchool">
<el-dropdown-item>切换园所</el-dropdown-item>
</router-link>
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
@ -38,12 +45,13 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import { getDeptsInfo } from "@/api/system/dept";
export default {
components: {
@ -54,40 +62,55 @@ export default {
Search
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
...mapGetters(["sidebar", "avatar", "device"]),
setting: {
get() {
return this.$store.state.settings.showSettings
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
this.$store.dispatch("settings/changeSetting", {
key: "showSettings",
value: val
})
});
}
}
},
data() {
return {
isMoreSchool: undefined
};
},
created() {
this.getDepts();
},
methods: {
getDepts() {
getDeptsInfo().then(response => {
// console.log("school=" + response.total);
// console.log( response);
if (response.total <= 1) {
this.isMoreSchool = false;
} else {
this.isMoreSchool = true;
}
});
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
this.$confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.reload()
})
})
this.$store.dispatch("LogOut").then(() => {
location.reload();
});
});
}
}
}
};
</script>
<style lang="scss" scoped>
@ -96,18 +119,18 @@ export default {
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
@ -139,10 +162,10 @@ export default {
&.hover-effect {
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
}

View File

@ -78,6 +78,19 @@ export const constantRoutes = [{
meta: { title: '个人中心', icon: 'user' }
}]
},
{
path: '/user/change',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [{
path: 'dept',
component: () =>
import ('@/views/system/user/change/dept/index'),
name: 'Changedept',
meta: { title: '切换岗位', icon: 'user' }
}]
},
{
path: '/dict',
component: Layout,

View File

@ -166,7 +166,7 @@
<video
v-if="imageUrl.length > 1 && imgFlag == false"
controls="controls"
:src="[qiniuUrl + '/' + imageUrl]"
:src="[imageUrl]"
class="avatar"
></video>
<i
@ -201,7 +201,7 @@ export default {
name: "Video",
data() {
return {
qiniuUrl: "https://files.benyiedu.com", // 访
qiniuUrl: "https://files.benyiedu.com/", // 访
imgFlag: false,
imageUrl: [],
percent: 0,
@ -287,10 +287,16 @@ export default {
methods: {
//label
getLastChildName(val) {
//console.log(val[val.length-1]);
//console.log(this.$refs.myCascader.getCheckedNodes()[0].pathLabels[val.length-1]);
var lastLable=this.$refs.typeCascader.getCheckedNodes()[0].pathLabels[val.length-1];
this.form.title=lastLable;
//console.log(val == undefined);
if (val == undefined) {
} else {
//console.log(val[val.length-1]);
//console.log(this.$refs.myCascader.getCheckedNodes()[0].pathLabels[val.length-1]);
var lastLable = this.$refs.typeCascader.getCheckedNodes()[0].pathLabels[
val.length - 1
];
this.form.title = lastLable;
}
},
//
typeFormat(row, column) {
@ -325,7 +331,7 @@ export default {
this.imgFlag = false;
this.percent = 0;
if (response.hash) {
this.imageUrl = response.hash;
this.imageUrl = this.qiniuUrl + response.hash + "?e=";
} else {
this.msgError("视频上传失败,请重新上传!");
}
@ -401,7 +407,7 @@ export default {
if (this.queryParams.type == null) {
this.queryParams.type = "";
} else {
this.queryParams.type = this.queryParams.type.toString();
this.queryParams.type = this.queryParams.type.toString() + ",";
}
this.queryParams.pageNum = 1;
this.getList();
@ -446,6 +452,10 @@ export default {
this.open = true;
this.title = "修改培训";
this.imageUrl = response.data.videourl;
// console.log(response.data.videourl);
// console.log(
// response.data.videourl.split("benyiedu.com/")[1].split("?e=")[0]
// );
//console.log(this.imageUrl);
//
listAllLecturer().then(response => {
@ -457,12 +467,20 @@ export default {
/** 提交按钮 */
submitForm: function() {
// from
this.form.videourl = this.imageUrl;
if (this.imageUrl) {
this.form.videourl = this.imageUrl
.split("benyiedu.com/")[1]
.split("?e=")[0];
} else {
this.msgError("等待视频上传");
return;
}
this.$refs["form"].validate(valid => {
if (valid) {
//type arry
//console.log(this.form.type.toString());
this.form.type = this.form.type.toString();
this.form.type = this.form.type.toString() + ",";
if (this.form.id != undefined) {
updateVideo(this.form).then(response => {

View File

@ -171,8 +171,9 @@ export default {
if (this.queryParams.type == null) {
this.queryParams.type = "";
} else {
this.queryParams.type = this.queryParams.type.toString();
this.queryParams.type = this.queryParams.type.toString()+",";
}
//console.log(this.queryParams.type);
this.queryParams.pageNum = 1;
this.getList();
},

View File

@ -46,7 +46,7 @@ export default {
methods: {
async getData() {
await listTeacherGroupXw().then(response => {
console.log(response);
//console.log(response);
let name = [];
let value = [];
let len = response.rows;

View File

@ -12,7 +12,12 @@
</el-form-item>
<el-form-item label="幼儿园类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择幼儿园类型" clearable size="small">
<el-option label="请选择字典生成" value />
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="所在省" prop="provincename">
@ -43,21 +48,15 @@
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option label="请选择字典生成" value />
<el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="approvalTime">
<el-date-picker
clearable
size="small"
style="width: 200px"
v-model="queryParams.approvalTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择创建时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<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>
@ -169,18 +168,6 @@
<el-form-item label="所在省" prop="provincename">
<v-distpicker v-model="form.provincename" @selected="onSelected"></v-distpicker>
</el-form-item>
<!--<el-form-item label="所在城市" prop="regionid">
<el-input v-model="form.regionid" placeholder="请输入所在城市" />
</el-form-item>-->
<!--<el-form-item label="所在城市" prop="regionname">
<v-distpicker v-model="form.regionname" @selected="onSelected"></v-distpicker>
</el-form-item>-->
<!--<el-form-item label="所在区" prop="area">
<el-input v-model="form.area" placeholder="请输入所在区" />
</el-form-item>-->
<!--<el-form-item label="所在区" prop="areaname">
<v-distpicker v-model="form.areaname" @selected="onSelected"></v-distpicker>
</el-form-item>-->
<el-form-item label="详细地址" prop="address">
<el-input v-model="form.address" placeholder="请输入详细地址" />
</el-form-item>
@ -223,18 +210,7 @@
</el-form-item>
<el-form-item label="创建时间" prop="createTime" v-show="false">
<el-input v-model="form.createTime"></el-input>
</el-form-item>
<el-form-item label="审核时间" prop="approvalTime">
<el-date-picker
clearable
size="small"
style="width: 200px"
v-model="form.approvalTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择审核时间"
></el-date-picker>
</el-form-item>
</el-form-item>
<el-form-item label="园所会员性质" prop="isDemonstr">
<el-select v-model="form.isDemonstr" placeholder="请选择">
<el-option
@ -244,10 +220,7 @@
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="营业执照图片" prop="businesslicenseimg">
<el-input v-model="form.businesslicenseimg" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form-item>
<el-form-item label="家长手册发布状态" prop="openBook" v-show="false">
<el-input v-model="form.openBook" placeholder="请输入家长手册发布状态" />
</el-form-item>
@ -271,12 +244,6 @@
placeholder="选择开通截至日期"
></el-date-picker>
</el-form-item>
<el-form-item label="当前学年" prop="dqxn">
<el-input v-model="form.dqxn" placeholder="请输入当前学年" />
</el-form-item>
<el-form-item label="当前学期" prop="dqxq">
<el-input v-model="form.dqxq" placeholder="请输入当前学期" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>

View File

@ -0,0 +1,106 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="24" :xs="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>所属园所信息</span>
</div>
<div>
<ul class="list-group list-group-striped">
<li class="list-group-item">
<svg-icon icon-class="user" />用户名称
<div class="pull-right">{{ user.userName }}</div>
</li>
<li class="list-group-item">
<svg-icon icon-class="tree" />所属部门
<div class="pull-right" v-if="user.dept">{{ user.dept.deptName }}</div>
</li>
<li class="list-group-item">
<svg-icon icon-class="tree" />选择部门
<div class="pull-right" v-for="item in deptsOptions" :key="item.deptId">
<input
type="radio"
name="dept"
:id="item.deptId"
:value="item.deptId"
v-model="checkedValue"
/>
<label :for="item.deptId">{{ item.deptName }}</label>
</div>
</li>
<li class="list-group-item">
<el-button type="primary" size="mini" @click="submit">保存</el-button>
<el-button type="danger" size="mini" @click="close">关闭</el-button>
</li>
</ul>
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { getUserProfile } from "@/api/system/user";
import { getDeptsInfo,changeDept } from "@/api/system/dept";
export default {
name: "changedept",
data() {
return {
checkedValue: null,
oldValue: null,
user: {},
deptsOptions: []
};
},
created() {
this.getUser();
this.getDepts();
},
methods: {
getDepts() {
getDeptsInfo().then(response => {
// console.log("school=" + response.total);
// console.log( response);
if (response.total <= 1) {
} else {
console.log(response);
this.deptsOptions = response.rows;
}
});
},
getUser() {
getUserProfile().then(response => {
this.user = response.data;
this.checkedValue = response.data.dept.deptId;
this.oldValue = response.data.dept.deptId;
});
},
submit() {
if (this.checkedValue == this.oldValue) {
this.msgError("幼儿园无变化");
return;
} else {
//
changeDept(this.checkedValue).then(
response => {
if (response.code === 200) {
this.msgSuccess(response.msg);
this.getUser();
this.getDepts();
} else {
this.msgError(response.msg);
}
}
)
}
},
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/index" });
}
}
};
</script>

View File

@ -17,7 +17,7 @@ import eu.bitwalker.useragentutils.UserAgent;
/**
* 异步工厂产生任务用
*
*
* @author ruoyi
*/
public class AsyncFactory
@ -26,7 +26,7 @@ public class AsyncFactory
/**
* 记录登陆信息
*
*
* @param username 用户名
* @param status 状态
* @param message 消息
@ -34,7 +34,7 @@ public class AsyncFactory
* @return 任务task
*/
public static TimerTask recordLogininfor(final String username, final String status, final String message,
final Object... args)
final Object... args)
{
final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
final String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
@ -81,7 +81,7 @@ public class AsyncFactory
/**
* 操作日志记录
*
*
* @param operLog 操作日志信息
* @return 任务task
*/

View File

@ -22,7 +22,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
/**
* token验证处理
*
*
* @author ruoyi
*/
@Component
@ -51,7 +51,7 @@ public class TokenService
/**
* 获取用户身份信息
*
*
* @return 用户信息
*/
public LoginUser getLoginUser(HttpServletRequest request)
@ -95,7 +95,7 @@ public class TokenService
/**
* 创建令牌
*
*
* @param loginUser 用户信息
* @return 令牌
*/
@ -113,7 +113,7 @@ public class TokenService
/**
* 验证令牌有效期相差不足20分钟自动刷新缓存
*
*
* @param token 令牌
* @return 令牌
*/
@ -129,7 +129,7 @@ public class TokenService
/**
* 刷新令牌有效期
*
*
* @param loginUser 登录信息
*/
public void refreshToken(LoginUser loginUser)
@ -140,10 +140,10 @@ public class TokenService
String userKey = getTokenKey(loginUser.getToken());
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
}
/**
* 设置用户代理信息
*
*
* @param loginUser 登录信息
*/
public void setUserAgent(LoginUser loginUser)
@ -155,7 +155,7 @@ public class TokenService
loginUser.setBrowser(userAgent.getBrowser().getName());
loginUser.setOs(userAgent.getOperatingSystem().getName());
}
/**
* 从数据声明生成令牌
*

View File

@ -77,6 +77,7 @@ public class ByTrainVideoController extends BaseController {
public AjaxResult getInfo(@PathVariable("id") Long id) {
ByTrainVideo byTrainVideo = byTrainVideoService.selectByTrainVideoById(id);
byTrainVideo.setVideourl(commonController.privateDownloadUrl(byTrainVideo.getVideourl()));
byTrainVideo.setType(byTrainVideo.getType().substring(0, byTrainVideo.getType().length() - 1));//去掉后缀的,
return AjaxResult.success(byTrainVideo);
}

View File

@ -2,7 +2,12 @@ package com.ruoyi.project.system.controller;
import java.util.List;
import com.ruoyi.project.system.service.IBySchoolService;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -25,24 +30,25 @@ import com.ruoyi.project.system.service.ISysDeptService;
/**
* 部门信息
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
public class SysDeptController extends BaseController {
@Autowired
private ISysDeptService deptService;
@Autowired
private TokenService tokenService;
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
public AjaxResult list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
@ -52,17 +58,43 @@ public class SysDeptController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
public AjaxResult getInfo(@PathVariable Long deptId) {
return AjaxResult.success(deptService.selectDeptById(deptId));
}
/**
* 根据用户获取部门列表信息-用于切换岗位
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = {"/getDeptsInfo"})
public TableDataInfo getDeptsInfo() {
Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
List<SysDept> list = deptService.selectSysDeptList(userId);
return getDataTable(list);
}
/**
* 切换岗位
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@PostMapping(value = {"/changeDept/{deptId}"})
public AjaxResult changeDept(@PathVariable Long deptId) {
System.out.println("开始切换...");
SysDept sysDept = deptService.selectDeptById(deptId);
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
loginUser.getUser().setDeptId(deptId);
loginUser.getUser().setDept(sysDept);
// 切换岗位 设置新的岗位信息到缓存中
tokenService.refreshToken(loginUser);
return AjaxResult.success("切换成功");
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
public AjaxResult treeselect(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
@ -71,8 +103,7 @@ public class SysDeptController extends BaseController
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
{
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
@ -86,10 +117,8 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
public AjaxResult add(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUsername());
@ -102,14 +131,10 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(dept.getDeptId()))
{
} else if (dept.getParentId().equals(dept.getDeptId())) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
dept.setUpdateBy(SecurityUtils.getUsername());
@ -122,14 +147,11 @@ public class SysDeptController extends BaseController
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
public AjaxResult remove(@PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
if (deptService.checkDeptExistUser(deptId)) {
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId));

View File

@ -27,6 +27,14 @@ public interface SysDeptMapper
*/
public List<Integer> selectDeptListByRoleId(Long roleId);
/**
* 根据用户ID获取部门列表
*
* @param userId 用户ID
* @return 选中岗位ID列表
*/
public List<SysDept> selectSysDeptList(Long userId);
/**
* 根据用户ID获取部门选择框列表
*

View File

@ -35,6 +35,14 @@ public interface ISysDeptService
*/
public List<SysDept> buildDeptTree(List<SysDept> depts);
/**
* 根据角色ID查询部门
*
* @param userId 角色ID
* @return 选中部门列表
*/
public List<SysDept> selectSysDeptList(Long userId);
/**
* 构建前端所需要下拉树结构
*

View File

@ -50,6 +50,16 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectDeptListByUserId(userId);
}
/**
* 根据角色ID查询部门
*
* @param userId 角色ID
* @return 选中部门列表
*/
public List<SysDept> selectSysDeptList(Long userId){
return deptMapper.selectSysDeptList(userId);
}
/**
* 构建前端所需要树结构
*

View File

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.system.mapper.BySchoolMapper">
<resultMap type="BySchool" id="BySchoolResult">
<result property="id" column="id" />
<result property="xxdm" column="xxdm" />
<result property="schoolName" column="school_name" />
<result property="nameShort" column="name_short" />
<result property="type" column="type" />
<result property="parentId" column="parent_id" />
<result property="province" column="province" />
<result property="provincename" column="provincename" />
<result property="regionid" column="regionid" />
<result property="regionname" column="regionname" />
<result property="area" column="area" />
<result property="areaname" column="areaname" />
<result property="address" column="address" />
<result property="mastername" column="mastername" />
<result property="tel" column="tel" />
<result property="emMan" column="em_man" />
<result property="emTel" column="em_tel" />
<result property="status" column="status" />
<result property="scale" column="scale" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="approvalUser" column="approval_user" />
<result property="approvalTime" column="approval_time" />
<result property="remark" column="remark" />
<result property="location" column="location" />
<result property="isDemonstr" column="is_demonstr" />
<result property="businesslicenseimg" column="businesslicenseimg" />
<result property="openBook" column="open_book" />
<result property="feeStatus" column="fee_status" />
<result property="openDeadline" column="open_deadline" />
<result property="dqxn" column="dqxn" />
<result property="dqxq" column="dqxq" />
<result property="isDel" column="is_del" />
<result property="id" column="id"/>
<result property="xxdm" column="xxdm"/>
<result property="schoolName" column="school_name"/>
<result property="nameShort" column="name_short"/>
<result property="type" column="type"/>
<result property="parentId" column="parent_id"/>
<result property="province" column="province"/>
<result property="provincename" column="provincename"/>
<result property="regionid" column="regionid"/>
<result property="regionname" column="regionname"/>
<result property="area" column="area"/>
<result property="areaname" column="areaname"/>
<result property="address" column="address"/>
<result property="mastername" column="mastername"/>
<result property="tel" column="tel"/>
<result property="emMan" column="em_man"/>
<result property="emTel" column="em_tel"/>
<result property="status" column="status"/>
<result property="scale" column="scale"/>
<result property="createTime" column="create_time"/>
<result property="createUser" column="create_user"/>
<result property="approvalUser" column="approval_user"/>
<result property="approvalTime" column="approval_time"/>
<result property="remark" column="remark"/>
<result property="location" column="location"/>
<result property="isDemonstr" column="is_demonstr"/>
<result property="businesslicenseimg" column="businesslicenseimg"/>
<result property="openBook" column="open_book"/>
<result property="feeStatus" column="fee_status"/>
<result property="openDeadline" column="open_deadline"/>
<result property="dqxn" column="dqxn"/>
<result property="dqxq" column="dqxq"/>
<result property="isDel" column="is_del"/>
</resultMap>
@ -48,42 +48,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBySchoolList" parameterType="BySchool" resultMap="BySchoolResult">
<include refid="selectBySchoolVo"/>
where is_del = '0'
<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="nameShort != null and nameShort != ''"> and name_short = #{nameShort}</if>
<if test="type != null "> and type = #{type}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="provincename != null and provincename != ''"> and provincename like concat('%', #{provincename}, '%')</if>
<if test="regionid != null and regionid != ''"> and regionid = #{regionid}</if>
<if test="regionname != null and regionname != ''"> and regionname like concat('%', #{regionname}, '%')</if>
<if test="area != null and area != ''"> and area = #{area}</if>
<if test="areaname != null and areaname != ''"> and areaname like concat('%', #{areaname}, '%')</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="mastername != null and mastername != ''"> and mastername like concat('%', #{mastername}, '%')</if>
<if test="tel != null and tel != ''"> and tel = #{tel}</if>
<if test="emMan != null and emMan != ''"> and em_man = #{emMan}</if>
<if test="emTel != null and emTel != ''"> and em_tel = #{emTel}</if>
<if test="status != null "> and status = #{status}</if>
<if test="scale != null "> and scale = #{scale}</if>
<if test="createUser != null "> and create_user = #{createUser}</if>
<if test="approvalUser != null "> and approval_user = #{approvalUser}</if>
<if test="approvalTime != null "> and approval_time = #{approvalTime}</if>
<if test="location != null and location != ''"> and location = #{location}</if>
<if test="isDemonstr != null "> and is_demonstr = #{isDemonstr}</if>
<if test="businesslicenseimg != null and businesslicenseimg != ''"> and businesslicenseimg = #{businesslicenseimg}</if>
<if test="openBook != null "> and open_book = #{openBook}</if>
<if test="feeStatus != null "> and fee_status = #{feeStatus}</if>
<if test="openDeadline != null "> and open_deadline = #{openDeadline}</if>
<if test="dqxn != null and dqxn != ''"> and dqxn = #{dqxn}</if>
<if test="dqxq != null and dqxq != ''"> and dqxq = #{dqxq}</if>
<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="nameShort != null and nameShort != ''">and name_short = #{nameShort}</if>
<if test="type != null ">and type = #{type}</if>
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="province != null and province != ''">and province = #{province}</if>
<if test="provincename != null and provincename != ''">and provincename like concat('%', #{provincename},
'%')
</if>
<if test="regionid != null and regionid != ''">and regionid = #{regionid}</if>
<if test="regionname != null and regionname != ''">and regionname like concat('%', #{regionname}, '%')</if>
<if test="area != null and area != ''">and area = #{area}</if>
<if test="areaname != null and areaname != ''">and areaname like concat('%', #{areaname}, '%')</if>
<if test="address != null and address != ''">and address = #{address}</if>
<if test="mastername != null and mastername != ''">and mastername like concat('%', #{mastername}, '%')</if>
<if test="tel != null and tel != ''">and tel like concat('%', #{tel}, '%')</if>
<if test="emMan != null and emMan != ''">and em_man = #{emMan}</if>
<if test="emTel != null and emTel != ''">and em_tel = #{emTel}</if>
<if test="status != null ">and status = #{status}</if>
<if test="scale != null ">and scale = #{scale}</if>
<if test="createUser != null ">and create_user = #{createUser}</if>
<if test="approvalUser != null ">and approval_user = #{approvalUser}</if>
<if test="approvalTime != null ">and approval_time = #{approvalTime}</if>
<if test="location != null and location != ''">and location = #{location}</if>
<if test="isDemonstr != null ">and is_demonstr = #{isDemonstr}</if>
<if test="businesslicenseimg != null and businesslicenseimg != ''">and businesslicenseimg =
#{businesslicenseimg}
</if>
<if test="openBook != null ">and open_book = #{openBook}</if>
<if test="feeStatus != null ">and fee_status = #{feeStatus}</if>
<if test="openDeadline != null ">and open_deadline = #{openDeadline}</if>
<if test="dqxn != null and dqxn != ''">and dqxn = #{dqxn}</if>
<if test="dqxq != null and dqxq != ''">and dqxq = #{dqxq}</if>
</select>
<select id="selectBySchoolById" parameterType="Long" resultMap="BySchoolResult">
<include refid="selectBySchoolVo"/>
where id = #{id}
</select>
<insert id="insertBySchool" parameterType="BySchool" useGeneratedKeys="true" keyProperty="id">
insert into by_school
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -118,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openDeadline != null ">open_deadline,</if>
<if test="dqxn != null and dqxn != ''">dqxn,</if>
<if test="dqxq != null and dqxq != ''">dqxq,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xxdm != null and xxdm != ''">#{xxdm},</if>
<if test="schoolName != null and schoolName != ''">#{schoolName},</if>
@ -151,7 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openDeadline != null ">#{openDeadline},</if>
<if test="dqxn != null and dqxn != ''">#{dqxn},</if>
<if test="dqxq != null and dqxq != ''">#{dqxq},</if>
</trim>
</trim>
</insert>
<update id="updateBySchool" parameterType="BySchool">
@ -182,7 +186,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="location != null and location != ''">location = #{location},</if>
<if test="isDemonstr != null ">is_demonstr = #{isDemonstr},</if>
<if test="businesslicenseimg != null and businesslicenseimg != ''">businesslicenseimg = #{businesslicenseimg},</if>
<if test="businesslicenseimg != null and businesslicenseimg != ''">businesslicenseimg =
#{businesslicenseimg},
</if>
<if test="openBook != null ">open_book = #{openBook},</if>
<if test="feeStatus != null ">fee_status = #{feeStatus},</if>
<if test="openDeadline != null ">open_deadline = #{openDeadline},</if>
@ -202,5 +208,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
</mapper>

View File

@ -28,6 +28,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_dept d
</sql>
<select id="selectSysDeptList" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where dept_id in (
select dept_id from (
select dept_id,user_id from sys_user
union all
select dept_id,user_id from sys_user_dept) t
where t.user_id=#{userId})
</select>
<select id="selectDeptListByUserId" parameterType="Long" resultType="Integer">
select p.dept_id