diff --git a/README.md b/README.md
index 45bc8c83be1a0a7e8d508bfd170502ce32b3ef99..6143b732090f8918da9167cd437969dd4771cd64 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,18 @@
-RuoYi-Vue-FastAPI v1.0.0
+RuoYi-Vue-FastAPI v1.0.1
基于RuoYi-Vue+FastAPI前后端分离的快速开发框架
-
+
+
## 平台简介
RuoYi-Vue-FastAPI是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
diff --git a/ruoyi-fastapi-backend/module_admin/dao/log_dao.py b/ruoyi-fastapi-backend/module_admin/dao/log_dao.py
index 7fefc8f1edb0b287af9b58bd836ff7e7c7c1ce78..b2abd545ab19fccb2df8cd17e9e0d2ff46b0c999 100644
--- a/ruoyi-fastapi-backend/module_admin/dao/log_dao.py
+++ b/ruoyi-fastapi-backend/module_admin/dao/log_dao.py
@@ -1,7 +1,9 @@
+from sqlalchemy import asc, desc
from sqlalchemy.orm import Session
from module_admin.entity.do.log_do import SysOperLog, SysLogininfor
from module_admin.entity.vo.log_vo import *
from utils.page_util import PageUtil
+from utils.common_util import CamelCaseUtil
from datetime import datetime, time
@@ -18,6 +20,12 @@ class OperationLogDao:
:param is_page: 是否开启分页
:return: 操作日志列表信息对象
"""
+ if query_object.is_asc == 'ascending':
+ order_by_column = asc(getattr(SysOperLog, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
+ elif query_object.is_asc == 'descending':
+ order_by_column = desc(getattr(SysOperLog, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
+ else:
+ order_by_column = desc(SysOperLog.oper_time)
query = db.query(SysOperLog) \
.filter(SysOperLog.title.like(f'%{query_object.title}%') if query_object.title else True,
SysOperLog.oper_name.like(f'%{query_object.oper_name}%') if query_object.oper_name else True,
@@ -28,7 +36,7 @@ class OperationLogDao:
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)))
if query_object.begin_time and query_object.end_time else True
)\
- .distinct()
+ .distinct().order_by(order_by_column)
operation_log_list = PageUtil.paginate(query, query_object.page_num, query_object.page_size, is_page)
return operation_log_list
@@ -84,6 +92,12 @@ class LoginLogDao:
:param is_page: 是否开启分页
:return: 登录日志列表信息对象
"""
+ if query_object.is_asc == 'ascending':
+ order_by_column = asc(getattr(SysLogininfor, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
+ elif query_object.is_asc == 'descending':
+ order_by_column = desc(getattr(SysLogininfor, CamelCaseUtil.camel_to_snake(query_object.order_by_column), None))
+ else:
+ order_by_column = desc(SysLogininfor.login_time)
query = db.query(SysLogininfor) \
.filter(SysLogininfor.ipaddr.like(f'%{query_object.ipaddr}%') if query_object.ipaddr else True,
SysLogininfor.user_name.like(f'%{query_object.user_name}%') if query_object.user_name else True,
@@ -93,7 +107,7 @@ class LoginLogDao:
datetime.combine(datetime.strptime(query_object.end_time, '%Y-%m-%d'), time(23, 59, 59)))
if query_object.begin_time and query_object.end_time else True
)\
- .distinct()
+ .distinct().order_by(order_by_column)
login_log_list = PageUtil.paginate(query, query_object.page_num, query_object.page_size, is_page)
return login_log_list
diff --git a/ruoyi-fastapi-backend/module_admin/entity/vo/log_vo.py b/ruoyi-fastapi-backend/module_admin/entity/vo/log_vo.py
index d410a238de89091f1957025859d640c6bf0bb093..604bb5dff5ac488ecde8d125b2c9f018d7a7a1cc 100644
--- a/ruoyi-fastapi-backend/module_admin/entity/vo/log_vo.py
+++ b/ruoyi-fastapi-backend/module_admin/entity/vo/log_vo.py
@@ -51,6 +51,8 @@ class OperLogQueryModel(OperLogModel):
"""
操作日志管理不分页查询模型
"""
+ order_by_column: Optional[str] = None
+ is_asc: Optional[str] = None
begin_time: Optional[str] = None
end_time: Optional[str] = None
@@ -78,6 +80,8 @@ class LoginLogQueryModel(LogininforModel):
"""
登录日志管理不分页查询模型
"""
+ order_by_column: Optional[str] = None
+ is_asc: Optional[str] = None
begin_time: Optional[str] = None
end_time: Optional[str] = None
diff --git a/ruoyi-fastapi-backend/requirements.txt b/ruoyi-fastapi-backend/requirements.txt
index 535284aad15dbbb1c7189c3535dbb3e3a1b56d7e..0e606a853cd8ad5d7913b20b04f5afee1274da0d 100644
--- a/ruoyi-fastapi-backend/requirements.txt
+++ b/ruoyi-fastapi-backend/requirements.txt
@@ -1,6 +1,6 @@
APScheduler==3.10.4
DateTime==5.4
-fastapi[all]==0.109.0
+fastapi[all]==0.109.1
loguru==0.7.2
openpyxl==3.1.2
pandas==2.1.4
diff --git a/ruoyi-fastapi-backend/utils/common_util.py b/ruoyi-fastapi-backend/utils/common_util.py
index f8f8dcadbb9fac51f3b7bd996d033562d593c350..df9a6a54b6549fab1fb1e524313f17b634b6a851 100644
--- a/ruoyi-fastapi-backend/utils/common_util.py
+++ b/ruoyi-fastapi-backend/utils/common_util.py
@@ -1,6 +1,7 @@
import pandas as pd
import io
import os
+import re
from openpyxl import Workbook
from openpyxl.styles import Alignment, PatternFill
from openpyxl.utils import get_column_letter
@@ -39,10 +40,21 @@ def worship():
class CamelCaseUtil:
"""
- 下划线形式(snake_case)转换为小驼峰形式(camelCase)工具方法
+ 小驼峰形式(camelCase)与下划线形式(snake_case)互相转换工具方法
"""
@classmethod
- def __to_camel_case(cls, snake_str):
+ def camel_to_snake(cls, camel_str):
+ """
+ 小驼峰形式字符串(camelCase)转换为下划线形式字符串(snake_case)
+ :param camel_str: 小驼峰形式字符串
+ :return: 下划线形式字符串
+ """
+ # 在大写字母前添加一个下划线,然后将整个字符串转为小写
+ words = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_str)
+ return re.sub('([a-z0-9])([A-Z])', r'\1_\2', words).lower()
+
+ @classmethod
+ def snake_to_camel(cls, snake_str):
"""
下划线形式字符串(snake_case)转换为小驼峰形式字符串(camelCase)
:param snake_str: 下划线形式字符串
@@ -64,7 +76,7 @@ class CamelCaseUtil:
return result
# 如果是字典,直接转换键
elif isinstance(result, dict):
- return {cls.__to_camel_case(k): v for k, v in result.items()}
+ return {cls.snake_to_camel(k): v for k, v in result.items()}
# 如果是一组字典或其他类型的列表,遍历列表进行转换
elif isinstance(result, list):
return [cls.transform_result(row) if isinstance(row, (dict, Row)) else (cls.transform_result({c.name: getattr(row, c.name) for c in row.__table__.columns}) if row else row) for row in result]
diff --git a/ruoyi-fastapi-frontend/README.md b/ruoyi-fastapi-frontend/README.md
deleted file mode 100644
index 00c0ab84ffbb6cbdb4f51a490c22ca94c2690292..0000000000000000000000000000000000000000
--- a/ruoyi-fastapi-frontend/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-## 开发
-
-```bash
-# 克隆项目
-git clone https://gitee.com/y_project/RuoYi-Vue
-
-# 进入项目目录
-cd ruoyi-ui
-
-# 安装依赖
-npm install
-
-# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
-npm install --registry=https://registry.npmmirror.com
-
-# 启动服务
-npm run dev
-```
-
-浏览器访问 http://localhost:80
-
-## 发布
-
-```bash
-# 构建测试环境
-npm run build:stage
-
-# 构建生产环境
-npm run build:prod
-```
\ No newline at end of file