优化:部门新增类型字段,用于标识部门是系统内置或自定义
1.系统内置部门不允许禁用、删除、修改上级部门 2.抽取 getAncestors 方法,用于复用获取祖级列表 3.删除部门时,自动删除角色和部门关联
This commit is contained in:
parent
6b73aeb8a9
commit
b345e4450d
@ -144,7 +144,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "新增数据")
|
||||
@ResponseBody
|
||||
@PostMapping
|
||||
protected R<Long> add(@Validated @RequestBody C request) {
|
||||
protected R<Long> add(@Validated(BaseRequest.Add.class) @RequestBody C request) {
|
||||
this.checkPermission("add");
|
||||
Long id = baseService.add(request);
|
||||
return R.ok("新增成功", id);
|
||||
@ -162,7 +162,7 @@ public abstract class BaseController<S extends BaseService<V, D, Q, C>, V, D, Q,
|
||||
@Operation(summary = "修改数据")
|
||||
@ResponseBody
|
||||
@PutMapping("/{id}")
|
||||
protected R update(@Validated @RequestBody C request, @PathVariable Long id) {
|
||||
protected R update(@Validated(BaseRequest.Update.class) @RequestBody C request, @PathVariable Long id) {
|
||||
this.checkPermission("update");
|
||||
baseService.update(request, id);
|
||||
return R.ok("修改成功");
|
||||
|
@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
/**
|
||||
* VO 基类
|
||||
@ -63,4 +64,10 @@ public class BaseVO implements Serializable {
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否禁用修改
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean disabled;
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.cnadmin.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseEnum;
|
||||
|
||||
/**
|
||||
* 数据类型枚举
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/3/19 12:17
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum DataTypeEnum implements BaseEnum<Integer, String> {
|
||||
|
||||
/** 系统内置 */
|
||||
SYSTEM(1, "系统内置"),
|
||||
|
||||
/** 自定义 */
|
||||
CUSTOM(2, "自定义"),;
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
}
|
@ -21,6 +21,7 @@ import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseDO;
|
||||
import top.charles7c.cnadmin.common.enums.DataTypeEnum;
|
||||
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
|
||||
/**
|
||||
@ -64,4 +65,9 @@ public class DeptDO extends BaseDO {
|
||||
* 状态(1:启用,2:禁用)
|
||||
*/
|
||||
private DisEnableStatusEnum status;
|
||||
|
||||
/**
|
||||
* 类型(1:系统内置,2:自定义)
|
||||
*/
|
||||
private DataTypeEnum type;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ public class DeptRequest extends BaseRequest {
|
||||
/**
|
||||
* 上级部门 ID
|
||||
*/
|
||||
@NotNull(message = "上级部门不能为空", groups = Add.class)
|
||||
@Schema(description = "上级部门 ID")
|
||||
private Long parentId;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseDetailVO;
|
||||
import top.charles7c.cnadmin.common.config.easyexcel.ExcelBaseEnumConverter;
|
||||
import top.charles7c.cnadmin.common.enums.DataTypeEnum;
|
||||
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
|
||||
/**
|
||||
@ -75,10 +76,22 @@ public class DeptDetailVO extends BaseDetailVO {
|
||||
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
|
||||
private DisEnableStatusEnum status;
|
||||
|
||||
/**
|
||||
* 类型(1:系统内置,2:自定义)
|
||||
*/
|
||||
@Schema(description = "类型(1:系统内置,2:自定义)")
|
||||
@ExcelProperty(value = "类型", converter = ExcelBaseEnumConverter.class)
|
||||
private DataTypeEnum type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述")
|
||||
@ExcelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public Boolean getDisabled() {
|
||||
return DataTypeEnum.SYSTEM.equals(type);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import top.charles7c.cnadmin.common.annotation.TreeField;
|
||||
import top.charles7c.cnadmin.common.base.BaseVO;
|
||||
import top.charles7c.cnadmin.common.enums.DataTypeEnum;
|
||||
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
|
||||
/**
|
||||
@ -63,9 +64,20 @@ public class DeptVO extends BaseVO {
|
||||
@Schema(description = "状态(1:启用,2:禁用)")
|
||||
private DisEnableStatusEnum status;
|
||||
|
||||
/**
|
||||
* 类型(1:系统内置,2:自定义)
|
||||
*/
|
||||
@Schema(description = "类型(1:系统内置,2:自定义)")
|
||||
private DataTypeEnum type;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Override
|
||||
public Boolean getDisabled() {
|
||||
return DataTypeEnum.SYSTEM.equals(type);
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseVO;
|
||||
import top.charles7c.cnadmin.common.constant.SysConsts;
|
||||
import top.charles7c.cnadmin.common.enums.DataScopeEnum;
|
||||
@ -77,16 +75,8 @@ public class RoleVO extends BaseVO {
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否禁用修改
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean disabled;
|
||||
|
||||
@Override
|
||||
public Boolean getDisabled() {
|
||||
if (SysConsts.ADMIN_ROLE_CODE.equals(code)) {
|
||||
return true;
|
||||
}
|
||||
return disabled;
|
||||
return SysConsts.ADMIN_ROLE_CODE.equals(code);
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseVO;
|
||||
@ -93,17 +91,9 @@ public class UserVO extends BaseVO {
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否禁用修改
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean disabled;
|
||||
|
||||
@Override
|
||||
public Boolean getDisabled() {
|
||||
if (Objects.equals(this.getId(), LoginHelper.getUserId())) {
|
||||
return true;
|
||||
}
|
||||
return disabled;
|
||||
return Objects.equals(this.getId(), LoginHelper.getUserId());
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
|
@ -44,4 +44,12 @@ public interface RoleDeptService {
|
||||
* @return 部门 ID 列表
|
||||
*/
|
||||
List<Long> listDeptIdByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据部门 ID 删除
|
||||
*
|
||||
* @param deptIds
|
||||
* 部门 ID 列表
|
||||
*/
|
||||
void deleteByDeptIds(List<Long> deptIds);
|
||||
}
|
@ -19,6 +19,7 @@ package top.charles7c.cnadmin.system.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -28,9 +29,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseServiceImpl;
|
||||
import top.charles7c.cnadmin.common.constant.SysConsts;
|
||||
import top.charles7c.cnadmin.common.enums.DataTypeEnum;
|
||||
import top.charles7c.cnadmin.common.enums.DisEnableStatusEnum;
|
||||
import top.charles7c.cnadmin.common.util.ExceptionUtils;
|
||||
import top.charles7c.cnadmin.common.util.validate.CheckUtils;
|
||||
@ -41,6 +44,7 @@ import top.charles7c.cnadmin.system.model.request.DeptRequest;
|
||||
import top.charles7c.cnadmin.system.model.vo.DeptDetailVO;
|
||||
import top.charles7c.cnadmin.system.model.vo.DeptVO;
|
||||
import top.charles7c.cnadmin.system.service.DeptService;
|
||||
import top.charles7c.cnadmin.system.service.RoleDeptService;
|
||||
import top.charles7c.cnadmin.system.service.UserService;
|
||||
|
||||
/**
|
||||
@ -54,6 +58,7 @@ import top.charles7c.cnadmin.system.service.UserService;
|
||||
public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptVO, DeptDetailVO, DeptQuery, DeptRequest>
|
||||
implements DeptService {
|
||||
|
||||
private final RoleDeptService roleDeptService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@ -62,12 +67,10 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptVO,
|
||||
public Long add(DeptRequest request) {
|
||||
String name = request.getName();
|
||||
boolean isExists = this.checkNameExists(name, request.getParentId(), null);
|
||||
CheckUtils.throwIf(() -> isExists, String.format("新增失败,'%s'已存在", name));
|
||||
CheckUtils.throwIf(() -> isExists, String.format("新增失败,'%s' 已存在", name));
|
||||
|
||||
request.setAncestors(this.getAncestors(request.getParentId()));
|
||||
request.setStatus(DisEnableStatusEnum.ENABLE);
|
||||
DeptDO parentDept = baseMapper.selectById(request.getParentId());
|
||||
CheckUtils.throwIfNull(parentDept, "上级部门不存在");
|
||||
request.setAncestors(String.format("%s,%s", parentDept.getAncestors(), request.getParentId()));
|
||||
return super.add(request);
|
||||
}
|
||||
|
||||
@ -76,15 +79,21 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptVO,
|
||||
public void update(DeptRequest request, Long id) {
|
||||
String name = request.getName();
|
||||
boolean isExists = this.checkNameExists(name, request.getParentId(), id);
|
||||
CheckUtils.throwIf(() -> isExists, String.format("修改失败,'%s'已存在", name));
|
||||
CheckUtils.throwIf(() -> isExists, String.format("修改失败,'%s' 已存在", name));
|
||||
DeptDO oldDept = this.getById(id);
|
||||
CheckUtils.throwIf(
|
||||
() -> DisEnableStatusEnum.DISABLE.equals(request.getStatus())
|
||||
&& DataTypeEnum.SYSTEM.equals(oldDept.getType()),
|
||||
String.format("'%s' 是系统内置部门,不允许禁用", oldDept.getName()));
|
||||
|
||||
DeptDO oldDept = baseMapper.selectById(id);
|
||||
// 更新祖级列表
|
||||
if (!Objects.equals(oldDept.getParentId(), request.getParentId())) {
|
||||
DeptDO newParentDept = baseMapper.selectById(request.getParentId());
|
||||
CheckUtils.throwIfNull(newParentDept, "上级部门不存在");
|
||||
request.setAncestors(String.format("%s,%s", newParentDept.getAncestors(), request.getParentId()));
|
||||
this.updateChildrenAncestors(id, request.getAncestors(), oldDept.getAncestors());
|
||||
// 变更上级部门
|
||||
if (ObjectUtil.notEqual(oldDept.getParentId(), request.getParentId())) {
|
||||
CheckUtils.throwIf(() -> DataTypeEnum.SYSTEM.equals(oldDept.getType()),
|
||||
String.format("'%s' 是系统内置部门,不允许变更上级部门", oldDept.getName()));
|
||||
// 更新祖级列表
|
||||
String newAncestors = this.getAncestors(request.getParentId());
|
||||
request.setAncestors(newAncestors);
|
||||
this.updateChildrenAncestors(newAncestors, oldDept.getAncestors(), id);
|
||||
}
|
||||
super.update(request, id);
|
||||
}
|
||||
@ -92,9 +101,19 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptVO,
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> ids) {
|
||||
List<DeptDO> list =
|
||||
baseMapper.lambdaQuery().select(DeptDO::getName, DeptDO::getType).in(DeptDO::getId, ids).list();
|
||||
Optional<DeptDO> isSystemData = list.stream().filter(d -> DataTypeEnum.SYSTEM.equals(d.getType())).findFirst();
|
||||
CheckUtils.throwIf(isSystemData::isPresent,
|
||||
String.format("所选部门 '%s' 是系统内置部门,不允许删除", isSystemData.orElseGet(DeptDO::new).getName()));
|
||||
CheckUtils.throwIf(() -> userService.countByDeptIds(ids) > 0, "所选部门存在用户关联,请解除关联后重试");
|
||||
|
||||
// 删除部门
|
||||
super.delete(ids);
|
||||
// 删除子部门
|
||||
baseMapper.lambdaUpdate().in(DeptDO::getParentId, ids).remove();
|
||||
// 删除角色和部门关联
|
||||
roleDeptService.deleteByDeptIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,17 +144,30 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptVO,
|
||||
.ne(id != null, DeptDO::getId, id).exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取祖级列表
|
||||
*
|
||||
* @param parentId
|
||||
* 上级部门
|
||||
* @return 祖级列表
|
||||
*/
|
||||
private String getAncestors(Long parentId) {
|
||||
DeptDO parentDept = baseMapper.selectById(parentId);
|
||||
CheckUtils.throwIfNull(parentDept, "上级部门不存在");
|
||||
return String.format("%s,%s", parentDept.getAncestors(), parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新子部门祖级列表
|
||||
*
|
||||
* @param id
|
||||
* ID
|
||||
* @param newAncestors
|
||||
* 新祖级列表
|
||||
* @param oldAncestors
|
||||
* 原祖级列表
|
||||
* @param id
|
||||
* ID
|
||||
*/
|
||||
private void updateChildrenAncestors(Long id, String newAncestors, String oldAncestors) {
|
||||
private void updateChildrenAncestors(String newAncestors, String oldAncestors, Long id) {
|
||||
List<DeptDO> children =
|
||||
baseMapper.lambdaQuery().apply(String.format("find_in_set(%s, `ancestors`)", id)).list();
|
||||
if (CollUtil.isEmpty(children)) {
|
||||
|
@ -58,4 +58,9 @@ public class RoleDeptServiceImpl implements RoleDeptService {
|
||||
public List<Long> listDeptIdByRoleId(Long roleId) {
|
||||
return roleDeptMapper.selectDeptIdByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByDeptIds(List<Long> deptIds) {
|
||||
roleDeptMapper.lambdaUpdate().in(RoleDeptDO::getDeptId, deptIds).remove();
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,14 @@ export interface DeptRecord {
|
||||
description?: string;
|
||||
sort: number;
|
||||
status?: number;
|
||||
type?: number;
|
||||
createUserString?: string;
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
children?: Array<DeptRecord>;
|
||||
parentName?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface DeptParam {
|
||||
|
@ -129,13 +129,18 @@
|
||||
v-model="record.status"
|
||||
:checked-value="1"
|
||||
:unchecked-value="2"
|
||||
:disabled="!checkPermission(['system:dept:update'])"
|
||||
:disabled="record.disabled || !checkPermission(['system:dept:update'])"
|
||||
@change="handleChangeStatus(record)"
|
||||
/>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="类型" align="center">
|
||||
<template #cell="{ record }">
|
||||
<a-tag v-if="record.type === 1" color="red">系统内置</a-tag>
|
||||
<a-tag v-else color="arcoblue">自定义</a-tag>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="描述" data-index="description" />
|
||||
<a-table-column title="创建人" data-index="createUserString" />
|
||||
<a-table-column title="创建时间" data-index="createTime" />
|
||||
<a-table-column
|
||||
v-if="checkPermission(['system:dept:update', 'system:dept:delete'])"
|
||||
@ -162,6 +167,7 @@
|
||||
type="text"
|
||||
size="small"
|
||||
title="删除"
|
||||
:disabled="record.disabled"
|
||||
>
|
||||
<template #icon><icon-delete /></template>删除
|
||||
</a-button>
|
||||
@ -182,7 +188,7 @@
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" size="large">
|
||||
<a-form-item label="上级部门" field="parentId">
|
||||
<a-form-item label="上级部门" field="parentId" :disabled="form.disabled">
|
||||
<a-tree-select
|
||||
v-model="form.parentId"
|
||||
:data="treeData"
|
||||
@ -345,6 +351,7 @@
|
||||
form: {} as DeptRecord,
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
parentId: [{ required: true, message: '请选择上级部门' }],
|
||||
name: [{ required: true, message: '请输入部门名称' }],
|
||||
sort: [{ required: true, message: '请输入部门排序' }],
|
||||
},
|
||||
@ -412,6 +419,7 @@
|
||||
description: '',
|
||||
sort: 999,
|
||||
status: 1,
|
||||
disabled: false,
|
||||
};
|
||||
proxy.$refs.formRef?.resetFields();
|
||||
};
|
||||
|
@ -35,14 +35,14 @@ INSERT IGNORE INTO `sys_menu` VALUES (10000, 'Arco Design Vue', 0, 1, 'https://a
|
||||
INSERT IGNORE INTO `sys_menu` VALUES (10001, 'GitHub', 0, 1, 'https://github.com/Charles7c/continew-admin', NULL, NULL, 'github', b'1', b'0', b'0', NULL, 101, 1, 1, NOW(), 1, NOW());
|
||||
|
||||
-- 初始化默认部门
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (1, 'Xxx科技有限公司', 0, '0', '系统初始部门', 1, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (2, '天津总部', 1, '0,1', '系统初始部门', 1, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (3, '研发部', 2, '0,1,2', '系统初始部门', 1, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (4, 'UI部', 2, '0,1,2', '系统初始部门', 2, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (5, '测试部', 2, '0,1,2', '系统初始部门', 3, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (6, '运维部', 2, '0,1,2', '系统初始部门', 4, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (7, '研发一组', 3, '0,1,2,3', '系统初始部门', 1, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (8, '研发二组', 3, '0,1,2,3', '系统初始部门', 2, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (1, 'Xxx科技有限公司', 0, '0', '系统初始部门', 1, 1, 1, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (2, '天津总部', 1, '0,1', NULL, 1, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (3, '研发部', 2, '0,1,2', NULL, 1, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (4, 'UI部', 2, '0,1,2', NULL, 2, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (5, '测试部', 2, '0,1,2', NULL, 3, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (6, '运维部', 2, '0,1,2', NULL, 4, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (7, '研发一组', 3, '0,1,2,3', NULL, 1, 1, 2, 1, NOW(), 1, NOW());
|
||||
INSERT IGNORE INTO `sys_dept` VALUES (8, '研发二组', 3, '0,1,2,3', NULL, 2, 2, 2, 1, NOW(), 1, NOW());
|
||||
|
||||
-- 初始化默认角色
|
||||
INSERT IGNORE INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '系统初始角色', 1, 1, 1, NOW(), 1, NOW());
|
||||
|
@ -34,6 +34,7 @@ CREATE TABLE IF NOT EXISTS `sys_dept` (
|
||||
`description` varchar(512) DEFAULT NULL COMMENT '描述',
|
||||
`sort` int(11) UNSIGNED DEFAULT 999 COMMENT '部门排序',
|
||||
`status` tinyint(1) UNSIGNED DEFAULT 1 COMMENT '状态(1:启用,2:禁用)',
|
||||
`type` tinyint(1) UNSIGNED DEFAULT 2 COMMENT '类型(1:系统内置,2:自定义)',
|
||||
`create_user` bigint(20) UNSIGNED NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) UNSIGNED NOT NULL COMMENT '修改人',
|
||||
|
Loading…
Reference in New Issue
Block a user