add 新增岗位编码与部门编码 并将岗位放到部门下
parent
3b1e0064c1
commit
bffbb28eed
|
|
@ -1,6 +1,7 @@
|
|||
package org.dromara.system.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
|
|
@ -17,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,16 +133,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ public class SysDept extends TenantEntity {
|
|||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门类别编码
|
||||
*/
|
||||
private String deptCategory;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 岗位排序
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@ public class SysDeptVo implements Serializable {
|
|||
@ExcelProperty(value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门类别编码
|
||||
*/
|
||||
@ExcelProperty(value = "部门类别编码")
|
||||
private String deptCategory;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ 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;
|
||||
|
|
@ -33,6 +35,12 @@ public class SysPostVo implements Serializable {
|
|||
@ExcelProperty(value = "岗位序号")
|
||||
private Long postId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@ExcelProperty(value = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 岗位编码
|
||||
*/
|
||||
|
|
@ -45,6 +53,12 @@ public class SysPostVo implements Serializable {
|
|||
@ExcelProperty(value = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 岗位类别编码
|
||||
*/
|
||||
@ExcelProperty(value = "类别编码")
|
||||
private String postCategory;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
|
|
@ -70,4 +84,10 @@ public class SysPostVo implements Serializable {
|
|||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 查询用户所属岗位组
|
||||
*
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ 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;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
|
|
@ -13,18 +13,21 @@ 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;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,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, 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);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
@ -279,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,
|
||||
|
|
@ -296,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停用)';
|
||||
|
|
@ -310,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', 103, '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, '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
|||
|
|
@ -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、用户信息表
|
||||
|
|
@ -283,7 +285,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,
|
||||
|
|
@ -299,7 +303,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停用)';
|
||||
|
|
@ -313,10 +319,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', 103, '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、角色信息表
|
||||
|
|
|
|||
|
|
@ -100,6 +100,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 '联系电话',
|
||||
|
|
@ -119,16 +120,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', 103, '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, '');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE sys_dept ADD (dept_category varchar2(100) DEFAULT NULL) COMMENT '部门类别编码';
|
||||
COMMENT ON COLUMN sys_dept.dept_category IS '部门类别编码';
|
||||
ALTER TABLE sys_post ADD (dept_id number(20) NOT NULL) COMMENT '部门id';
|
||||
COMMENT ON COLUMN sys_post.dept_id IS '部门id';
|
||||
ALTER TABLE sys_post ADD (post_category VARCHAR2(100) DEFAULT NULL) COMMENT '岗位类别编码';
|
||||
COMMENT ON COLUMN sys_post.post_category IS '岗位类别编码';
|
||||
UPDATE sys_post SET dept_id = 100;
|
||||
UPDATE sys_post SET dept_id = 103 where post_id = 1;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE sys_dept ADD COLUMN dept_category varchar(100) default null::varchar;
|
||||
COMMENT ON COLUMN sys_dept.dept_category IS '客户端';
|
||||
ALTER TABLE sys_post ADD COLUMN dept_id int8 NOT NULL;
|
||||
COMMENT ON COLUMN sys_post.dept_id IS '部门id';
|
||||
ALTER TABLE sys_post ADD COLUMN post_category varchar(100) default null::varchar;
|
||||
COMMENT ON COLUMN sys_post.post_category IS '岗位类别编码';
|
||||
UPDATE sys_post SET dept_id = 100;
|
||||
UPDATE sys_post SET dept_id = 103 where post_id = 1;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
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;
|
||||
UPDATE sys_post SET dept_id = 103 where post_id = 1;
|
||||
Loading…
Reference in New Issue