refactor: 引入日志切割库、indexApi拆分等

This commit is contained in:
meilin.huang
2024-01-23 19:30:28 +08:00
parent d530365ef9
commit e4d13f3377
43 changed files with 324 additions and 241 deletions

View File

@@ -57,7 +57,7 @@ type DbSqlExec interface {
}
type dbSqlExecAppImpl struct {
DbSqlExecRepo repository.DbSqlExec `inject:""`
dbSqlExecRepo repository.DbSqlExec `inject:"DbSqlExecRepo"`
}
func createSqlExecRecord(ctx context.Context, execSqlReq *DbSqlExecReq) *entity.DbSqlExec {
@@ -138,23 +138,23 @@ func (d *dbSqlExecAppImpl) Exec(ctx context.Context, execSqlReq *DbSqlExecReq) (
// 保存sql执行记录如果是查询类则根据系统配置判断是否保存
func (d *dbSqlExecAppImpl) saveSqlExecLog(isQuery bool, dbSqlExecRecord *entity.DbSqlExec) {
if !isQuery {
d.DbSqlExecRepo.Insert(context.TODO(), dbSqlExecRecord)
d.dbSqlExecRepo.Insert(context.TODO(), dbSqlExecRecord)
return
}
if config.GetDbSaveQuerySql() {
dbSqlExecRecord.Table = "-"
dbSqlExecRecord.OldValue = "-"
dbSqlExecRecord.Type = entity.DbSqlExecTypeQuery
d.DbSqlExecRepo.Insert(context.TODO(), dbSqlExecRecord)
d.dbSqlExecRepo.Insert(context.TODO(), dbSqlExecRecord)
}
}
func (d *dbSqlExecAppImpl) DeleteBy(ctx context.Context, condition *entity.DbSqlExec) {
d.DbSqlExecRepo.DeleteByCond(ctx, condition)
d.dbSqlExecRepo.DeleteByCond(ctx, condition)
}
func (d *dbSqlExecAppImpl) GetPageList(condition *entity.DbSqlExecQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
return d.DbSqlExecRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
return d.dbSqlExecRepo.GetPageList(condition, pageParam, toEntity, orderBy...)
}
func doSelect(ctx context.Context, selectStmt *sqlparser.Select, execSqlReq *DbSqlExecReq) (*DbSqlExecRes, error) {