幼儿园平台新增用户角色与岗位筛选

This commit is contained in:
sk1551 2020-04-20 20:42:35 +08:00
parent 57113cd443
commit c02d46a6bd
10 changed files with 113 additions and 6 deletions

View File

@ -142,7 +142,7 @@
align="center" align="center"
prop="dept.deptName" prop="dept.deptName"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
/> />
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
@ -217,7 +217,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录账号" prop="userName"> <el-form-item label="登录账号" prop="userName">
<el-input v-model="form.userName" placeholder="请输入手机号码" maxlength="11"/> <el-input v-model="form.userName" placeholder="请输入手机号码" maxlength="11" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -407,10 +407,12 @@ export default {
// //
rules: { rules: {
userName: [ userName: [
{ required: true, {
required: true,
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: "请输入正确的手机号码",
trigger: "blur" } trigger: "blur"
}
], ],
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }

View File

@ -1,6 +1,8 @@
package com.ruoyi.project.system.controller; package com.ruoyi.project.system.controller;
import java.util.List; import java.util.List;
import com.ruoyi.project.common.SchoolCommon;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -51,6 +53,9 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired
private SchoolCommon schoolCommon;
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@ -101,10 +106,25 @@ public class SysUserController extends BaseController
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{ {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("roles", roleService.selectRoleAll()); if(schoolCommon.isSchool()==true)
ajax.put("posts", postService.selectPostAll()); {
ajax.put("roles", roleService.selectYeyRoleAll());
ajax.put("posts", postService.selectYeyPostAll());
}else {
ajax.put("roles", roleService.selectRoleAll());
ajax.put("posts", postService.selectPostAll());
}
if (StringUtils.isNotNull(userId)) if (StringUtils.isNotNull(userId))
{ {
if (schoolCommon.isSchool()==true)
{
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectYeyPostListByUserId(userId));
ajax.put("roleIds", roleService.selectYeyRoleListByUserId(userId));
}else {
}
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); ajax.put("roleIds", roleService.selectRoleListByUserId(userId));

View File

@ -25,6 +25,9 @@ public interface SysPostMapper
*/ */
public List<SysPost> selectPostAll(); public List<SysPost> selectPostAll();
//查询所有幼儿园岗位
public List<SysPost> selectYeyPostAll();
/** /**
* 通过岗位ID查询岗位信息 * 通过岗位ID查询岗位信息
* *
@ -33,6 +36,8 @@ public interface SysPostMapper
*/ */
public SysPost selectPostById(Long postId); public SysPost selectPostById(Long postId);
/** /**
* 根据用户ID获取岗位选择框列表 * 根据用户ID获取岗位选择框列表
* *
@ -41,6 +46,9 @@ public interface SysPostMapper
*/ */
public List<Integer> selectPostListByUserId(Long userId); public List<Integer> selectPostListByUserId(Long userId);
//根据用户id获取幼儿园岗位
public List<Integer> selectYeyPostListByUserId(Long userId);
/** /**
* 查询用户所属岗位组 * 查询用户所属岗位组
* *

View File

@ -33,6 +33,9 @@ public interface SysRoleMapper
*/ */
public List<SysRole> selectRoleAll(); public List<SysRole> selectRoleAll();
//查询所有幼儿园角色
public List<SysRole> selectYeyRoleAll();
/** /**
* 根据用户ID获取角色选择框列表 * 根据用户ID获取角色选择框列表
* *
@ -41,6 +44,9 @@ public interface SysRoleMapper
*/ */
public List<Integer> selectRoleListByUserId(Long userId); public List<Integer> selectRoleListByUserId(Long userId);
//根据用户ID获取幼儿园角色
public List<Integer> selectYeyRoleListByUserId(Long userId);
/** /**
* 通过角色ID查询角色 * 通过角色ID查询角色
* *

View File

@ -25,6 +25,9 @@ public interface ISysPostService
*/ */
public List<SysPost> selectPostAll(); public List<SysPost> selectPostAll();
//查询所有幼儿园岗位
public List<SysPost> selectYeyPostAll();
/** /**
* 通过岗位ID查询岗位信息 * 通过岗位ID查询岗位信息
* *
@ -41,6 +44,9 @@ public interface ISysPostService
*/ */
public List<Integer> selectPostListByUserId(Long userId); public List<Integer> selectPostListByUserId(Long userId);
//根据用户id获取幼儿园岗位
public List<Integer> selectYeyPostListByUserId(Long userId);
/** /**
* 校验岗位名称 * 校验岗位名称
* *

View File

@ -34,6 +34,13 @@ public interface ISysRoleService
*/ */
public List<SysRole> selectRoleAll(); public List<SysRole> selectRoleAll();
/**
* 查询所有幼儿园用途标识角色
*
* @return 角色列表
*/
public List<SysRole> selectYeyRoleAll();
/** /**
* 根据用户ID获取角色选择框列表 * 根据用户ID获取角色选择框列表
* *
@ -42,6 +49,9 @@ public interface ISysRoleService
*/ */
public List<Integer> selectRoleListByUserId(Long userId); public List<Integer> selectRoleListByUserId(Long userId);
//根据用户id获取幼儿园角色选择框
public List<Integer> selectYeyRoleListByUserId(Long userId);
/** /**
* 通过角色ID查询角色 * 通过角色ID查询角色
* *

View File

@ -48,6 +48,12 @@ public class SysPostServiceImpl implements ISysPostService
return postMapper.selectPostAll(); return postMapper.selectPostAll();
} }
@Override
public List<SysPost> selectYeyPostAll()
{
return postMapper.selectYeyPostAll();
}
/** /**
* 通过岗位ID查询岗位信息 * 通过岗位ID查询岗位信息
* *
@ -71,6 +77,12 @@ public class SysPostServiceImpl implements ISysPostService
return postMapper.selectPostListByUserId(userId); return postMapper.selectPostListByUserId(userId);
} }
@Override
public List<Integer> selectYeyPostListByUserId(Long userId)
{
return postMapper.selectYeyPostListByUserId(userId);
}
/** /**
* 校验岗位名称是否唯一 * 校验岗位名称是否唯一
* *

View File

@ -85,6 +85,16 @@ public class SysRoleServiceImpl implements ISysRoleService
return roleMapper.selectRoleAll(); return roleMapper.selectRoleAll();
} }
/**
* 查询所有幼儿园角色
*
* @return 角色列表
*/
public List<SysRole> selectYeyRoleAll()
{
return roleMapper.selectYeyRoleAll();
}
/** /**
* 根据用户ID获取角色选择框列表 * 根据用户ID获取角色选择框列表
* *
@ -96,6 +106,13 @@ public class SysRoleServiceImpl implements ISysRoleService
return roleMapper.selectRoleListByUserId(userId); return roleMapper.selectRoleListByUserId(userId);
} }
//根据用户id获取幼儿园角色
@Override
public List<Integer> selectYeyRoleListByUserId(Long userId)
{
return selectYeyRoleListByUserId(userId);
}
/** /**
* 通过角色ID查询角色 * 通过角色ID查询角色
* *

View File

@ -41,6 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPostAll" resultMap="SysPostResult"> <select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
</select> </select>
<select id="selectYeyPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where purp = '1'
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult"> <select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
@ -54,6 +59,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on u.user_id = up.user_id left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectYeyPostListByUserId" parameterType="Long" resultType="Integer">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where p.purp = '1' and u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code select p.post_id, p.post_name, p.post_code

View File

@ -59,6 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRoleAll" resultMap="SysRoleResult"> <select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>
</select> </select>
<select id="selectYeyRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.purpose = '1'
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Integer"> <select id="selectRoleListByUserId" parameterType="Long" resultType="Integer">
select r.role_id select r.role_id
@ -67,6 +72,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_user u on u.user_id = ur.user_id left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectYeyRoleListByUserId" parameterType="Long" resultType="Integer">
select r.role_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
where r.purpose = '1' and u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/> <include refid="selectRoleVo"/>