From 2f0df0a700b81491dcfdb1162118232ba8ced257 Mon Sep 17 00:00:00 2001 From: mkg <1650473152@qq.com> Date: Fri, 16 Apr 2021 14:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/models/admin.py | 24 ++ applications/service/admin/dict.py | 176 +++++++++ applications/views/admin/__init__.py | 3 + applications/views/admin/dict.py | 192 ++++++++++ dev/pear.sql | 108 ++++-- migrations/README | 1 - migrations/alembic.ini | 45 --- migrations/env.py | 96 ----- migrations/script.py.mako | 24 -- migrations/versions/58fc2c4c30a5_.py | 28 -- migrations/versions/64de3323bc01_.py | 28 -- migrations/versions/715a8ecc5856_.py | 28 -- migrations/versions/816f66c2def4_.py | 28 -- migrations/versions/85fcf9a09800_.py | 28 -- migrations/versions/95b59a101b26_.py | 30 -- .../{59add0790978_.py => 9a591b224cc7_.py} | 49 ++- migrations/versions/ce8825111f8f_.py | 35 -- migrations/versions/e187b65f7f1b_.py | 28 -- templates/admin/dict/add.html | 93 +++++ templates/admin/dict/data/add.html | 99 +++++ templates/admin/dict/data/edit.html | 109 ++++++ templates/admin/dict/edit.html | 103 +++++ templates/admin/dict/main.html | 357 ++++++++++++++++++ templates/admin/power/main.html | 3 +- 24 files changed, 1284 insertions(+), 431 deletions(-) create mode 100644 applications/service/admin/dict.py create mode 100644 applications/views/admin/dict.py delete mode 100644 migrations/README delete mode 100644 migrations/alembic.ini delete mode 100644 migrations/env.py delete mode 100644 migrations/script.py.mako delete mode 100644 migrations/versions/58fc2c4c30a5_.py delete mode 100644 migrations/versions/64de3323bc01_.py delete mode 100644 migrations/versions/715a8ecc5856_.py delete mode 100644 migrations/versions/816f66c2def4_.py delete mode 100644 migrations/versions/85fcf9a09800_.py delete mode 100644 migrations/versions/95b59a101b26_.py rename migrations/versions/{59add0790978_.py => 9a591b224cc7_.py} (61%) delete mode 100644 migrations/versions/ce8825111f8f_.py delete mode 100644 migrations/versions/e187b65f7f1b_.py create mode 100644 templates/admin/dict/add.html create mode 100644 templates/admin/dict/data/add.html create mode 100644 templates/admin/dict/data/edit.html create mode 100644 templates/admin/dict/edit.html create mode 100644 templates/admin/dict/main.html diff --git a/applications/models/admin.py b/applications/models/admin.py index 21dc299..27b4ac1 100644 --- a/applications/models/admin.py +++ b/applications/models/admin.py @@ -93,3 +93,27 @@ class Photo(db.Model): mime = db.Column(db.CHAR(50), nullable=False) size = db.Column(db.CHAR(30), nullable=False) create_time = db.Column(db.DateTime, default=datetime.datetime.now) + + +class DictType(db.Model): + __tablename__ = 'admin_dict_type' + id = db.Column(db.Integer, primary_key=True) + type_name = db.Column(db.String(255), comment='字典类型名称') + type_code = db.Column(db.String(255), comment='字典类型标识') + description = db.Column(db.String(255), comment='字典类型描述') + enable = db.Column(db.Integer, comment='是否开启') + create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间') + update_time = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间') + + +class DictData(db.Model): + __tablename__ = 'admin_dict_data' + id = db.Column(db.Integer, primary_key=True) + data_label = db.Column(db.String(255), comment='字典类型名称') + data_value = db.Column(db.String(255), comment='字典类型标识') + type_code = db.Column(db.String(255), comment='字典类型描述') + is_default = db.Column(db.Integer, comment='是否默认') + enable = db.Column(db.Integer, comment='是否开启') + remark = db.Column(db.String(255), comment='备注') + create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间') + update_time = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间') diff --git a/applications/service/admin/dict.py b/applications/service/admin/dict.py new file mode 100644 index 0000000..96092ea --- /dev/null +++ b/applications/service/admin/dict.py @@ -0,0 +1,176 @@ +# 字典管理 +# 查询字典类型 + +from flask_marshmallow import Marshmallow +from marshmallow import fields + +from applications.models import db +from applications.models.admin import DictType, DictData + +ma = Marshmallow() + + +# 通过type_code获取字典dict +# 例:get_dict('user_sex') +# [{'key': '男', 'value': 'boy'}, {'key': '女', 'value': 'girl'}] +def get_dict(typecode: str): + Dict_list = [] + if DictType.query.filter_by(type_code=typecode, enable=1).first(): + Dicts = DictData.query.filter_by(type_code=typecode, enable=1).all() + for d in Dicts: + Dict_Dict = {"key": d.data_label, "value": d.data_value} + Dict_list.append(Dict_Dict) + else: + return None + return Dict_list + + +class DictTypeSchema(ma.Schema): # 序列化类 + id = fields.Str(attribute="id") + typeName = fields.Str(attribute="type_name") + typeCode = fields.Str(attribute="type_code") + description = fields.Str(attribute="description") + createTime = fields.Str(attribute="create_time") + updateName = fields.Str(attribute="update_time") + remark = fields.Str() + enable = fields.Str() + + +class DictDataSchema(ma.Schema): # 序列化类 + dataId = fields.Str(attribute="id") + dataLabel = fields.Str(attribute="data_label") + dataValue = fields.Str(attribute="data_value") + remark = fields.Str() + enable = fields.Str() + + +def get_dict_type(page, limit, type_name): + dict_all = DictType.query + if type_name: + print('收到了') + dict_all = dict_all.filter(DictType.type_name.like('%' + type_name + '%')) + dict_all = dict_all.paginate(page=page, + per_page=limit, + error_out=False) + count = DictType.query.count() + dict_schema = DictTypeSchema(many=True) + dict_dict = dict_schema.dump(dict_all.items) + return dict_dict, count + + +def get_dict_data(page, limit, type_code): + dict_all = DictData.query.filter_by(type_code=type_code).paginate(page=page, + per_page=limit, + error_out=False) + count = DictType.query.count() + dict_schema = DictDataSchema(many=True) + dict_dict = dict_schema.dump(dict_all.items) + return dict_dict, count + + +# 增加dicttype +def save_dict_type(req_json): + description = req_json.get("description") + enable = req_json.get("enable") + type_code = req_json.get("typeCode") + type_name = req_json.get("typeName") + d = DictType(type_name=type_name, type_code=type_code, enable=enable, description=description) + db.session.add(d) + db.session.commit() + return d.id + + +# 编辑字典类型 +def update_dict_type(req_json): + id = req_json.get("id") + description = req_json.get("description") + enable = req_json.get("enable") + type_code = req_json.get("typeCode") + type_name = req_json.get("typeName") + DictType.query.filter_by(id=id).update({ + "description": description, + "enable": enable, + "type_code": type_code, + "type_name": type_name + }) + db.session.commit() + return + + +def enable_dict_type_status(id): + enable = 1 + res = DictType.query.filter_by(id=id).update({"enable": enable}) + if res: + db.session.commit() + return True + return False + + +def disable_dict_type_status(id): + enable = 0 + res = DictType.query.filter_by(id=id).update({"enable": enable}) + if res: + db.session.commit() + return True + return False + + +# 删除字典类型 +def delete_type_by_id(id): + type_code = DictType.query.filter_by(id=id).first().type_code + DictData.query.filter_by(type_code=type_code).delete() + res = DictType.query.filter_by(id=id).delete() + db.session.commit() + return res + + +# 增加dictdata +def save_dict_data(req_json): + data_label = req_json.get("dataLabel") + data_value = req_json.get("dataValue") + enable = req_json.get("enable") + remark = req_json.get("remark") + type_code = req_json.get("typeCode") + d = DictData(data_label=data_label, data_value=data_value, enable=enable, remark=remark, type_code=type_code) + db.session.add(d) + db.session.commit() + return d.id + + +# 编辑字典数据 +def update_dict_data(req_json): + id = req_json.get("dataId") + DictData.query.filter_by(id=id).update({ + "data_label": req_json.get("dataLabel"), + "data_value": req_json.get("dataValue"), + "enable": req_json.get("enable"), + "remark": req_json.get("remark"), + "type_code": req_json.get("typeCode") + }) + db.session.commit() + return + + +def enable_dict_data_status(id): + enable = 1 + res = DictData.query.filter_by(id=id).update({"enable": enable}) + if res: + db.session.commit() + return True + return False + + +def disable_dict_data_status(id): + enable = 0 + res = DictData.query.filter_by(id=id).update({"enable": enable}) + if res: + db.session.commit() + return True + return False + + +# 删除dictdata +def delete_data_by_id(id): + res = DictData.query.filter_by(id=id).delete() + db.session.commit() + return res diff --git a/applications/views/admin/__init__.py b/applications/views/admin/__init__.py index 753ffe0..dd7a4d7 100644 --- a/applications/views/admin/__init__.py +++ b/applications/views/admin/__init__.py @@ -5,6 +5,7 @@ from applications.views.admin.monitor import admin_Monitor from applications.views.admin.admin_log import admin_log from applications.views.admin.power import admin_power from applications.views.admin.role import admin_role +from applications.views.admin.dict import admin_dict """ 初始化蓝图 @@ -20,3 +21,5 @@ def init_adminViews(app): app.register_blueprint(admin_log) app.register_blueprint(admin_power) app.register_blueprint(admin_role) + app.register_blueprint(admin_dict) + diff --git a/applications/views/admin/dict.py b/applications/views/admin/dict.py new file mode 100644 index 0000000..b6520c7 --- /dev/null +++ b/applications/views/admin/dict.py @@ -0,0 +1,192 @@ +from flask import Blueprint, render_template, request, jsonify + +from applications.models.admin import DictType, DictData +from applications.service.admin.dict import get_dict_type, get_dict_data, save_dict_type, save_dict_data, \ + delete_type_by_id, delete_data_by_id, update_dict_type, enable_dict_type_status, disable_dict_type_status, \ + enable_dict_data_status, disable_dict_data_status, update_dict_data +from applications.service.route_auth import authorize_and_log + +admin_dict = Blueprint('adminDict', __name__, url_prefix='/admin/dict') + + +# 数据字典 +@admin_dict.route('/') +@authorize_and_log("admin:dict:main") +def main(): + return render_template('admin/dict/main.html') + + +@admin_dict.route('/dictType/data') +@authorize_and_log("admin:dict:main") +def dictType_data(): + page = request.args.get('page', type=int) + limit = request.args.get('limit', type=int) + type_name = request.args.get('typeName', type=str) + dict_data, count = get_dict_type(page=page, limit=limit, type_name=type_name) + res = { + "data": dict_data, + "count": count, + "code": 0, + } + return jsonify(res) + + +@admin_dict.route('/dictType/add') +@authorize_and_log("admin:dict:add") +def dictType_add(): + return render_template('admin/dict/add.html') + + +@admin_dict.route('/dictType/save', methods=['POST']) +@authorize_and_log("admin:power:add") +def dictType_save(): + req_json = request.json + res = save_dict_type(req_json=req_json) + if res == None: + return jsonify(success=False, msg="增加失败") + return jsonify(success=True, msg="增加成功") + + +# 编辑字典类型 +@admin_dict.route('/dictType/edit', methods=['GET', 'POST']) +@authorize_and_log("admin:dict:edit") +def dictType_edit(): + id = request.args.get('dictTypeId', type=str) + dict_type = DictType.query.filter_by(id=id).first() + return render_template('admin/dict/edit.html', dict_type=dict_type) + + +# 编辑字典类型 +@admin_dict.route('/dictType/update', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictType_update(): + req_json = request.json + update_dict_type(req_json) + return jsonify(success=True, msg="更新成功") + + +# 启用字典 +@admin_dict.route('/dictType/enable', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictType_enable(): + id = request.json.get('id') + print(id) + if id: + res = enable_dict_type_status(id) + if not res: + return jsonify(msg="出错啦", success=False) + return jsonify(msg="启动成功", success=True) + return jsonify(msg="数据错误", success=False) + + +# 禁用字典 +@admin_dict.route('/dictType/disable', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictType_disenable(): + id = request.json.get('id') + print(id) + if id: + res = disable_dict_type_status(id) + if not res: + return jsonify(msg="出错啦", success=False) + return jsonify(msg="禁用成功", success=True) + return jsonify(msg="数据错误", success=False) + + +# 删除字典类型 +@admin_dict.route('/dictType/remove/', methods=['DELETE']) +@authorize_and_log("admin:dict:remove") +def dictType_delete(id): + res = delete_type_by_id(id) + if not res: + return jsonify(msg="删除失败", success=False) + return jsonify(msg="删除成功", success=True) + + +@admin_dict.route('/dictData/data') +@authorize_and_log("admin:dict:main") +def dictCode_data(): + page = request.args.get('page', type=int) + limit = request.args.get('limit', type=int) + type_code = request.args.get('typeCode', type=str) + dict_data, count = get_dict_data(page=page, limit=limit, type_code=type_code) + res = { + "data": dict_data, + "count": count, + "code": 0, + } + return jsonify(res) + + +# 增加字典数据 +@admin_dict.route('/dictData/add') +# @authorize_and_log("admin:power:add") +def dictData_add(): + type_code = request.args.get('typeCode', type=str) + return render_template('admin/dict/data/add.html', type_code=type_code) + + +# 增加字典数据 +@admin_dict.route('/dictData/save', methods=['POST']) +# @authorize_and_log("admin:power:main") +def dictData_save(): + req_json = request.json + res = save_dict_data(req_json=req_json) + if res == None: + return jsonify(success=False, msg="增加失败") + return jsonify(success=True, msg="增加成功") + + +# 编辑字典数据 +@admin_dict.route('/dictData/edit', methods=['GET', 'POST']) +@authorize_and_log("admin:dict:edit") +def dictData_edit(): + id = request.args.get('dataId', type=str) + dict_data = DictData.query.filter_by(id=id).first() + return render_template('admin/dict/data/edit.html', dict_data=dict_data) + + +# 编辑字典数据 +@admin_dict.route('/dictData/update', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictData_update(): + req_json = request.json + update_dict_data(req_json) + return jsonify(success=True, msg="更新成功") + + +# 启用字典数据 +@admin_dict.route('/dictData/enable', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictData_enable(): + id = request.json.get('dataId') + print(id) + if id: + res = enable_dict_data_status(id) + if not res: + return jsonify(msg="出错啦", success=False) + return jsonify(msg="启动成功", success=True) + return jsonify(msg="数据错误", success=False) + + +# 禁用字典数据 +@admin_dict.route('/dictData/disable', methods=['PUT']) +@authorize_and_log("admin:dict:edit") +def dictData_disenable(): + id = request.json.get('dataId') + if id: + res = disable_dict_data_status(id) + if not res: + return jsonify(msg="出错啦", success=False) + return jsonify(msg="禁用成功", success=True) + return jsonify(msg="数据错误", success=False) + + +# 删除字典类型 +@admin_dict.route('dictData/remove/', methods=['DELETE']) +@authorize_and_log("admin:dict:remove") +def dictData_delete(id): + res = delete_data_by_id(id) + if not res: + return jsonify(msg="删除失败", success=False) + return jsonify(msg="删除成功", success=True) diff --git a/dev/pear.sql b/dev/pear.sql index 5c79c7d..cae76b6 100644 --- a/dev/pear.sql +++ b/dev/pear.sql @@ -11,7 +11,7 @@ Target Server Version : 50726 File Encoding : 65001 - Date: 01/04/2021 23:46:07 + Date: 16/04/2021 14:06:40 */ SET NAMES utf8mb4; @@ -32,11 +32,63 @@ CREATE TABLE `admin_admin_log` ( `create_time` datetime(0) NULL DEFAULT NULL, `success` int(11) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1146 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1267 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of admin_admin_log -- ---------------------------- +INSERT INTO `admin_admin_log` VALUES (1258, 'GET', 1, '/admin/user/', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:11', 1); +INSERT INTO `admin_admin_log` VALUES (1259, 'GET', 1, '/admin/power/', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:11', 1); +INSERT INTO `admin_admin_log` VALUES (1260, 'GET', 1, '/admin/role/', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:11', 1); +INSERT INTO `admin_admin_log` VALUES (1261, 'GET', 1, '/admin/dict/', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:11', 1); +INSERT INTO `admin_admin_log` VALUES (1262, 'GET', 1, '/admin/dict/dictType/data', '{\'page\': \'1\', \'limit\': \'10\'}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:12', 1); +INSERT INTO `admin_admin_log` VALUES (1263, 'GET', 1, '/admin/user/data', '{\'page\': \'1\', \'limit\': \'10\'}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:12', 1); +INSERT INTO `admin_admin_log` VALUES (1264, 'GET', 1, '/admin/role/data', '{\'page\': \'1\', \'limit\': \'10\'}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:12', 1); +INSERT INTO `admin_admin_log` VALUES (1265, 'GET', 1, '/admin/power/data', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:12', 1); +INSERT INTO `admin_admin_log` VALUES (1266, 'GET', 1, '/admin/dict/dictType/add', '{}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36', '2021-04-16 14:06:14', 1); + +-- ---------------------------- +-- Table structure for admin_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `admin_dict_data`; +CREATE TABLE `admin_dict_data` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `data_label` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型名称', + `data_value` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型标识', + `type_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型描述', + `is_default` int(11) NULL DEFAULT NULL COMMENT '是否默认', + `enable` int(11) NULL DEFAULT NULL COMMENT '是否开启', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '备注', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of admin_dict_data +-- ---------------------------- +INSERT INTO `admin_dict_data` VALUES (8, '男', 'boy', 'user_sex', NULL, 1, '男 : body', '2021-04-16 13:36:34', '2021-04-16 14:05:06'); +INSERT INTO `admin_dict_data` VALUES (9, '女', 'girl', 'user_sex', NULL, 1, '女 : girl', '2021-04-16 13:36:55', '2021-04-16 13:36:55'); + +-- ---------------------------- +-- Table structure for admin_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `admin_dict_type`; +CREATE TABLE `admin_dict_type` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型名称', + `type_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型标识', + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '字典类型描述', + `enable` int(11) NULL DEFAULT NULL COMMENT '是否开启', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of admin_dict_type +-- ---------------------------- +INSERT INTO `admin_dict_type` VALUES (1, '用户性别', 'user_sex', '用户性别', 1, NULL, '2021-04-16 13:37:11'); -- ---------------------------- -- Table structure for admin_photo @@ -76,7 +128,7 @@ CREATE TABLE `admin_power` ( `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', `enable` int(11) NULL DEFAULT NULL COMMENT '是否开启', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 44 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 48 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of admin_power @@ -101,6 +153,10 @@ INSERT INTO `admin_power` VALUES (29, '角色删除', '2', 'admin:role:remove', INSERT INTO `admin_power` VALUES (30, '角色授权', '2', 'admin:role:power', '', '', '9', 'layui-icon layui-icon-component', 4, '2021-03-22 19:50:54', '2021-03-25 19:15:26', 1); INSERT INTO `admin_power` VALUES (31, '图片增加', '2', 'admin:file:add', '', '', '18', 'layui-icon layui-icon-add-circle', 1, '2021-03-22 19:58:05', '2021-03-25 19:15:28', 1); INSERT INTO `admin_power` VALUES (32, '图片删除', '2', 'admin:file:delete', '', '', '18', 'layui-icon layui-icon-delete', 2, '2021-03-22 19:58:45', '2021-03-25 19:15:29', 1); +INSERT INTO `admin_power` VALUES (44, '数据字典', '1', 'admin:dict:main', '/admin/dict', '_iframe', '1', 'layui-icon layui-icon-console', 6, '2021-04-16 13:59:49', '2021-04-16 13:59:49', 1); +INSERT INTO `admin_power` VALUES (45, '字典增加', '2', 'admin:dict:add', '', '', '44', 'layui-icon ', 1, '2021-04-16 14:00:59', '2021-04-16 14:00:59', 1); +INSERT INTO `admin_power` VALUES (46, '字典修改', '2', 'admin:dict:edit', '', '', '44', 'layui-icon ', 2, '2021-04-16 14:01:33', '2021-04-16 14:01:33', 1); +INSERT INTO `admin_power` VALUES (47, '字典删除', '2', 'admin:dict:remove', '', '', '44', 'layui-icon ', 3, '2021-04-16 14:02:06', '2021-04-16 14:02:06', 1); -- ---------------------------- -- Table structure for admin_role @@ -138,31 +194,11 @@ CREATE TABLE `admin_role_power` ( INDEX `role_id`(`role_id`) USING BTREE, CONSTRAINT `admin_role_power_ibfk_1` FOREIGN KEY (`power_id`) REFERENCES `admin_power` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `admin_role_power_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 167 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 212 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of admin_role_power -- ---------------------------- -INSERT INTO `admin_role_power` VALUES (132, 1, 1); -INSERT INTO `admin_role_power` VALUES (133, 3, 1); -INSERT INTO `admin_role_power` VALUES (134, 4, 1); -INSERT INTO `admin_role_power` VALUES (135, 9, 1); -INSERT INTO `admin_role_power` VALUES (136, 12, 1); -INSERT INTO `admin_role_power` VALUES (137, 13, 1); -INSERT INTO `admin_role_power` VALUES (138, 17, 1); -INSERT INTO `admin_role_power` VALUES (139, 18, 1); -INSERT INTO `admin_role_power` VALUES (140, 21, 1); -INSERT INTO `admin_role_power` VALUES (141, 22, 1); -INSERT INTO `admin_role_power` VALUES (142, 23, 1); -INSERT INTO `admin_role_power` VALUES (143, 24, 1); -INSERT INTO `admin_role_power` VALUES (144, 25, 1); -INSERT INTO `admin_role_power` VALUES (145, 26, 1); -INSERT INTO `admin_role_power` VALUES (146, 27, 1); -INSERT INTO `admin_role_power` VALUES (147, 28, 1); -INSERT INTO `admin_role_power` VALUES (148, 29, 1); -INSERT INTO `admin_role_power` VALUES (149, 30, 1); -INSERT INTO `admin_role_power` VALUES (150, 31, 1); -INSERT INTO `admin_role_power` VALUES (151, 32, 1); INSERT INTO `admin_role_power` VALUES (159, 1, 2); INSERT INTO `admin_role_power` VALUES (160, 3, 2); INSERT INTO `admin_role_power` VALUES (161, 4, 2); @@ -171,6 +207,30 @@ INSERT INTO `admin_role_power` VALUES (163, 12, 2); INSERT INTO `admin_role_power` VALUES (164, 13, 2); INSERT INTO `admin_role_power` VALUES (165, 17, 2); INSERT INTO `admin_role_power` VALUES (166, 18, 2); +INSERT INTO `admin_role_power` VALUES (188, 1, 1); +INSERT INTO `admin_role_power` VALUES (189, 3, 1); +INSERT INTO `admin_role_power` VALUES (190, 4, 1); +INSERT INTO `admin_role_power` VALUES (191, 9, 1); +INSERT INTO `admin_role_power` VALUES (192, 12, 1); +INSERT INTO `admin_role_power` VALUES (193, 13, 1); +INSERT INTO `admin_role_power` VALUES (194, 17, 1); +INSERT INTO `admin_role_power` VALUES (195, 18, 1); +INSERT INTO `admin_role_power` VALUES (196, 21, 1); +INSERT INTO `admin_role_power` VALUES (197, 22, 1); +INSERT INTO `admin_role_power` VALUES (198, 23, 1); +INSERT INTO `admin_role_power` VALUES (199, 24, 1); +INSERT INTO `admin_role_power` VALUES (200, 25, 1); +INSERT INTO `admin_role_power` VALUES (201, 26, 1); +INSERT INTO `admin_role_power` VALUES (202, 27, 1); +INSERT INTO `admin_role_power` VALUES (203, 28, 1); +INSERT INTO `admin_role_power` VALUES (204, 29, 1); +INSERT INTO `admin_role_power` VALUES (205, 30, 1); +INSERT INTO `admin_role_power` VALUES (206, 31, 1); +INSERT INTO `admin_role_power` VALUES (207, 32, 1); +INSERT INTO `admin_role_power` VALUES (208, 44, 1); +INSERT INTO `admin_role_power` VALUES (209, 45, 1); +INSERT INTO `admin_role_power` VALUES (210, 46, 1); +INSERT INTO `admin_role_power` VALUES (211, 47, 1); -- ---------------------------- -- Table structure for admin_user diff --git a/migrations/README b/migrations/README deleted file mode 100644 index 98e4f9c..0000000 --- a/migrations/README +++ /dev/null @@ -1 +0,0 @@ -Generic single-database configuration. \ No newline at end of file diff --git a/migrations/alembic.ini b/migrations/alembic.ini deleted file mode 100644 index f8ed480..0000000 --- a/migrations/alembic.ini +++ /dev/null @@ -1,45 +0,0 @@ -# A generic, single database configuration. - -[alembic] -# template used to generate migration files -# file_template = %%(rev)s_%%(slug)s - -# set to 'true' to run the environment during -# the 'revision' command, regardless of autogenerate -# revision_environment = false - - -# Logging configuration -[loggers] -keys = root,sqlalchemy,alembic - -[handlers] -keys = console - -[formatters] -keys = generic - -[logger_root] -level = WARN -handlers = console -qualname = - -[logger_sqlalchemy] -level = WARN -handlers = -qualname = sqlalchemy.engine - -[logger_alembic] -level = INFO -handlers = -qualname = alembic - -[handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET -formatter = generic - -[formatter_generic] -format = %(levelname)-5.5s [%(name)s] %(message)s -datefmt = %H:%M:%S diff --git a/migrations/env.py b/migrations/env.py deleted file mode 100644 index 8b3fb33..0000000 --- a/migrations/env.py +++ /dev/null @@ -1,96 +0,0 @@ -from __future__ import with_statement - -import logging -from logging.config import fileConfig - -from sqlalchemy import engine_from_config -from sqlalchemy import pool -from flask import current_app - -from alembic import context - -# this is the Alembic Config object, which provides -# access to the values within the .ini file in use. -config = context.config - -# Interpret the config file for Python logging. -# This line sets up loggers basically. -fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') - -# add your model's MetaData object here -# for 'autogenerate' support -# from myapp import mymodel -# target_metadata = mymodel.Base.metadata -config.set_main_option( - 'sqlalchemy.url', - str(current_app.extensions['migrate'].db.engine.url).replace('%', '%%')) -target_metadata = current_app.extensions['migrate'].db.metadata - -# other values from the config, defined by the needs of env.py, -# can be acquired: -# my_important_option = config.get_main_option("my_important_option") -# ... etc. - - -def run_migrations_offline(): - """Run migrations in 'offline' mode. - - This configures the context with just a URL - and not an Engine, though an Engine is acceptable - here as well. By skipping the Engine creation - we don't even need a DBAPI to be available. - - Calls to context.execute() here emit the given string to the - script output. - - """ - url = config.get_main_option("sqlalchemy.url") - context.configure( - url=url, target_metadata=target_metadata, literal_binds=True - ) - - with context.begin_transaction(): - context.run_migrations() - - -def run_migrations_online(): - """Run migrations in 'online' mode. - - In this scenario we need to create an Engine - and associate a connection with the context. - - """ - - # this callback is used to prevent an auto-migration from being generated - # when there are no changes to the schema - # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html - def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): - script = directives[0] - if script.upgrade_ops.is_empty(): - directives[:] = [] - logger.info('No changes in schema detected.') - - connectable = engine_from_config( - config.get_section(config.config_ini_section), - prefix='sqlalchemy.', - poolclass=pool.NullPool, - ) - - with connectable.connect() as connection: - context.configure( - connection=connection, - target_metadata=target_metadata, - process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args - ) - - with context.begin_transaction(): - context.run_migrations() - - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() diff --git a/migrations/script.py.mako b/migrations/script.py.mako deleted file mode 100644 index 2c01563..0000000 --- a/migrations/script.py.mako +++ /dev/null @@ -1,24 +0,0 @@ -"""${message} - -Revision ID: ${up_revision} -Revises: ${down_revision | comma,n} -Create Date: ${create_date} - -""" -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} -branch_labels = ${repr(branch_labels)} -depends_on = ${repr(depends_on)} - - -def upgrade(): - ${upgrades if upgrades else "pass"} - - -def downgrade(): - ${downgrades if downgrades else "pass"} diff --git a/migrations/versions/58fc2c4c30a5_.py b/migrations/versions/58fc2c4c30a5_.py deleted file mode 100644 index 289a8af..0000000 --- a/migrations/versions/58fc2c4c30a5_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: 58fc2c4c30a5 -Revises: 715a8ecc5856 -Create Date: 2021-03-19 21:31:06.761526 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '58fc2c4c30a5' -down_revision = '715a8ecc5856' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_role', sa.Column('enable', sa.Integer(), nullable=True, comment='是否启用')) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_role', 'enable') - # ### end Alembic commands ### diff --git a/migrations/versions/64de3323bc01_.py b/migrations/versions/64de3323bc01_.py deleted file mode 100644 index 727ff5b..0000000 --- a/migrations/versions/64de3323bc01_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: 64de3323bc01 -Revises: 95b59a101b26 -Create Date: 2021-03-18 20:54:17.724297 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '64de3323bc01' -down_revision = '95b59a101b26' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_user', sa.Column('realname', sa.String(length=20), nullable=True, comment='真实名字')) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_user', 'realname') - # ### end Alembic commands ### diff --git a/migrations/versions/715a8ecc5856_.py b/migrations/versions/715a8ecc5856_.py deleted file mode 100644 index ede2495..0000000 --- a/migrations/versions/715a8ecc5856_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: 715a8ecc5856 -Revises: 64de3323bc01 -Create Date: 2021-03-19 21:30:52.200812 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '715a8ecc5856' -down_revision = '64de3323bc01' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_role', 'enable') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_role', sa.Column('enable', mysql.CHAR(collation='utf8_unicode_ci', length=1), nullable=True, comment='是否启用')) - # ### end Alembic commands ### diff --git a/migrations/versions/816f66c2def4_.py b/migrations/versions/816f66c2def4_.py deleted file mode 100644 index 5cbe54e..0000000 --- a/migrations/versions/816f66c2def4_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: 816f66c2def4 -Revises: ce8825111f8f -Create Date: 2021-03-14 22:57:37.092157 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '816f66c2def4' -down_revision = 'ce8825111f8f' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_admin_log', sa.Column('success', sa.Integer(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_admin_log', 'success') - # ### end Alembic commands ### diff --git a/migrations/versions/85fcf9a09800_.py b/migrations/versions/85fcf9a09800_.py deleted file mode 100644 index 9edb2b0..0000000 --- a/migrations/versions/85fcf9a09800_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: 85fcf9a09800 -Revises: e187b65f7f1b -Create Date: 2021-04-01 21:03:40.387739 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '85fcf9a09800' -down_revision = 'e187b65f7f1b' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_user', sa.Column('avatar', sa.String(length=255), nullable=True, comment='头像')) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_user', 'avatar') - # ### end Alembic commands ### diff --git a/migrations/versions/95b59a101b26_.py b/migrations/versions/95b59a101b26_.py deleted file mode 100644 index bc4f95b..0000000 --- a/migrations/versions/95b59a101b26_.py +++ /dev/null @@ -1,30 +0,0 @@ -"""empty message - -Revision ID: 95b59a101b26 -Revises: 816f66c2def4 -Create Date: 2021-03-17 22:28:41.595865 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '95b59a101b26' -down_revision = '816f66c2def4' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_user', sa.Column('enable', sa.Integer(), nullable=True, comment='启用')) - op.drop_column('admin_user', 'status') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_user', sa.Column('status', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True, comment='启用')) - op.drop_column('admin_user', 'enable') - # ### end Alembic commands ### diff --git a/migrations/versions/59add0790978_.py b/migrations/versions/9a591b224cc7_.py similarity index 61% rename from migrations/versions/59add0790978_.py rename to migrations/versions/9a591b224cc7_.py index 6fb280e..8743e0a 100644 --- a/migrations/versions/59add0790978_.py +++ b/migrations/versions/9a591b224cc7_.py @@ -1,8 +1,8 @@ """empty message -Revision ID: 59add0790978 +Revision ID: 9a591b224cc7 Revises: -Create Date: 2021-03-11 22:39:09.829159 +Create Date: 2021-04-16 10:13:27.930524 """ from alembic import op @@ -10,7 +10,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '59add0790978' +revision = '9a591b224cc7' down_revision = None branch_labels = None depends_on = None @@ -25,10 +25,33 @@ def upgrade(): sa.Column('url', sa.String(length=255), nullable=True), sa.Column('desc', sa.Text(), nullable=True), sa.Column('ip', sa.String(length=255), nullable=True), + sa.Column('success', sa.Integer(), nullable=True), sa.Column('user_agent', sa.Text(), nullable=True), sa.Column('create_time', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id') ) + op.create_table('admin_dict_data', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('data_label', sa.String(length=255), nullable=True, comment='字典类型名称'), + sa.Column('data_value', sa.String(length=255), nullable=True, comment='字典类型标识'), + sa.Column('type_code', sa.String(length=255), nullable=True, comment='字典类型描述'), + sa.Column('is_default', sa.Integer(), nullable=True, comment='是否默认'), + sa.Column('enable', sa.Integer(), nullable=True, comment='是否开启'), + sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'), + sa.Column('create_time', sa.DateTime(), nullable=True, comment='创建时间'), + sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('admin_dict_type', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('type_name', sa.String(length=255), nullable=True, comment='字典类型名称'), + sa.Column('type_code', sa.String(length=255), nullable=True, comment='字典类型标识'), + sa.Column('description', sa.String(length=255), nullable=True, comment='字典类型描述'), + sa.Column('enable', sa.Integer(), nullable=True, comment='是否开启'), + sa.Column('create_time', sa.DateTime(), nullable=True, comment='创建时间'), + sa.Column('update_time', sa.DateTime(), nullable=True, comment='更新时间'), + sa.PrimaryKeyConstraint('id') + ) op.create_table('admin_photo', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), @@ -45,7 +68,7 @@ def upgrade(): sa.Column('code', sa.String(length=30), nullable=True, comment='权限标识'), sa.Column('url', sa.String(length=255), nullable=True, comment='权限路径'), sa.Column('open_type', sa.String(length=10), nullable=True, comment='打开方式'), - sa.Column('parent_id', sa.String(length=19), nullable=True, comment='父类编号'), + sa.Column('parent_id', sa.Integer(), nullable=True, comment='父类编号'), sa.Column('icon', sa.String(length=128), nullable=True, comment='图标'), sa.Column('sort', sa.Integer(), nullable=True, comment='排序'), sa.Column('create_time', sa.DateTime(), nullable=True, comment='创建时间'), @@ -57,7 +80,7 @@ def upgrade(): sa.Column('id', sa.Integer(), nullable=False, comment='角色ID'), sa.Column('name', sa.String(length=255), nullable=True, comment='角色名称'), sa.Column('code', sa.String(length=255), nullable=True, comment='角色标识'), - sa.Column('enable', sa.CHAR(length=1), nullable=True, comment='是否启用'), + sa.Column('enable', sa.Integer(), nullable=True, comment='是否启用'), sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'), sa.Column('details', sa.String(length=255), nullable=True, comment='详情'), sa.Column('sort', sa.Integer(), nullable=True, comment='排序'), @@ -68,12 +91,23 @@ def upgrade(): op.create_table('admin_user', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='用户ID'), sa.Column('username', sa.String(length=20), nullable=True, comment='用户名'), + sa.Column('realname', sa.String(length=20), nullable=True, comment='真实名字'), + sa.Column('avatar', sa.String(length=255), nullable=True, comment='头像'), + sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'), sa.Column('password_hash', sa.String(length=128), nullable=True, comment='哈希密码'), - sa.Column('status', sa.Integer(), nullable=True, comment='启用'), + sa.Column('enable', sa.Integer(), nullable=True, comment='启用'), sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'), sa.Column('update_at', sa.DateTime(), nullable=True, comment='创建时间'), sa.PrimaryKeyConstraint('id') ) + op.create_table('admin_role_power', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'), + sa.Column('power_id', sa.Integer(), nullable=True, comment='用户编号'), + sa.Column('role_id', sa.Integer(), nullable=True, comment='角色编号'), + sa.ForeignKeyConstraint(['power_id'], ['admin_power.id'], ), + sa.ForeignKeyConstraint(['role_id'], ['admin_role.id'], ), + sa.PrimaryKeyConstraint('id') + ) op.create_table('admin_user_role', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'), sa.Column('user_id', sa.Integer(), nullable=True, comment='用户编号'), @@ -88,9 +122,12 @@ def upgrade(): def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('admin_user_role') + op.drop_table('admin_role_power') op.drop_table('admin_user') op.drop_table('admin_role') op.drop_table('admin_power') op.drop_table('admin_photo') + op.drop_table('admin_dict_type') + op.drop_table('admin_dict_data') op.drop_table('admin_admin_log') # ### end Alembic commands ### diff --git a/migrations/versions/ce8825111f8f_.py b/migrations/versions/ce8825111f8f_.py deleted file mode 100644 index 8e113da..0000000 --- a/migrations/versions/ce8825111f8f_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""empty message - -Revision ID: ce8825111f8f -Revises: 59add0790978 -Create Date: 2021-03-11 22:41:25.156430 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'ce8825111f8f' -down_revision = '59add0790978' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('admin_role_power', - sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='标识'), - sa.Column('power_id', sa.Integer(), nullable=True, comment='用户编号'), - sa.Column('role_id', sa.Integer(), nullable=True, comment='角色编号'), - sa.ForeignKeyConstraint(['power_id'], ['admin_power.id'], ), - sa.ForeignKeyConstraint(['role_id'], ['admin_role.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('admin_role_power') - # ### end Alembic commands ### diff --git a/migrations/versions/e187b65f7f1b_.py b/migrations/versions/e187b65f7f1b_.py deleted file mode 100644 index b9c8cf1..0000000 --- a/migrations/versions/e187b65f7f1b_.py +++ /dev/null @@ -1,28 +0,0 @@ -"""empty message - -Revision ID: e187b65f7f1b -Revises: 58fc2c4c30a5 -Create Date: 2021-04-01 21:03:04.872235 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'e187b65f7f1b' -down_revision = '58fc2c4c30a5' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('admin_user', sa.Column('remark', sa.String(length=255), nullable=True, comment='备注')) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('admin_user', 'remark') - # ### end Alembic commands ### diff --git a/templates/admin/dict/add.html b/templates/admin/dict/add.html new file mode 100644 index 0000000..91f698f --- /dev/null +++ b/templates/admin/dict/add.html @@ -0,0 +1,93 @@ + + + + + 字典增加 + + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/templates/admin/dict/data/add.html b/templates/admin/dict/data/add.html new file mode 100644 index 0000000..6baca83 --- /dev/null +++ b/templates/admin/dict/data/add.html @@ -0,0 +1,99 @@ + + + + + 字典增加 + + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + \ No newline at end of file diff --git a/templates/admin/dict/data/edit.html b/templates/admin/dict/data/edit.html new file mode 100644 index 0000000..ed386de --- /dev/null +++ b/templates/admin/dict/data/edit.html @@ -0,0 +1,109 @@ + + + + + 字典增加 + + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/templates/admin/dict/edit.html b/templates/admin/dict/edit.html new file mode 100644 index 0000000..1ef32fd --- /dev/null +++ b/templates/admin/dict/edit.html @@ -0,0 +1,103 @@ + + + + + 字典增加 + + + + + + +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+ + + + + + + \ No newline at end of file diff --git a/templates/admin/dict/main.html b/templates/admin/dict/main.html new file mode 100644 index 0000000..c312a54 --- /dev/null +++ b/templates/admin/dict/main.html @@ -0,0 +1,357 @@ + + + + + 字典管理 + + + + + + +
+
+
+
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/admin/power/main.html b/templates/admin/power/main.html index 52cba92..1dc8ada 100644 --- a/templates/admin/power/main.html +++ b/templates/admin/power/main.html @@ -1,5 +1,5 @@ - + 权限 @@ -7,7 +7,6 @@ -