From 2ea6347e3fe59402f70b71770ef58b6658ce9748 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Fri, 5 Sep 2025 09:17:48 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90controller=E6=A8=A1=E6=9D=BF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=8E=A5=E5=8F=A3=E5=BC=82=E5=B8=B8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/python/controller.py.jinja2 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 4d5a12e..13cc466 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) -- Gitee From a2e1e1e7c306a1787e2a5a7d075991994cd1d99f Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Fri, 5 Sep 2025 09:18:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?perf:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90do=E6=A8=A1=E6=9D=BF=E8=A1=A5=E5=85=85=E8=A1=A8?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_generator/templates/python/do.py.jinja2 | 1 + ruoyi-fastapi-backend/utils/template_util.py | 1 + 2 files changed, 2 insertions(+) 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 22c23c4..c7ea757 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/utils/template_util.py b/ruoyi-fastapi-backend/utils/template_util.py index 6765bd0..afe5c41 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(), -- Gitee From ad6c272098844d0a1206139232ddc276d647dcbf Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 14 Oct 2025 10:50:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?chore&fix:=20=E7=A7=BB=E9=99=A4passlib?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8bcrypt=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E6=8A=A5=E9=94=99=20#ID124V?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-fastapi-backend/requirements-pg.txt | 2 +- ruoyi-fastapi-backend/requirements.txt | 2 +- ruoyi-fastapi-backend/utils/pwd_util.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ruoyi-fastapi-backend/requirements-pg.txt b/ruoyi-fastapi-backend/requirements-pg.txt index c9d1c24..9dbf1fd 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 9040b49..af66bc7 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 86e9c27..c3f91ce 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') -- Gitee From 07b3a15f6972b215e53f50ceaf2b73ef5ac047f7 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 14 Oct 2025 10:53:03 +0800 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=87=B31.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-fastapi-backend/.env.dev | 2 +- ruoyi-fastapi-backend/.env.prod | 2 +- ruoyi-fastapi-frontend/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-fastapi-backend/.env.dev b/ruoyi-fastapi-backend/.env.dev index 397c44a..a792ea9 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 11b8303..e932e39 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-frontend/package.json b/ruoyi-fastapi-frontend/package.json index 71fe592..0bffa57 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", -- Gitee From ca5b2d9e9f072c17227b2a52bf6c0302f9044971 Mon Sep 17 00:00:00 2001 From: insistence <3055204202@qq.com> Date: Tue, 14 Oct 2025 10:53:09 +0800 Subject: [PATCH 5/5] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0README=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e50d0e..188eb2f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@