diff --git a/README.md b/README.md index 9e50d0eb60b43a482c0690a79a47870a64ada030..188eb2f5b74985dc767f1748d7b5ea5ed9dd9201 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
-
+
diff --git a/ruoyi-fastapi-backend/.env.dev b/ruoyi-fastapi-backend/.env.dev
index 397c44abd3a8dcde0be693419e51aa7988c02a44..a792ea9629d86fd669023b8e6c04b036e1c361b9 100644
--- a/ruoyi-fastapi-backend/.env.dev
+++ b/ruoyi-fastapi-backend/.env.dev
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
# 应用端口
APP_PORT = 9099
# 应用版本
-APP_VERSION= '1.7.0'
+APP_VERSION= '1.7.1'
# 应用是否开启热重载
APP_RELOAD = true
# 应用是否开启IP归属区域查询
diff --git a/ruoyi-fastapi-backend/.env.prod b/ruoyi-fastapi-backend/.env.prod
index 11b8303b3c2d0da818d5fffe1c19927060b4fd76..e932e397474a496dea499e496ce9368069dfb574 100644
--- a/ruoyi-fastapi-backend/.env.prod
+++ b/ruoyi-fastapi-backend/.env.prod
@@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0'
# 应用端口
APP_PORT = 9099
# 应用版本
-APP_VERSION= '1.7.0'
+APP_VERSION= '1.7.1'
# 应用是否开启热重载
APP_RELOAD = false
# 应用是否开启IP归属区域查询
diff --git a/ruoyi-fastapi-backend/module_generator/templates/python/controller.py.jinja2 b/ruoyi-fastapi-backend/module_generator/templates/python/controller.py.jinja2
index 4d5a12e4ecbdd88a4d58d6bd56a2899b45966785..13cc466f5895b400b82b5b2a0e618125b96e4a05 100644
--- a/ruoyi-fastapi-backend/module_generator/templates/python/controller.py.jinja2
+++ b/ruoyi-fastapi-backend/module_generator/templates/python/controller.py.jinja2
@@ -1,10 +1,14 @@
{% set pkField = pkColumn.python_field %}
{% set pk_field = pkColumn.python_field | camel_to_snake %}
+{% set need_import_datetime = namespace(has_datetime=False) %}
{% for column in columns %}
-{% if column.python_field == "createTime" %}
-from datetime import datetime
+{% if column.python_field in ["createTime", "updatetime"] %}
+{% set need_import_datetime.has_datetime = True %}
{% endif %}
{% endfor %}
+{% if need_import_datetime.has_datetime %}
+from datetime import datetime
+{% endif %}
from fastapi import APIRouter, Depends, Form, Request
from pydantic_validation_decorator import ValidateFields
from sqlalchemy.ext.asyncio import AsyncSession
@@ -82,8 +86,13 @@ async def edit_{{ moduleName }}_{{ businessName }}(
query_db: AsyncSession = Depends(get_db),
current_user: CurrentUserModel = Depends(LoginService.get_current_user),
):
+ {% for column in columns %}
+ {% if column.python_field == "updateBy" %}
edit_{{ businessName }}.update_by = current_user.user.user_name
+ {% elif column.python_field == "updateTime" %}
edit_{{ businessName }}.update_time = datetime.now()
+ {% endif %}
+ {% endfor %}
edit_{{ businessName }}_result = await {{ BusinessName }}Service.edit_{{ businessName }}_services(query_db, edit_{{ businessName }})
logger.info(edit_{{ businessName }}_result.message)
diff --git a/ruoyi-fastapi-backend/module_generator/templates/python/do.py.jinja2 b/ruoyi-fastapi-backend/module_generator/templates/python/do.py.jinja2
index 22c23c441c6bdbc7becc8bd2276b1157bcd1de25..c7ea75791d61ebc82a3f98ac15b79be00f3036ee 100644
--- a/ruoyi-fastapi-backend/module_generator/templates/python/do.py.jinja2
+++ b/ruoyi-fastapi-backend/module_generator/templates/python/do.py.jinja2
@@ -13,6 +13,7 @@ class {{ ClassName }}(Base):
"""
__tablename__ = '{{ tableName }}'
+ __table_args__ = {'comment': '{{ tableComment }}'}
{% for column in columns %}
{{ column.column_name }} = Column({{ column.column_type | get_sqlalchemy_type }}, {% if column.pk %}primary_key=True, {% endif %}{% if column.increment %}autoincrement=True, {% endif %}{% if column.required or column.pk %}nullable=False{% else %}nullable=True{% endif %}, comment='{{ column.column_comment }}')
diff --git a/ruoyi-fastapi-backend/requirements-pg.txt b/ruoyi-fastapi-backend/requirements-pg.txt
index c9d1c249ccb26a3d5f0f5207cbe4f4acee7eec2c..9dbf1fd609569dd2f915f32ed4c1e2267e27e408 100644
--- a/ruoyi-fastapi-backend/requirements-pg.txt
+++ b/ruoyi-fastapi-backend/requirements-pg.txt
@@ -2,12 +2,12 @@ alembic==1.16.4
APScheduler==3.11.0
async-lru==2.0.5
asyncpg==0.30.0
+bcrypt==5.0.0
DateTime==5.5
fastapi[all]==0.116.1
loguru==0.7.3
openpyxl==3.1.5
pandas==2.3.2
-passlib[bcrypt]==1.7.4
Pillow==11.3.0
psutil==7.0.0
pydantic-validation-decorator==0.1.4
diff --git a/ruoyi-fastapi-backend/requirements.txt b/ruoyi-fastapi-backend/requirements.txt
index 9040b49e56f1df021c3958e0d265ff2ea4eb62f9..af66bc709c7afd598784c62a403c9c7bc30ace3a 100644
--- a/ruoyi-fastapi-backend/requirements.txt
+++ b/ruoyi-fastapi-backend/requirements.txt
@@ -2,12 +2,12 @@ alembic==1.16.4
APScheduler==3.11.0
async-lru==2.0.5
asyncmy==0.2.10
+bcrypt==5.0.0
DateTime==5.5
fastapi[all]==0.116.1
loguru==0.7.3
openpyxl==3.1.5
pandas==2.3.2
-passlib[bcrypt]==1.7.4
Pillow==11.3.0
psutil==7.0.0
pydantic-validation-decorator==0.1.4
diff --git a/ruoyi-fastapi-backend/utils/pwd_util.py b/ruoyi-fastapi-backend/utils/pwd_util.py
index 86e9c271e6a0afb0e217e04264f5f92e28546443..c3f91ce76fe4d9c7080fe3496ddc7b42b53bb460 100644
--- a/ruoyi-fastapi-backend/utils/pwd_util.py
+++ b/ruoyi-fastapi-backend/utils/pwd_util.py
@@ -1,6 +1,4 @@
-from passlib.context import CryptContext
-
-pwd_context = CryptContext(schemes=['bcrypt'], deprecated='auto')
+import bcrypt
class PwdUtil:
@@ -9,7 +7,7 @@ class PwdUtil:
"""
@classmethod
- def verify_password(cls, plain_password, hashed_password):
+ def verify_password(cls, plain_password: str, hashed_password: str) -> bool:
"""
工具方法:校验当前输入的密码与数据库存储的密码是否一致
@@ -17,7 +15,9 @@ class PwdUtil:
:param hashed_password: 数据库存储的密码
:return: 校验结果
"""
- return pwd_context.verify(plain_password, hashed_password)
+ return (
+ bcrypt.checkpw(plain_password.encode('utf-8'), hashed_password.encode('utf-8')) if hashed_password else None
+ )
@classmethod
def get_password_hash(cls, input_password):
@@ -27,4 +27,4 @@ class PwdUtil:
:param input_password: 输入的密码
:return: 加密成功的密码
"""
- return pwd_context.hash(input_password)
+ return bcrypt.hashpw(input_password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
diff --git a/ruoyi-fastapi-backend/utils/template_util.py b/ruoyi-fastapi-backend/utils/template_util.py
index 6765bd07306ffcbef865afe979136850e6ebfd6d..afe5c41438cbb973b4c8d0904ceaee482fc9ee2a 100644
--- a/ruoyi-fastapi-backend/utils/template_util.py
+++ b/ruoyi-fastapi-backend/utils/template_util.py
@@ -73,6 +73,7 @@ class TemplateUtils:
context = {
'tplCategory': tpl_category,
'tableName': gen_table.table_name,
+ 'tableComment': gen_table.table_comment,
'functionName': function_name if StringUtil.is_not_empty(function_name) else '【请填写功能名称】',
'ClassName': class_name,
'className': class_name.lower(),
diff --git a/ruoyi-fastapi-frontend/package.json b/ruoyi-fastapi-frontend/package.json
index 71fe5928312937cda8178baba5483b151fd9ba11..0bffa57492c2f4214ecec33b0c2ca507022c4033 100644
--- a/ruoyi-fastapi-frontend/package.json
+++ b/ruoyi-fastapi-frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "vfadmin",
- "version": "1.7.0",
+ "version": "1.7.1",
"description": "vfadmin管理系统",
"author": "insistence",
"license": "MIT",