!520 add 新增岗位编码与部门编码 并将岗位放到部门下

* add 新增岗位编码以及查询
* add 新增部门编码以及查询
This commit is contained in:
AprilWind 2024-04-24 14:29:46 +00:00 committed by 疯狂的狮子Li
parent eb06eb7266
commit 8482203c3b
23 changed files with 267 additions and 84 deletions

View File

@ -1,6 +1,7 @@
package org.dromara.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.ObjectUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.constant.UserConstants;
@ -17,6 +18,7 @@ import org.dromara.system.service.ISysPostService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -112,11 +114,20 @@ public class SysPostController extends BaseController {
* 获取岗位选择框列表
*
* @param postIds 岗位ID串
* @param deptId 部门id
*/
@SaCheckPermission("system:post:query")
@GetMapping("/optionselect")
public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds) {
return R.ok(postService.selectPostByIds(postIds == null ? null : List.of(postIds)));
public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds, @RequestParam(required = false) Long deptId) {
List<SysPostVo> list = new ArrayList<>();
if (ObjectUtil.isNotNull(deptId)) {
SysPostBo post = new SysPostBo();
post.setDeptId(deptId);
list = postService.selectPostList(post);
} else if (postIds != null) {
list = postService.selectPostByIds(List.of(postIds));
}
return R.ok(list);
}
}

View File

@ -132,16 +132,19 @@ public class SysUserController extends BaseController {
SysUserInfoVo userInfoVo = new SysUserInfoVo();
SysRoleBo roleBo = new SysRoleBo();
roleBo.setStatus(UserConstants.ROLE_NORMAL);
SysPostBo postBo = new SysPostBo();
postBo.setStatus(UserConstants.POST_NORMAL);
List<SysRoleVo> roles = roleService.selectRoleList(roleBo);
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
userInfoVo.setPosts(postService.selectPostList(postBo));
if (ObjectUtil.isNotNull(userId)) {
SysUserVo sysUser = userService.selectUserById(userId);
userInfoVo.setUser(sysUser);
userInfoVo.setRoleIds(roleService.selectRoleListByUserId(userId));
userInfoVo.setPostIds(postService.selectPostListByUserId(userId));
Long deptId = sysUser.getDeptId();
if (ObjectUtil.isNotNull(deptId)) {
SysPostBo postBo = new SysPostBo();
postBo.setDeptId(deptId);
userInfoVo.setPosts(postService.selectPostList(postBo));
userInfoVo.setPostIds(postService.selectPostListByUserId(userId));
}
}
return R.ok(userInfoVo);
}

View File

@ -3,9 +3,9 @@ package org.dromara.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import org.dromara.common.tenant.core.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.tenant.core.TenantEntity;
import java.io.Serial;
@ -39,6 +39,11 @@ public class SysDept extends TenantEntity {
*/
private String deptName;
/**
* 部门类别编码
*/
private String deptCategory;
/**
* 显示顺序
*/

View File

@ -23,6 +23,11 @@ public class SysPost extends TenantEntity {
@TableId(value = "post_id")
private Long postId;
/**
* 部门id
*/
private Long deptId;
/**
* 岗位编码
*/
@ -33,6 +38,11 @@ public class SysPost extends TenantEntity {
*/
private String postName;
/**
* 岗位类别编码
*/
private String postCategory;
/**
* 岗位排序
*/

View File

@ -38,6 +38,12 @@ public class SysDeptBo extends BaseEntity {
@Size(min = 0, max = 30, message = "部门名称长度不能超过{max}个字符")
private String deptName;
/**
* 部门类别编码
*/
@Size(min = 0, max = 100, message = "部门类别编码长度不能超过{max}个字符")
private String deptCategory;
/**
* 显示顺序
*/

View File

@ -25,6 +25,17 @@ public class SysPostBo extends BaseEntity {
*/
private Long postId;
/**
* 部门id单部门
*/
@NotNull(message = "部门id不能为空")
private Long deptId;
/**
* 归属部门id部门树
*/
private Long belongDeptId;
/**
* 岗位编码
*/
@ -39,6 +50,12 @@ public class SysPostBo extends BaseEntity {
@Size(min = 0, max = 50, message = "岗位名称长度不能超过{max}个字符")
private String postName;
/**
* 岗位类别编码
*/
@Size(min = 0, max = 100, message = "类别编码长度不能超过{max}个字符")
private String postCategory;
/**
* 显示顺序
*/
@ -55,5 +72,4 @@ public class SysPostBo extends BaseEntity {
*/
private String remark;
}

View File

@ -52,6 +52,12 @@ public class SysDeptVo implements Serializable {
@ExcelProperty(value = "部门名称")
private String deptName;
/**
* 部门类别编码
*/
@ExcelProperty(value = "部门类别编码")
private String deptCategory;
/**
* 显示顺序
*/

View File

@ -2,18 +2,18 @@ package org.dromara.system.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.system.domain.SysPost;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.system.domain.SysPost;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 岗位信息视图对象 sys_post
*
@ -33,6 +33,12 @@ public class SysPostVo implements Serializable {
@ExcelProperty(value = "岗位序号")
private Long postId;
/**
* 部门id
*/
@ExcelProperty(value = "部门id")
private Long deptId;
/**
* 岗位编码
*/
@ -45,6 +51,12 @@ public class SysPostVo implements Serializable {
@ExcelProperty(value = "岗位名称")
private String postName;
/**
* 岗位类别编码
*/
@ExcelProperty(value = "类别编码")
private String postCategory;
/**
* 显示顺序
*/
@ -70,4 +82,10 @@ public class SysPostVo implements Serializable {
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 部门名
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
private String deptName;
}

View File

@ -1,5 +1,11 @@
package org.dromara.system.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.annotation.DataColumn;
import org.dromara.common.mybatis.annotation.DataPermission;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.system.domain.SysPost;
import org.dromara.system.domain.vo.SysPostVo;
@ -13,6 +19,12 @@ import java.util.List;
*/
public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> {
@DataPermission({
@DataColumn(key = "deptName", value = "d.dept_id"),
@DataColumn(key = "userName", value = "p.create_by")
})
Page<SysPostVo> selectPagePostList(@Param("page") Page<SysPostVo> page, @Param(Constants.WRAPPER) Wrapper<SysPost> queryWrapper);
/**
* 查询用户所属岗位组
*

View File

@ -82,6 +82,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId());
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
lqw.like(StringUtils.isNotBlank(bo.getDeptCategory()), SysDept::getDeptCategory, bo.getDeptCategory());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
lqw.orderByAsc(SysDept::getAncestors);
lqw.orderByAsc(SysDept::getParentId);

View File

@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.constant.UserConstants;
@ -14,10 +13,13 @@ import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.SysPost;
import org.dromara.system.domain.SysUserPost;
import org.dromara.system.domain.bo.SysPostBo;
import org.dromara.system.domain.vo.SysPostVo;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.system.mapper.SysPostMapper;
import org.dromara.system.mapper.SysUserPostMapper;
import org.dromara.system.service.ISysPostService;
@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 岗位信息 服务层处理
@ -36,12 +39,12 @@ import java.util.List;
public class SysPostServiceImpl implements ISysPostService {
private final SysPostMapper baseMapper;
private final SysDeptMapper deptMapper;
private final SysUserPostMapper userPostMapper;
@Override
public TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(post);
Page<SysPostVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
Page<SysPostVo> page = baseMapper.selectPagePostList(pageQuery.build(), buildQueryWrapper(post));
return TableDataInfo.build(page);
}
@ -53,17 +56,39 @@ public class SysPostServiceImpl implements ISysPostService {
*/
@Override
public List<SysPostVo> selectPostList(SysPostBo post) {
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(post);
return baseMapper.selectVoList(lqw);
return baseMapper.selectVoList(buildQueryWrapper(post));
}
/**
* 根据查询条件构建查询包装器
*
* @param bo 查询条件对象
* @return 构建好的查询包装器
*/
private LambdaQueryWrapper<SysPost> buildQueryWrapper(SysPostBo bo) {
LambdaQueryWrapper<SysPost> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getPostCode()), SysPost::getPostCode, bo.getPostCode());
lqw.like(StringUtils.isNotBlank(bo.getPostName()), SysPost::getPostName, bo.getPostName());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysPost::getStatus, bo.getStatus());
lqw.orderByAsc(SysPost::getPostSort);
return lqw;
LambdaQueryWrapper<SysPost> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(bo.getPostCode()), SysPost::getPostCode, bo.getPostCode())
.like(StringUtils.isNotBlank(bo.getPostCategory()), SysPost::getPostCategory, bo.getPostCategory())
.like(StringUtils.isNotBlank(bo.getPostName()), SysPost::getPostName, bo.getPostName())
.eq(StringUtils.isNotBlank(bo.getStatus()), SysPost::getStatus, bo.getStatus())
.orderByAsc(SysPost::getPostSort);
if (ObjectUtil.isNotNull(bo.getDeptId())) {
//优先单部门搜索
wrapper.eq(SysPost::getDeptId, bo.getDeptId());
} else if (ObjectUtil.isNotNull(bo.getBelongDeptId())) {
//部门树搜索
wrapper.and(x -> {
List<Long> deptIds = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
.select(SysDept::getDeptId)
.apply(DataBaseHelper.findInSet(bo.getBelongDeptId(), "ancestors")))
.stream()
.map(SysDept::getDeptId)
.collect(Collectors.toList());
deptIds.add(bo.getBelongDeptId());
x.in(SysPost::getDeptId, deptIds);
});
}
return wrapper;
}
/**

View File

@ -7,8 +7,19 @@
<resultMap type="org.dromara.system.domain.vo.SysPostVo" id="SysPostResult">
</resultMap>
<select id="selectPagePostList" resultMap="SysPostResult">
select
<if test="ew.getSqlSelect != null">
${ew.getSqlSelect}
</if>
<if test="ew.getSqlSelect == null">
*
</if>
from sys_post ${ew.getCustomSqlSegment}
</select>
<select id="selectPostsByUserId" parameterType="Long" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
select p.post_id, p.dept_id, p.post_name, p.post_code, p.post_category
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

View File

@ -165,6 +165,7 @@ create table sys_dept (
parent_id number(20) default 0,
ancestors varchar2(500) default '',
dept_name varchar2(30) default '',
dept_category varchar2(100) default null,
order_num number(4) default 0,
leader number(20) default null,
phone varchar2(11) default null,
@ -186,6 +187,7 @@ comment on column sys_dept.tenant_id is '租户编号';
comment on column sys_dept.parent_id is '父部门id';
comment on column sys_dept.ancestors is '祖级列表';
comment on column sys_dept.dept_name is '部门名称';
comment on column sys_dept.dept_category is '部门类别编码';
comment on column sys_dept.order_num is '显示顺序';
comment on column sys_dept.leader is '负责人';
comment on column sys_dept.phone is '联系电话';
@ -201,16 +203,17 @@ comment on column sys_dept.update_time is '更新时间';
-- ----------------------------
-- 初始化-部门表数据
-- ----------------------------
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', 0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', 1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', 3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', 4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', 5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', null,0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', null,1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', null,3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', null,4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', null,5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate, null, null);
-- ----------------------------
@ -278,7 +281,9 @@ insert into sys_user values(4, '000000', 102, 'test1', '仅本人 密码666666',
create table sys_post (
post_id number(20) not null,
tenant_id varchar2(20) default '000000',
dept_id number(20) not null,
post_code varchar2(64) not null,
post_category varchar2(64) default null,
post_name varchar2(50) not null,
post_sort number(4) not null,
status char(1) not null,
@ -295,7 +300,9 @@ alter table sys_post add constraint pk_sys_post primary key (post_id);
comment on table sys_post is '岗位信息表';
comment on column sys_post.post_id is '岗位ID';
comment on column sys_post.tenant_id is '租户编号';
comment on column sys_post.dept_id is '部门id';
comment on column sys_post.post_code is '岗位编码';
comment on column sys_post.post_category is '岗位类别编码';
comment on column sys_post.post_name is '岗位名称';
comment on column sys_post.post_sort is '显示顺序';
comment on column sys_post.status is '状态0正常 1停用';
@ -309,10 +316,10 @@ comment on column sys_post.remark is '备注';
-- ----------------------------
-- 初始化-岗位信息表数据
-- ----------------------------
insert into sys_post values(1, '000000', 'ceo', '董事长', 1, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(2, '000000', 'se', '项目经理', 2, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(3, '000000', 'hr', '人力资源', 3, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(4, '000000', 'user', '普通员工', 4, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(1, '000000', 100, 'ceo', null, '董事长', 1, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(2, '000000', 100, 'se', null, '项目经理', 2, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(3, '000000', 100, 'hr', null, '人力资源', 3, '0', 103, 1, sysdate, null, null, '');
insert into sys_post values(4, '000000', 100, 'user', null, '普通员工', 4, '0', 103, 1, sysdate, null, null, '');
-- ----------------------------

View File

@ -169,6 +169,7 @@ create table if not exists sys_dept
parent_id int8 default 0,
ancestors varchar(500)default ''::varchar,
dept_name varchar(30) default ''::varchar,
dept_category varchar(100) default null::varchar,
order_num int4 default 0,
leader int8 default null,
phone varchar(11) default null::varchar,
@ -189,6 +190,7 @@ comment on column sys_dept.tenant_id is '租户编号';
comment on column sys_dept.parent_id is '父部门ID';
comment on column sys_dept.ancestors is '祖级列表';
comment on column sys_dept.dept_name is '部门名称';
comment on column sys_dept.dept_category is '部门类别编码';
comment on column sys_dept.order_num is '显示顺序';
comment on column sys_dept.leader is '负责人';
comment on column sys_dept.phone is '联系电话';
@ -204,16 +206,16 @@ comment on column sys_dept.update_time is '更新时间';
-- ----------------------------
-- 初始化-部门表数据
-- ----------------------------
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', 0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', 1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', 3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', 4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', 5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', null,0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', null,1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', null,3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', null,4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', null,5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, now(), null, null);
-- ----------------------------
-- 2、用户信息表
@ -282,7 +284,9 @@ create table if not exists sys_post
(
post_id int8,
tenant_id varchar(20) default '000000'::varchar,
dept_id int8,
post_code varchar(64) not null,
post_category varchar(100) default null,
post_name varchar(50) not null,
post_sort int4 not null,
status char not null,
@ -298,7 +302,9 @@ create table if not exists sys_post
comment on table sys_post is '岗位信息表';
comment on column sys_post.post_id is '岗位ID';
comment on column sys_post.tenant_id is '租户编号';
comment on column sys_post.dept_id is '部门id';
comment on column sys_post.post_code is '岗位编码';
comment on column sys_post.post_category is '岗位类别编码';
comment on column sys_post.post_name is '岗位名称';
comment on column sys_post.post_sort is '显示顺序';
comment on column sys_post.status is '状态0正常 1停用';
@ -312,10 +318,10 @@ comment on column sys_post.remark is '备注';
-- ----------------------------
-- 初始化-岗位信息表数据
-- ----------------------------
insert into sys_post values(1, '000000', 'ceo', '董事长', 1, '0', 103, 1, now(), null, null, '');
insert into sys_post values(2, '000000', 'se', '项目经理', 2, '0', 103, 1, now(), null, null, '');
insert into sys_post values(3, '000000', 'hr', '人力资源', 3, '0', 103, 1, now(), null, null, '');
insert into sys_post values(4, '000000', 'user', '普通员工', 4, '0', 103, 1, now(), null, null, '');
insert into sys_post values(1, '000000', 100, 'ceo', null, '董事长', 1, '0', 103, 1, now(), null, null, '');
insert into sys_post values(2, '000000', 100, 'se', null, '项目经理', 2, '0', 103, 1, now(), null, null, '');
insert into sys_post values(3, '000000', 100, 'hr', null, '人力资源', 3, '0', 103, 1, now(), null, null, '');
insert into sys_post values(4, '000000', 100, 'user', null, '普通员工', 4, '0', 103, 1, now(), null, null, '');
-- ----------------------------
-- 4、角色信息表

View File

@ -101,6 +101,7 @@ create table sys_dept (
parent_id bigint(20) default 0 comment '父部门id',
ancestors varchar(500) default '' comment '祖级列表',
dept_name varchar(30) default '' comment '部门名称',
dept_category varchar(100) default null comment '部门类别编码',
order_num int(4) default 0 comment '显示顺序',
leader bigint(20) default null comment '负责人',
phone varchar(11) default null comment '联系电话',
@ -120,16 +121,16 @@ create table sys_dept (
-- ----------------------------
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', 0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', 1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', 3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', 4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', 5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', 1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', 2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(100, '000000', 0, '0', 'XXX科技', null,0, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(101, '000000', 100, '0,100', '深圳总公司', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(102, '000000', 100, '0,100', '长沙分公司', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(103, '000000', 101, '0,100,101', '研发部门', null,1, 1, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(104, '000000', 101, '0,100,101', '市场部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(105, '000000', 101, '0,100,101', '测试部门', null,3, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(106, '000000', 101, '0,100,101', '财务部门', null,4, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(107, '000000', 101, '0,100,101', '运维部门', null,5, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(108, '000000', 102, '0,100,102', '市场部门', null,1, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
insert into sys_dept values(109, '000000', 102, '0,100,102', '财务部门', null,2, null, '15888888888', 'xxx@qq.com', '0', '0', 103, 1, sysdate(), null, null);
-- ----------------------------
@ -174,7 +175,9 @@ create table sys_post
(
post_id bigint(20) not null comment '岗位ID',
tenant_id varchar(20) default '000000' comment '租户编号',
dept_id bigint(20) not null comment '部门id',
post_code varchar(64) not null comment '岗位编码',
post_category varchar(100) default null comment '岗位类别编码',
post_name varchar(50) not null comment '岗位名称',
post_sort int(4) not null comment '显示顺序',
status char(1) not null comment '状态0正常 1停用',
@ -190,10 +193,10 @@ create table sys_post
-- ----------------------------
-- 初始化-岗位信息表数据
-- ----------------------------
insert into sys_post values(1, '000000', 'ceo', '董事长', 1, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(2, '000000', 'se', '项目经理', 2, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(3, '000000', 'hr', '人力资源', 3, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(4, '000000', 'user', '普通员工', 4, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(1, '000000', 100, 'ceo', null, '董事长', 1, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(2, '000000', 100, 'se', null, '项目经理', 2, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(3, '000000', 100, 'hr', null, '人力资源', 3, '0', 103, 1, sysdate(), null, null, '');
insert into sys_post values(4, '000000', 100, 'user', null, '普通员工', 4, '0', 103, 1, sysdate(), null, null, '');
-- ----------------------------

View File

@ -926,7 +926,8 @@ CREATE TABLE sys_dept
tenant_id nvarchar(20) DEFAULT ('000000') NULL,
parent_id bigint DEFAULT ((0)) NULL,
ancestors nvarchar(500)DEFAULT '' NULL,
dept_name nvarchar(30) DEFAULT '' NULL,
dept_name nvarchar(30) NULL,
dept_category nvarchar(100) DEFAULT '' NULL,
order_num int DEFAULT ((0)) NULL,
leader bigint NULL,
phone nvarchar(11) NULL,
@ -975,6 +976,12 @@ EXEC sys.sp_addextendedproperty
'TABLE', N'sys_dept',
'COLUMN', N'dept_name'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'部门类别编码' ,
'SCHEMA', N'dbo',
'TABLE', N'sys_dept',
'COLUMN', N'dept_category'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'显示顺序' ,
'SCHEMA', N'dbo',
@ -1047,25 +1054,25 @@ EXEC sys.sp_addextendedproperty
'TABLE', N'sys_dept'
GO
INSERT sys_dept VALUES (100, N'000000', 0, N'0', N'XXX科技', 0, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (100, N'000000', 0, N'0', N'XXX科技', NULL, 0, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (101, N'000000', 100, N'0,100', N'深圳总公司', 1, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (101, N'000000', 100, N'0,100', N'深圳总公司', NULL, 1, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (102, N'000000', 100, N'0,100', N'长沙分公司', 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (102, N'000000', 100, N'0,100', N'长沙分公司', NULL, 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (103, N'000000', 101, N'0,100,101', N'研发部门', 1, 1, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (103, N'000000', 101, N'0,100,101', N'研发部门', NULL, 1, 1, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (104, N'000000', 101, N'0,100,101', N'市场部门', 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (104, N'000000', 101, N'0,100,101', N'市场部门', NULL, 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (105, N'000000', 101, N'0,100,101', N'测试部门', 3, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (105, N'000000', 101, N'0,100,101', N'测试部门', NULL, 3, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (106, N'000000', 101, N'0,100,101', N'财务部门', 4, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (106, N'000000', 101, N'0,100,101', N'财务部门', NULL, 4, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (107, N'000000', 101, N'0,100,101', N'运维部门', 5, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (107, N'000000', 101, N'0,100,101', N'运维部门', NULL, 5, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (108, N'000000', 102, N'0,100,102', N'市场部门', 1, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (108, N'000000', 102, N'0,100,102', N'市场部门', NULL, 1, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
INSERT sys_dept VALUES (109, N'000000', 102, N'0,100,102', N'财务部门', 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
INSERT sys_dept VALUES (109, N'000000', 102, N'0,100,102', N'财务部门', NULL, 2, NULL, N'15888888888', N'xxx@qq.com', N'0', N'0', 103, 1, getdate(), NULL, NULL)
GO
CREATE TABLE sys_dict_data
@ -2135,7 +2142,9 @@ CREATE TABLE sys_post
(
post_id bigint NOT NULL,
tenant_id nvarchar(20) DEFAULT ('000000') NULL,
dept_id bigint NOT NULL,
post_code nvarchar(64) NOT NULL,
post_category nvarchar(100) NULL,
post_name nvarchar(50) NOT NULL,
post_sort int NOT NULL,
status nchar(1) NOT NULL,
@ -2164,12 +2173,24 @@ EXEC sys.sp_addextendedproperty
'TABLE', N'sys_post',
'COLUMN', N'tenant_id'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'部门id' ,
'SCHEMA', N'dbo',
'TABLE', N'dept_id',
'COLUMN', N'tenant_id'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'岗位编码' ,
'SCHEMA', N'dbo',
'TABLE', N'sys_post',
'COLUMN', N'post_code'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'岗位类别编码' ,
'SCHEMA', N'dbo',
'TABLE', N'post_category',
'COLUMN', N'post_code'
GO
EXEC sys.sp_addextendedproperty
'MS_Description', N'岗位名称' ,
'SCHEMA', N'dbo',
@ -2230,13 +2251,13 @@ EXEC sys.sp_addextendedproperty
'TABLE', N'sys_post'
GO
INSERT sys_post VALUES (1, N'000000', N'ceo', N'董事长', 1, N'0', 103, 1, getdate(), NULL, NULL, N'')
INSERT sys_post VALUES (1, N'000000', 100, N'ceo',NULL, N'董事长', 1, N'0', 103, 1, getdate(), NULL, NULL, N'')
GO
INSERT sys_post VALUES (2, N'000000', N'se', N'项目经理', 2, N'0', 103, 1, getdate(), NULL, NULL, N'')
INSERT sys_post VALUES (2, N'000000', 100, N'se',NULL, N'项目经理', 2, N'0', 103, 1, getdate(), NULL, NULL, N'')
GO
INSERT sys_post VALUES (3, N'000000', N'hr', N'人力资源', 3, N'0', 103, 1, getdate(), NULL, NULL, N'')
INSERT sys_post VALUES (3, N'000000', 100, N'hr',NULL, N'人力资源', 3, N'0', 103, 1, getdate(), NULL, NULL, N'')
GO
INSERT sys_post VALUES (4, N'000000', N'user', N'普通员工', 4, N'0', 103, 1, getdate(), NULL, NULL, N'')
INSERT sys_post VALUES (4, N'000000', 100, N'user',NULL, N'普通员工', 4, N'0', 103, 1, getdate(), NULL, NULL, N'')
GO
CREATE TABLE sys_role

View File

@ -3,3 +3,4 @@ insert into sys_menu values('1620', '配置列表', '118', '5', '#', '', '', 1,
insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:add', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:edit', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:remove', '#', 103, 1, sysdate, null, null, '');

View File

@ -0,0 +1,3 @@
ALTER TABLE sys_dept ADD dept_category VARCHAR2(100) DEFAULT NULL COMMENT '部门类别编码';
ALTER TABLE sys_post ADD dept_id NUMBER(20) NOT NULL COMMENT '部门id', ADD post_category VARCHAR2(100) DEFAULT NULL COMMENT '岗位类别编码';
UPDATE sys_post SET dept_id = 100;

View File

@ -3,4 +3,3 @@ insert into sys_menu values('1620', '配置列表', '118', '5', '#', '', '', '1'
insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', '1', '0', 'F', '0', '0', 'system:ossConfig:add', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', '1', '0', 'F', '0', '0', 'system:ossConfig:edit', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', '1', '0', 'F', '0', '0', 'system:ossConfig:remove', '#', 103, 1, now(), null, null, '');

View File

@ -0,0 +1,6 @@
ALTER TABLE sys_dept
ADD COLUMN dept_category VARCHAR(100) DEFAULT NULL COMMENT '部门类别编码';
ALTER TABLE sys_post
ADD COLUMN dept_id BIGINT NOT NULL COMMENT '部门id',
ADD COLUMN post_category VARCHAR(100) DEFAULT NULL COMMENT '岗位类别编码';
UPDATE sys_post SET dept_id = 100;

View File

@ -0,0 +1,11 @@
ALTER TABLE sys_dept ADD dept_category VARCHAR(100) DEFAULT NULL;
EXEC sp_addextendedproperty 'MS_Description', '部门类别编码', 'SCHEMA', 'dbo', 'TABLE', 'sys_dept', 'COLUMN', 'dept_category';
GO
ALTER TABLE sys_post ADD dept_id BIGINT NOT NULL;
GO
ALTER TABLE sys_post ADD post_category VARCHAR(100) DEFAULT NULL;
EXEC sp_addextendedproperty 'MS_Description', '部门id', 'SCHEMA', 'dbo', 'TABLE', 'sys_post', 'COLUMN', 'dept_id';
EXEC sp_addextendedproperty 'MS_Description', '岗位类别编码', 'SCHEMA', 'dbo', 'TABLE', 'sys_post', 'COLUMN', 'post_category';
GO
UPDATE sys_post SET dept_id = 100;
GO

View File

@ -3,4 +3,3 @@ insert into sys_menu values('1620', '配置列表', '118', '5', '#', '', '', 1,
insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:add', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:edit', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', 1, 0, 'F', '0', '0', 'system:ossConfig:remove', '#', 103, 1, sysdate(), null, null, '');

View File

@ -0,0 +1,3 @@
ALTER TABLE sys_dept ADD dept_category VARCHAR(100) DEFAULT NULL COMMENT '部门类别编码';
ALTER TABLE sys_post ADD dept_id BIGINT(20) NOT NULL COMMENT '部门id', ADD post_category VARCHAR(100) DEFAULT NULL COMMENT '岗位类别编码';
UPDATE sys_post SET dept_id = 100;