mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Update code generator file and table naming (#579)
* Update code generator file and table naming * Update column table comment
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
|
||||||
from backend.core.conf import settings
|
from backend.core.conf import settings
|
||||||
|
from backend.plugin.code_generator.api.v1.business import router as gen_business_router
|
||||||
|
from backend.plugin.code_generator.api.v1.column import router as gen_model_router
|
||||||
from backend.plugin.code_generator.api.v1.gen import router as gen_router
|
from backend.plugin.code_generator.api.v1.gen import router as gen_router
|
||||||
from backend.plugin.code_generator.api.v1.gen_business import router as gen_business_router
|
|
||||||
from backend.plugin.code_generator.api.v1.gen_model import router as gen_model_router
|
|
||||||
|
|
||||||
v1 = APIRouter(prefix=f'{settings.FASTAPI_API_V1_PATH}/gen', tags=['代码生成'])
|
v1 = APIRouter(prefix=f'{settings.FASTAPI_API_V1_PATH}/gen', tags=['代码生成'])
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -8,14 +8,14 @@ from backend.common.response.response_schema import ResponseModel, ResponseSchem
|
|||||||
from backend.common.security.jwt import DependsJwtAuth
|
from backend.common.security.jwt import DependsJwtAuth
|
||||||
from backend.common.security.permission import RequestPermission
|
from backend.common.security.permission import RequestPermission
|
||||||
from backend.common.security.rbac import DependsRBAC
|
from backend.common.security.rbac import DependsRBAC
|
||||||
from backend.plugin.code_generator.schema.gen_business import (
|
from backend.plugin.code_generator.schema.business import (
|
||||||
CreateGenBusinessParam,
|
CreateGenBusinessParam,
|
||||||
GetGenBusinessDetail,
|
GetGenBusinessDetail,
|
||||||
UpdateGenBusinessParam,
|
UpdateGenBusinessParam,
|
||||||
)
|
)
|
||||||
from backend.plugin.code_generator.schema.gen_model import GetGenModelDetail
|
from backend.plugin.code_generator.schema.column import GetGenModelDetail
|
||||||
from backend.plugin.code_generator.service.gen_business_service import gen_business_service
|
from backend.plugin.code_generator.service.business_service import gen_business_service
|
||||||
from backend.plugin.code_generator.service.gen_model_service import gen_model_service
|
from backend.plugin.code_generator.service.column_service import gen_model_service
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
+2
-2
@@ -8,8 +8,8 @@ from backend.common.response.response_schema import ResponseModel, ResponseSchem
|
|||||||
from backend.common.security.jwt import DependsJwtAuth
|
from backend.common.security.jwt import DependsJwtAuth
|
||||||
from backend.common.security.permission import RequestPermission
|
from backend.common.security.permission import RequestPermission
|
||||||
from backend.common.security.rbac import DependsRBAC
|
from backend.common.security.rbac import DependsRBAC
|
||||||
from backend.plugin.code_generator.schema.gen_model import CreateGenModelParam, GetGenModelDetail, UpdateGenModelParam
|
from backend.plugin.code_generator.schema.column import CreateGenModelParam, GetGenModelDetail, UpdateGenModelParam
|
||||||
from backend.plugin.code_generator.service.gen_model_service import gen_model_service
|
from backend.plugin.code_generator.service.column_service import gen_model_service
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
+1
-1
@@ -6,7 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||||||
from sqlalchemy_crud_plus import CRUDPlus
|
from sqlalchemy_crud_plus import CRUDPlus
|
||||||
|
|
||||||
from backend.plugin.code_generator.model import GenBusiness
|
from backend.plugin.code_generator.model import GenBusiness
|
||||||
from backend.plugin.code_generator.schema.gen_business import CreateGenBusinessParam, UpdateGenBusinessParam
|
from backend.plugin.code_generator.schema.business import CreateGenBusinessParam, UpdateGenBusinessParam
|
||||||
|
|
||||||
|
|
||||||
class CRUDGenBusiness(CRUDPlus[GenBusiness]):
|
class CRUDGenBusiness(CRUDPlus[GenBusiness]):
|
||||||
+6
-6
@@ -5,14 +5,14 @@ from typing import Sequence
|
|||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
from sqlalchemy_crud_plus import CRUDPlus
|
from sqlalchemy_crud_plus import CRUDPlus
|
||||||
|
|
||||||
from backend.plugin.code_generator.model import GenModel
|
from backend.plugin.code_generator.model import GenColumn
|
||||||
from backend.plugin.code_generator.schema.gen_model import CreateGenModelParam, UpdateGenModelParam
|
from backend.plugin.code_generator.schema.column import CreateGenModelParam, UpdateGenModelParam
|
||||||
|
|
||||||
|
|
||||||
class CRUDGenModel(CRUDPlus[GenModel]):
|
class CRUDGenModel(CRUDPlus[GenColumn]):
|
||||||
"""代码生成模型 CRUD 类"""
|
"""代码生成模型 CRUD 类"""
|
||||||
|
|
||||||
async def get(self, db: AsyncSession, pk: int) -> GenModel | None:
|
async def get(self, db: AsyncSession, pk: int) -> GenColumn | None:
|
||||||
"""
|
"""
|
||||||
获取代码生成模型列
|
获取代码生成模型列
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ class CRUDGenModel(CRUDPlus[GenModel]):
|
|||||||
"""
|
"""
|
||||||
return await self.select_model(db, pk)
|
return await self.select_model(db, pk)
|
||||||
|
|
||||||
async def get_all_by_business(self, db: AsyncSession, business_id: int) -> Sequence[GenModel]:
|
async def get_all_by_business(self, db: AsyncSession, business_id: int) -> Sequence[GenColumn]:
|
||||||
"""
|
"""
|
||||||
获取所有代码生成模型列
|
获取所有代码生成模型列
|
||||||
|
|
||||||
@@ -66,4 +66,4 @@ class CRUDGenModel(CRUDPlus[GenModel]):
|
|||||||
return await self.delete_model(db, pk)
|
return await self.delete_model(db, pk)
|
||||||
|
|
||||||
|
|
||||||
gen_model_dao: CRUDGenModel = CRUDGenModel(GenModel)
|
gen_model_dao: CRUDGenModel = CRUDGenModel(GenColumn)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from backend.plugin.code_generator.model.gen_business import GenBusiness
|
from backend.plugin.code_generator.model.business import GenBusiness
|
||||||
from backend.plugin.code_generator.model.gen_model import GenModel
|
from backend.plugin.code_generator.model.column import GenColumn
|
||||||
|
|||||||
+4
-3
@@ -10,13 +10,13 @@ from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|||||||
from backend.common.model import Base, id_key
|
from backend.common.model import Base, id_key
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from backend.plugin.code_generator.model import GenModel
|
from backend.plugin.code_generator.model import GenColumn
|
||||||
|
|
||||||
|
|
||||||
class GenBusiness(Base):
|
class GenBusiness(Base):
|
||||||
"""代码生成业务表"""
|
"""代码生成业务表"""
|
||||||
|
|
||||||
__tablename__ = 'sys_gen_business'
|
__tablename__ = 'gen_business'
|
||||||
|
|
||||||
id: Mapped[id_key] = mapped_column(init=False)
|
id: Mapped[id_key] = mapped_column(init=False)
|
||||||
app_name: Mapped[str] = mapped_column(String(50), comment='应用名称(英文)')
|
app_name: Mapped[str] = mapped_column(String(50), comment='应用名称(英文)')
|
||||||
@@ -26,6 +26,7 @@ class GenBusiness(Base):
|
|||||||
table_comment: Mapped[str | None] = mapped_column(String(255), default=None, comment='表描述')
|
table_comment: Mapped[str | None] = mapped_column(String(255), default=None, comment='表描述')
|
||||||
# relate_model_fk: Mapped[int | None] = mapped_column(default=None, comment='关联表外键')
|
# relate_model_fk: Mapped[int | None] = mapped_column(default=None, comment='关联表外键')
|
||||||
schema_name: Mapped[str | None] = mapped_column(String(255), default=None, comment='Schema 名称 (默认为英文表名称)')
|
schema_name: Mapped[str | None] = mapped_column(String(255), default=None, comment='Schema 名称 (默认为英文表名称)')
|
||||||
|
filename: Mapped[str | None] = mapped_column(String(20), default=None, comment='基础文件名(默认为英文表名称)')
|
||||||
default_datetime_column: Mapped[bool] = mapped_column(default=True, comment='是否存在默认时间列')
|
default_datetime_column: Mapped[bool] = mapped_column(default=True, comment='是否存在默认时间列')
|
||||||
api_version: Mapped[str] = mapped_column(String(20), default='v1', comment='代码生成 api 版本,默认为 v1')
|
api_version: Mapped[str] = mapped_column(String(20), default='v1', comment='代码生成 api 版本,默认为 v1')
|
||||||
gen_path: Mapped[str | None] = mapped_column(String(255), default=None, comment='代码生成路径(默认为 app 根路径)')
|
gen_path: Mapped[str | None] = mapped_column(String(255), default=None, comment='代码生成路径(默认为 app 根路径)')
|
||||||
@@ -33,4 +34,4 @@ class GenBusiness(Base):
|
|||||||
LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='备注'
|
LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='备注'
|
||||||
)
|
)
|
||||||
# 代码生成业务模型一对多
|
# 代码生成业务模型一对多
|
||||||
gen_model: Mapped[list['GenModel']] = relationship(init=False, back_populates='gen_business')
|
gen_column: Mapped[list['GenColumn']] = relationship(init=False, back_populates='gen_business')
|
||||||
+6
-6
@@ -13,15 +13,15 @@ if TYPE_CHECKING:
|
|||||||
from backend.plugin.code_generator.model import GenBusiness
|
from backend.plugin.code_generator.model import GenBusiness
|
||||||
|
|
||||||
|
|
||||||
class GenModel(DataClassBase):
|
class GenColumn(DataClassBase):
|
||||||
"""代码生成模型表"""
|
"""代码生成模型列表"""
|
||||||
|
|
||||||
__tablename__ = 'sys_gen_model'
|
__tablename__ = 'gen_column'
|
||||||
|
|
||||||
id: Mapped[id_key] = mapped_column(init=False)
|
id: Mapped[id_key] = mapped_column(init=False)
|
||||||
name: Mapped[str] = mapped_column(String(50), comment='列名称')
|
name: Mapped[str] = mapped_column(String(50), comment='列名称')
|
||||||
comment: Mapped[str | None] = mapped_column(String(255), default=None, comment='列描述')
|
comment: Mapped[str | None] = mapped_column(String(255), default=None, comment='列描述')
|
||||||
type: Mapped[str] = mapped_column(String(20), default='str', comment='SQLA 模型列类型')
|
type: Mapped[str] = mapped_column(String(20), default='String', comment='SQLA 模型列类型')
|
||||||
pd_type: Mapped[str] = mapped_column(String(20), default='str', comment='列类型对应的 pydantic 类型')
|
pd_type: Mapped[str] = mapped_column(String(20), default='str', comment='列类型对应的 pydantic 类型')
|
||||||
default: Mapped[str | None] = mapped_column(
|
default: Mapped[str | None] = mapped_column(
|
||||||
LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='列默认值'
|
LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='列默认值'
|
||||||
@@ -33,6 +33,6 @@ class GenModel(DataClassBase):
|
|||||||
|
|
||||||
# 代码生成业务模型一对多
|
# 代码生成业务模型一对多
|
||||||
gen_business_id: Mapped[int] = mapped_column(
|
gen_business_id: Mapped[int] = mapped_column(
|
||||||
ForeignKey('sys_gen_business.id', ondelete='CASCADE'), default=0, comment='代码生成业务ID'
|
ForeignKey('gen_business.id', ondelete='CASCADE'), default=0, comment='代码生成业务ID'
|
||||||
)
|
)
|
||||||
gen_business: Mapped[Union['GenBusiness', None]] = relationship(init=False, back_populates='gen_model')
|
gen_business: Mapped[Union['GenBusiness', None]] = relationship(init=False, back_populates='gen_column')
|
||||||
+2
-9
@@ -2,8 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from pydantic import ConfigDict, Field, model_validator
|
from pydantic import ConfigDict, Field
|
||||||
from typing_extensions import Self
|
|
||||||
|
|
||||||
from backend.common.schema import SchemaBase
|
from backend.common.schema import SchemaBase
|
||||||
|
|
||||||
@@ -17,18 +16,12 @@ class GenBusinessSchemaBase(SchemaBase):
|
|||||||
table_simple_name_zh: str = Field(description='表名称(中文简称)')
|
table_simple_name_zh: str = Field(description='表名称(中文简称)')
|
||||||
table_comment: str | None = Field(None, description='表描述')
|
table_comment: str | None = Field(None, description='表描述')
|
||||||
schema_name: str | None = Field(None, description='Schema 名称 (默认为英文表名称)')
|
schema_name: str | None = Field(None, description='Schema 名称 (默认为英文表名称)')
|
||||||
|
filename: str | None = Field(None, description='基础文件名(默认为英文表名称)')
|
||||||
default_datetime_column: bool = Field(True, description='是否存在默认时间列')
|
default_datetime_column: bool = Field(True, description='是否存在默认时间列')
|
||||||
api_version: str = Field('v1', description='代码生成 api 版本')
|
api_version: str = Field('v1', description='代码生成 api 版本')
|
||||||
gen_path: str | None = Field(None, description='代码生成路径(默认为 app 根路径)')
|
gen_path: str | None = Field(None, description='代码生成路径(默认为 app 根路径)')
|
||||||
remark: str | None = Field(None, description='备注')
|
remark: str | None = Field(None, description='备注')
|
||||||
|
|
||||||
@model_validator(mode='after')
|
|
||||||
def check_schema_name(self) -> Self:
|
|
||||||
"""检查并设置 schema 名称"""
|
|
||||||
if self.schema_name is None:
|
|
||||||
self.schema_name = self.table_name_en
|
|
||||||
return self
|
|
||||||
|
|
||||||
|
|
||||||
class CreateGenBusinessParam(GenBusinessSchemaBase):
|
class CreateGenBusinessParam(GenBusinessSchemaBase):
|
||||||
"""创建代码生成业务参数"""
|
"""创建代码生成业务参数"""
|
||||||
+2
-2
@@ -4,9 +4,9 @@ from typing import Sequence
|
|||||||
|
|
||||||
from backend.common.exception import errors
|
from backend.common.exception import errors
|
||||||
from backend.database.db import async_db_session
|
from backend.database.db import async_db_session
|
||||||
from backend.plugin.code_generator.crud.crud_gen_business import gen_business_dao
|
from backend.plugin.code_generator.crud.crud_business import gen_business_dao
|
||||||
from backend.plugin.code_generator.model import GenBusiness
|
from backend.plugin.code_generator.model import GenBusiness
|
||||||
from backend.plugin.code_generator.schema.gen_business import CreateGenBusinessParam, UpdateGenBusinessParam
|
from backend.plugin.code_generator.schema.business import CreateGenBusinessParam, UpdateGenBusinessParam
|
||||||
|
|
||||||
|
|
||||||
class GenBusinessService:
|
class GenBusinessService:
|
||||||
+5
-5
@@ -4,10 +4,10 @@ from typing import Sequence
|
|||||||
|
|
||||||
from backend.common.exception import errors
|
from backend.common.exception import errors
|
||||||
from backend.database.db import async_db_session
|
from backend.database.db import async_db_session
|
||||||
from backend.plugin.code_generator.crud.crud_gen_model import gen_model_dao
|
from backend.plugin.code_generator.crud.crud_column import gen_model_dao
|
||||||
from backend.plugin.code_generator.enums import GenModelMySQLColumnType
|
from backend.plugin.code_generator.enums import GenModelMySQLColumnType
|
||||||
from backend.plugin.code_generator.model import GenModel
|
from backend.plugin.code_generator.model import GenColumn
|
||||||
from backend.plugin.code_generator.schema.gen_model import CreateGenModelParam, UpdateGenModelParam
|
from backend.plugin.code_generator.schema.column import CreateGenModelParam, UpdateGenModelParam
|
||||||
from backend.plugin.code_generator.utils.type_conversion import sql_type_to_pydantic
|
from backend.plugin.code_generator.utils.type_conversion import sql_type_to_pydantic
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ class GenModelService:
|
|||||||
"""代码生成模型服务类"""
|
"""代码生成模型服务类"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get(*, pk: int) -> GenModel:
|
async def get(*, pk: int) -> GenColumn:
|
||||||
"""
|
"""
|
||||||
获取指定 ID 的模型
|
获取指定 ID 的模型
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ class GenModelService:
|
|||||||
return types
|
return types
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_by_business(*, business_id: int) -> Sequence[GenModel]:
|
async def get_by_business(*, business_id: int) -> Sequence[GenColumn]:
|
||||||
"""
|
"""
|
||||||
获取指定业务的所有模型
|
获取指定业务的所有模型
|
||||||
|
|
||||||
@@ -5,6 +5,7 @@ import os.path
|
|||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Sequence
|
||||||
|
|
||||||
import aiofiles
|
import aiofiles
|
||||||
|
|
||||||
@@ -13,14 +14,14 @@ from pydantic.alias_generators import to_pascal
|
|||||||
from backend.common.exception import errors
|
from backend.common.exception import errors
|
||||||
from backend.core.path_conf import BASE_PATH
|
from backend.core.path_conf import BASE_PATH
|
||||||
from backend.database.db import async_db_session
|
from backend.database.db import async_db_session
|
||||||
|
from backend.plugin.code_generator.crud.crud_business import gen_business_dao
|
||||||
|
from backend.plugin.code_generator.crud.crud_column import gen_model_dao
|
||||||
from backend.plugin.code_generator.crud.crud_gen import gen_dao
|
from backend.plugin.code_generator.crud.crud_gen import gen_dao
|
||||||
from backend.plugin.code_generator.crud.crud_gen_business import gen_business_dao
|
|
||||||
from backend.plugin.code_generator.crud.crud_gen_model import gen_model_dao
|
|
||||||
from backend.plugin.code_generator.model import GenBusiness
|
from backend.plugin.code_generator.model import GenBusiness
|
||||||
|
from backend.plugin.code_generator.schema.business import CreateGenBusinessParam
|
||||||
|
from backend.plugin.code_generator.schema.column import CreateGenModelParam
|
||||||
from backend.plugin.code_generator.schema.gen import ImportParam
|
from backend.plugin.code_generator.schema.gen import ImportParam
|
||||||
from backend.plugin.code_generator.schema.gen_business import CreateGenBusinessParam
|
from backend.plugin.code_generator.service.column_service import gen_model_service
|
||||||
from backend.plugin.code_generator.schema.gen_model import CreateGenModelParam
|
|
||||||
from backend.plugin.code_generator.service.gen_model_service import gen_model_service
|
|
||||||
from backend.plugin.code_generator.utils.gen_template import gen_template
|
from backend.plugin.code_generator.utils.gen_template import gen_template
|
||||||
from backend.plugin.code_generator.utils.type_conversion import sql_type_to_pydantic
|
from backend.plugin.code_generator.utils.type_conversion import sql_type_to_pydantic
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ class GenService:
|
|||||||
"""代码生成服务类"""
|
"""代码生成服务类"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_tables(*, table_schema: str) -> list[str]:
|
async def get_tables(*, table_schema: str) -> Sequence[str]:
|
||||||
"""
|
"""
|
||||||
获取指定 schema 下的所有表名
|
获取指定 schema 下的所有表名
|
||||||
|
|
||||||
@@ -57,14 +58,17 @@ class GenService:
|
|||||||
raise errors.ForbiddenError(msg='已存在相同数据库表业务')
|
raise errors.ForbiddenError(msg='已存在相同数据库表业务')
|
||||||
|
|
||||||
table_name = table_info[0]
|
table_name = table_info[0]
|
||||||
business_data = {
|
new_business = GenBusiness(
|
||||||
'app_name': obj.app,
|
**CreateGenBusinessParam(
|
||||||
'table_name_en': table_name,
|
app_name=obj.app,
|
||||||
'table_name_zh': table_info[1] or ' '.join(table_name.split('_')),
|
table_name_en=table_name,
|
||||||
'table_simple_name_zh': table_info[1] or table_name.split('_')[-1],
|
table_name_zh=table_info[1] or ' '.join(table_name.split('_')),
|
||||||
'table_comment': table_info[1],
|
table_simple_name_zh=table_info[1] or table_name.split('_')[-1],
|
||||||
}
|
table_comment=table_info[1],
|
||||||
new_business = GenBusiness(**CreateGenBusinessParam(**business_data).model_dump())
|
schema_name=table_name,
|
||||||
|
filename=table_name,
|
||||||
|
).model_dump()
|
||||||
|
)
|
||||||
db.add(new_business)
|
db.add(new_business)
|
||||||
await db.flush()
|
await db.flush()
|
||||||
|
|
||||||
@@ -72,17 +76,20 @@ class GenService:
|
|||||||
for column in column_info:
|
for column in column_info:
|
||||||
column_type = column[-1].split('(')[0].upper()
|
column_type = column[-1].split('(')[0].upper()
|
||||||
pd_type = sql_type_to_pydantic(column_type)
|
pd_type = sql_type_to_pydantic(column_type)
|
||||||
model_data = {
|
await gen_model_dao.create(
|
||||||
'name': column[0],
|
db,
|
||||||
'comment': column[-2],
|
CreateGenModelParam(
|
||||||
'type': column_type,
|
name=column[0],
|
||||||
'sort': column[-3],
|
comment=column[-2],
|
||||||
'length': column[-1].split('(')[1][:-1] if pd_type == 'str' and '(' in column[-1] else 0,
|
type=column_type,
|
||||||
'is_pk': column[1],
|
sort=column[-3],
|
||||||
'is_nullable': column[2],
|
length=column[-1].split('(')[1][:-1] if pd_type == 'str' and '(' in column[-1] else 0,
|
||||||
'gen_business_id': new_business.id,
|
is_pk=column[1],
|
||||||
}
|
is_nullable=column[2],
|
||||||
await gen_model_dao.create(db, CreateGenModelParam(**model_data), pd_type=pd_type)
|
gen_business_id=new_business.id,
|
||||||
|
),
|
||||||
|
pd_type=pd_type,
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def render_tpl_code(*, business: GenBusiness) -> dict[str, str]:
|
async def render_tpl_code(*, business: GenBusiness) -> dict[str, str]:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from jinja2 import Environment, FileSystemLoader, Template, select_autoescape
|
|||||||
from pydantic.alias_generators import to_pascal, to_snake
|
from pydantic.alias_generators import to_pascal, to_snake
|
||||||
|
|
||||||
from backend.core.conf import settings
|
from backend.core.conf import settings
|
||||||
from backend.plugin.code_generator.model import GenBusiness, GenModel
|
from backend.plugin.code_generator.model import GenBusiness, GenColumn
|
||||||
from backend.plugin.code_generator.path_conf import JINJA2_TEMPLATE_DIR
|
from backend.plugin.code_generator.path_conf import JINJA2_TEMPLATE_DIR
|
||||||
|
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ class GenTemplate:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
app_name = business.app_name
|
app_name = business.app_name
|
||||||
module_name = business.table_name_en
|
filename = business.filename
|
||||||
return [
|
return [
|
||||||
f'{app_name}/api/{business.api_version}/{module_name}.py',
|
f'{app_name}/api/{business.api_version}/{filename}.py',
|
||||||
f'{app_name}/crud/crud_{module_name}.py',
|
f'{app_name}/crud/crud_{filename}.py',
|
||||||
f'{app_name}/model/{module_name}.py',
|
f'{app_name}/model/{filename}.py',
|
||||||
f'{app_name}/schema/{module_name}.py',
|
f'{app_name}/schema/{filename}.py',
|
||||||
f'{app_name}/service/{module_name}_service.py',
|
f'{app_name}/service/{filename}_service.py',
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_code_gen_path(self, tpl_path: str, business: GenBusiness) -> str:
|
def get_code_gen_path(self, tpl_path: str, business: GenBusiness) -> str:
|
||||||
@@ -78,7 +78,7 @@ class GenTemplate:
|
|||||||
return code_gen_path_mapping[tpl_path]
|
return code_gen_path_mapping[tpl_path]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_vars(business: GenBusiness, models: Sequence[GenModel]) -> dict[str, str | Sequence[GenModel]]:
|
def get_vars(business: GenBusiness, models: Sequence[GenColumn]) -> dict[str, str | Sequence[GenColumn]]:
|
||||||
"""
|
"""
|
||||||
获取模板变量
|
获取模板变量
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,54 @@
|
|||||||
|
create table gen_business
|
||||||
|
(
|
||||||
|
id int auto_increment comment '主键 ID'
|
||||||
|
primary key,
|
||||||
|
app_name varchar(50) not null comment '应用名称(英文)',
|
||||||
|
table_name_en varchar(255) not null comment '表名称(英文)',
|
||||||
|
table_name_zh varchar(255) not null comment '表名称(中文)',
|
||||||
|
table_simple_name_zh varchar(255) not null comment '表名称(中文简称)',
|
||||||
|
table_comment varchar(255) null comment '表描述',
|
||||||
|
schema_name varchar(255) null comment 'Schema 名称 (默认为英文表名称)',
|
||||||
|
filename varchar(20) null comment '基础文件名(默认为英文表名称)',
|
||||||
|
default_datetime_column tinyint(1) not null comment '是否存在默认时间列',
|
||||||
|
api_version varchar(20) not null comment '代码生成 api 版本,默认为 v1',
|
||||||
|
gen_path varchar(255) null comment '代码生成路径(默认为 app 根路径)',
|
||||||
|
remark longtext null comment '备注',
|
||||||
|
created_time datetime not null comment '创建时间',
|
||||||
|
updated_time datetime null comment '更新时间',
|
||||||
|
constraint table_name_en
|
||||||
|
unique (table_name_en)
|
||||||
|
)
|
||||||
|
comment '代码生成业务表';
|
||||||
|
|
||||||
|
create index ix_gen_business_id
|
||||||
|
on gen_business (id);
|
||||||
|
|
||||||
|
create table gen_column
|
||||||
|
(
|
||||||
|
id int auto_increment comment '主键 ID'
|
||||||
|
primary key,
|
||||||
|
name varchar(50) not null comment '列名称',
|
||||||
|
comment varchar(255) null comment '列描述',
|
||||||
|
type varchar(20) not null comment 'SQLA 模型列类型',
|
||||||
|
pd_type varchar(20) not null comment '列类型对应的 pydantic 类型',
|
||||||
|
`default` longtext null comment '列默认值',
|
||||||
|
sort int null comment '列排序',
|
||||||
|
length int not null comment '列长度',
|
||||||
|
is_pk tinyint(1) not null comment '是否主键',
|
||||||
|
is_nullable tinyint(1) not null comment '是否可为空',
|
||||||
|
gen_business_id int not null comment '代码生成业务ID',
|
||||||
|
constraint gen_column_ibfk_1
|
||||||
|
foreign key (gen_business_id) references gen_business (id)
|
||||||
|
on delete cascade
|
||||||
|
)
|
||||||
|
comment '代码生成模型列表';
|
||||||
|
|
||||||
|
create index gen_business_id
|
||||||
|
on gen_column (gen_business_id);
|
||||||
|
|
||||||
|
create index ix_gen_column_id
|
||||||
|
on gen_column (id);
|
||||||
|
|
||||||
create table sys_api
|
create table sys_api
|
||||||
(
|
(
|
||||||
id int auto_increment comment '主键 ID'
|
id int auto_increment comment '主键 ID'
|
||||||
@@ -110,9 +161,7 @@ create table sys_dict_type
|
|||||||
created_time datetime not null comment '创建时间',
|
created_time datetime not null comment '创建时间',
|
||||||
updated_time datetime null comment '更新时间',
|
updated_time datetime null comment '更新时间',
|
||||||
constraint code
|
constraint code
|
||||||
unique (code),
|
unique (code)
|
||||||
constraint name
|
|
||||||
unique (name)
|
|
||||||
)
|
)
|
||||||
comment '字典类型表';
|
comment '字典类型表';
|
||||||
|
|
||||||
@@ -130,8 +179,6 @@ create table sys_dict_data
|
|||||||
updated_time datetime null comment '更新时间',
|
updated_time datetime null comment '更新时间',
|
||||||
constraint label
|
constraint label
|
||||||
unique (label),
|
unique (label),
|
||||||
constraint value
|
|
||||||
unique (value),
|
|
||||||
constraint sys_dict_data_ibfk_1
|
constraint sys_dict_data_ibfk_1
|
||||||
foreign key (type_id) references sys_dict_type (id)
|
foreign key (type_id) references sys_dict_type (id)
|
||||||
on delete cascade
|
on delete cascade
|
||||||
@@ -147,56 +194,6 @@ create index type_id
|
|||||||
create index ix_sys_dict_type_id
|
create index ix_sys_dict_type_id
|
||||||
on sys_dict_type (id);
|
on sys_dict_type (id);
|
||||||
|
|
||||||
create table sys_gen_business
|
|
||||||
(
|
|
||||||
id int auto_increment comment '主键 ID'
|
|
||||||
primary key,
|
|
||||||
app_name varchar(50) not null comment '应用名称(英文)',
|
|
||||||
table_name_en varchar(255) not null comment '表名称(英文)',
|
|
||||||
table_name_zh varchar(255) not null comment '表名称(中文)',
|
|
||||||
table_simple_name_zh varchar(255) not null comment '表名称(中文简称)',
|
|
||||||
table_comment varchar(255) null comment '表描述',
|
|
||||||
schema_name varchar(255) null comment 'Schema 名称 (默认为英文表名称)',
|
|
||||||
default_datetime_column tinyint(1) not null comment '是否存在默认时间列',
|
|
||||||
api_version varchar(20) not null comment '代码生成 api 版本,默认为 v1',
|
|
||||||
gen_path varchar(255) null comment '代码生成路径(默认为 app 根路径)',
|
|
||||||
remark longtext null comment '备注',
|
|
||||||
created_time datetime not null comment '创建时间',
|
|
||||||
updated_time datetime null comment '更新时间',
|
|
||||||
constraint table_name_en
|
|
||||||
unique (table_name_en)
|
|
||||||
)
|
|
||||||
comment '代码生成业务表';
|
|
||||||
|
|
||||||
create index ix_sys_gen_business_id
|
|
||||||
on sys_gen_business (id);
|
|
||||||
|
|
||||||
create table sys_gen_model
|
|
||||||
(
|
|
||||||
id int auto_increment comment '主键 ID'
|
|
||||||
primary key,
|
|
||||||
name varchar(50) not null comment '列名称',
|
|
||||||
comment varchar(255) null comment '列描述',
|
|
||||||
type varchar(20) not null comment 'SQLA 模型列类型',
|
|
||||||
pd_type varchar(20) not null comment '列类型对应的 pydantic 类型',
|
|
||||||
`default` longtext null comment '列默认值',
|
|
||||||
sort int null comment '列排序',
|
|
||||||
length int not null comment '列长度',
|
|
||||||
is_pk tinyint(1) not null comment '是否主键',
|
|
||||||
is_nullable tinyint(1) not null comment '是否可为空',
|
|
||||||
gen_business_id int not null comment '代码生成业务ID',
|
|
||||||
constraint sys_gen_model_ibfk_1
|
|
||||||
foreign key (gen_business_id) references sys_gen_business (id)
|
|
||||||
on delete cascade
|
|
||||||
)
|
|
||||||
comment '代码生成模型表';
|
|
||||||
|
|
||||||
create index gen_business_id
|
|
||||||
on sys_gen_model (gen_business_id);
|
|
||||||
|
|
||||||
create index ix_sys_gen_model_id
|
|
||||||
on sys_gen_model (id);
|
|
||||||
|
|
||||||
create table sys_login_log
|
create table sys_login_log
|
||||||
(
|
(
|
||||||
id int auto_increment comment '主键 ID'
|
id int auto_increment comment '主键 ID'
|
||||||
|
|||||||
@@ -397,6 +397,62 @@ alter table sys_casbin_rule
|
|||||||
create index ix_sys_casbin_rule_id
|
create index ix_sys_casbin_rule_id
|
||||||
on sys_casbin_rule (id);
|
on sys_casbin_rule (id);
|
||||||
|
|
||||||
|
create table gen_business
|
||||||
|
(
|
||||||
|
id serial
|
||||||
|
primary key,
|
||||||
|
app_name varchar(50) not null,
|
||||||
|
table_name_en varchar(255) not null
|
||||||
|
unique,
|
||||||
|
table_name_zh varchar(255) not null,
|
||||||
|
table_simple_name_zh varchar(255) not null,
|
||||||
|
table_comment varchar(255),
|
||||||
|
schema_name varchar(255),
|
||||||
|
filename varchar(20),
|
||||||
|
default_datetime_column boolean not null,
|
||||||
|
api_version varchar(20) not null,
|
||||||
|
gen_path varchar(255),
|
||||||
|
remark text,
|
||||||
|
created_time timestamp with time zone not null,
|
||||||
|
updated_time timestamp with time zone
|
||||||
|
);
|
||||||
|
|
||||||
|
comment on table gen_business is '代码生成业务表';
|
||||||
|
|
||||||
|
comment on column gen_business.id is '主键 ID';
|
||||||
|
|
||||||
|
comment on column gen_business.app_name is '应用名称(英文)';
|
||||||
|
|
||||||
|
comment on column gen_business.table_name_en is '表名称(英文)';
|
||||||
|
|
||||||
|
comment on column gen_business.table_name_zh is '表名称(中文)';
|
||||||
|
|
||||||
|
comment on column gen_business.table_simple_name_zh is '表名称(中文简称)';
|
||||||
|
|
||||||
|
comment on column gen_business.table_comment is '表描述';
|
||||||
|
|
||||||
|
comment on column gen_business.schema_name is 'Schema 名称 (默认为英文表名称)';
|
||||||
|
|
||||||
|
comment on column gen_business.filename is '基础文件名(默认为英文表名称)';
|
||||||
|
|
||||||
|
comment on column gen_business.default_datetime_column is '是否存在默认时间列';
|
||||||
|
|
||||||
|
comment on column gen_business.api_version is '代码生成 api 版本,默认为 v1';
|
||||||
|
|
||||||
|
comment on column gen_business.gen_path is '代码生成路径(默认为 app 根路径)';
|
||||||
|
|
||||||
|
comment on column gen_business.remark is '备注';
|
||||||
|
|
||||||
|
comment on column gen_business.created_time is '创建时间';
|
||||||
|
|
||||||
|
comment on column gen_business.updated_time is '更新时间';
|
||||||
|
|
||||||
|
alter table gen_business
|
||||||
|
owner to postgres;
|
||||||
|
|
||||||
|
create index ix_gen_business_id
|
||||||
|
on gen_business (id);
|
||||||
|
|
||||||
create table sys_config
|
create table sys_config
|
||||||
(
|
(
|
||||||
id serial
|
id serial
|
||||||
@@ -438,6 +494,41 @@ alter table sys_config
|
|||||||
create index ix_sys_config_id
|
create index ix_sys_config_id
|
||||||
on sys_config (id);
|
on sys_config (id);
|
||||||
|
|
||||||
|
create table sys_dict_type
|
||||||
|
(
|
||||||
|
id serial
|
||||||
|
primary key,
|
||||||
|
name varchar(32) not null,
|
||||||
|
code varchar(32) not null
|
||||||
|
unique,
|
||||||
|
status integer not null,
|
||||||
|
remark text,
|
||||||
|
created_time timestamp with time zone not null,
|
||||||
|
updated_time timestamp with time zone
|
||||||
|
);
|
||||||
|
|
||||||
|
comment on table sys_dict_type is '字典类型表';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.id is '主键 ID';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.name is '字典类型名称';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.code is '字典类型编码';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.status is '状态(0停用 1正常)';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.remark is '备注';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.created_time is '创建时间';
|
||||||
|
|
||||||
|
comment on column sys_dict_type.updated_time is '更新时间';
|
||||||
|
|
||||||
|
alter table sys_dict_type
|
||||||
|
owner to postgres;
|
||||||
|
|
||||||
|
create index ix_sys_dict_type_id
|
||||||
|
on sys_dict_type (id);
|
||||||
|
|
||||||
create table sys_notice
|
create table sys_notice
|
||||||
(
|
(
|
||||||
id serial
|
id serial
|
||||||
@@ -478,95 +569,6 @@ alter table sys_notice
|
|||||||
create index ix_sys_notice_id
|
create index ix_sys_notice_id
|
||||||
on sys_notice (id);
|
on sys_notice (id);
|
||||||
|
|
||||||
create table sys_dict_type
|
|
||||||
(
|
|
||||||
id serial
|
|
||||||
primary key,
|
|
||||||
name varchar(32) not null
|
|
||||||
unique,
|
|
||||||
code varchar(32) not null
|
|
||||||
unique,
|
|
||||||
status integer not null,
|
|
||||||
remark text,
|
|
||||||
created_time timestamp with time zone not null,
|
|
||||||
updated_time timestamp with time zone
|
|
||||||
);
|
|
||||||
|
|
||||||
comment on table sys_dict_type is '字典类型表';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.id is '主键 ID';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.name is '字典类型名称';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.code is '字典类型编码';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.status is '状态(0停用 1正常)';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.remark is '备注';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.created_time is '创建时间';
|
|
||||||
|
|
||||||
comment on column sys_dict_type.updated_time is '更新时间';
|
|
||||||
|
|
||||||
alter table sys_dict_type
|
|
||||||
owner to postgres;
|
|
||||||
|
|
||||||
create index ix_sys_dict_type_id
|
|
||||||
on sys_dict_type (id);
|
|
||||||
|
|
||||||
create table sys_gen_business
|
|
||||||
(
|
|
||||||
id serial
|
|
||||||
primary key,
|
|
||||||
app_name varchar(50) not null,
|
|
||||||
table_name_en varchar(255) not null
|
|
||||||
unique,
|
|
||||||
table_name_zh varchar(255) not null,
|
|
||||||
table_simple_name_zh varchar(255) not null,
|
|
||||||
table_comment varchar(255),
|
|
||||||
schema_name varchar(255),
|
|
||||||
default_datetime_column boolean not null,
|
|
||||||
api_version varchar(20) not null,
|
|
||||||
gen_path varchar(255),
|
|
||||||
remark text,
|
|
||||||
created_time timestamp with time zone not null,
|
|
||||||
updated_time timestamp with time zone
|
|
||||||
);
|
|
||||||
|
|
||||||
comment on table sys_gen_business is '代码生成业务表';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.id is '主键 ID';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.app_name is '应用名称(英文)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.table_name_en is '表名称(英文)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.table_name_zh is '表名称(中文)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.table_simple_name_zh is '表名称(中文简称)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.table_comment is '表描述';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.schema_name is 'Schema 名称 (默认为英文表名称)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.default_datetime_column is '是否存在默认时间列';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.api_version is '代码生成 api 版本,默认为 v1';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.gen_path is '代码生成路径(默认为 app 根路径)';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.remark is '备注';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.created_time is '创建时间';
|
|
||||||
|
|
||||||
comment on column sys_gen_business.updated_time is '更新时间';
|
|
||||||
|
|
||||||
alter table sys_gen_business
|
|
||||||
owner to postgres;
|
|
||||||
|
|
||||||
create index ix_sys_gen_business_id
|
|
||||||
on sys_gen_business (id);
|
|
||||||
|
|
||||||
create table sys_role_menu
|
create table sys_role_menu
|
||||||
(
|
(
|
||||||
id serial,
|
id serial,
|
||||||
@@ -681,17 +683,65 @@ comment on column sys_user.updated_time is '更新时间';
|
|||||||
alter table sys_user
|
alter table sys_user
|
||||||
owner to postgres;
|
owner to postgres;
|
||||||
|
|
||||||
|
create index ix_sys_user_id
|
||||||
|
on sys_user (id);
|
||||||
|
|
||||||
|
create unique index ix_sys_user_email
|
||||||
|
on sys_user (email);
|
||||||
|
|
||||||
create unique index ix_sys_user_username
|
create unique index ix_sys_user_username
|
||||||
on sys_user (username);
|
on sys_user (username);
|
||||||
|
|
||||||
create index ix_sys_user_status
|
create index ix_sys_user_status
|
||||||
on sys_user (status);
|
on sys_user (status);
|
||||||
|
|
||||||
create index ix_sys_user_id
|
create table gen_column
|
||||||
on sys_user (id);
|
(
|
||||||
|
id serial
|
||||||
|
primary key,
|
||||||
|
name varchar(50) not null,
|
||||||
|
comment varchar(255),
|
||||||
|
type varchar(20) not null,
|
||||||
|
pd_type varchar(20) not null,
|
||||||
|
"default" text,
|
||||||
|
sort integer,
|
||||||
|
length integer not null,
|
||||||
|
is_pk boolean not null,
|
||||||
|
is_nullable boolean not null,
|
||||||
|
gen_business_id integer not null
|
||||||
|
references gen_business
|
||||||
|
on delete cascade
|
||||||
|
);
|
||||||
|
|
||||||
create unique index ix_sys_user_email
|
comment on table gen_column is '代码生成模型列表';
|
||||||
on sys_user (email);
|
|
||||||
|
comment on column gen_column.id is '主键 ID';
|
||||||
|
|
||||||
|
comment on column gen_column.name is '列名称';
|
||||||
|
|
||||||
|
comment on column gen_column.comment is '列描述';
|
||||||
|
|
||||||
|
comment on column gen_column.type is 'SQLA 模型列类型';
|
||||||
|
|
||||||
|
comment on column gen_column.pd_type is '列类型对应的 pydantic 类型';
|
||||||
|
|
||||||
|
comment on column gen_column."default" is '列默认值';
|
||||||
|
|
||||||
|
comment on column gen_column.sort is '列排序';
|
||||||
|
|
||||||
|
comment on column gen_column.length is '列长度';
|
||||||
|
|
||||||
|
comment on column gen_column.is_pk is '是否主键';
|
||||||
|
|
||||||
|
comment on column gen_column.is_nullable is '是否可为空';
|
||||||
|
|
||||||
|
comment on column gen_column.gen_business_id is '代码生成业务ID';
|
||||||
|
|
||||||
|
alter table gen_column
|
||||||
|
owner to postgres;
|
||||||
|
|
||||||
|
create index ix_gen_column_id
|
||||||
|
on gen_column (id);
|
||||||
|
|
||||||
create table sys_dict_data
|
create table sys_dict_data
|
||||||
(
|
(
|
||||||
@@ -699,8 +749,7 @@ create table sys_dict_data
|
|||||||
primary key,
|
primary key,
|
||||||
label varchar(32) not null
|
label varchar(32) not null
|
||||||
unique,
|
unique,
|
||||||
value varchar(32) not null
|
value varchar(32) not null,
|
||||||
unique,
|
|
||||||
sort integer not null,
|
sort integer not null,
|
||||||
status integer not null,
|
status integer not null,
|
||||||
remark text,
|
remark text,
|
||||||
@@ -737,54 +786,6 @@ alter table sys_dict_data
|
|||||||
create index ix_sys_dict_data_id
|
create index ix_sys_dict_data_id
|
||||||
on sys_dict_data (id);
|
on sys_dict_data (id);
|
||||||
|
|
||||||
create table sys_gen_model
|
|
||||||
(
|
|
||||||
id serial
|
|
||||||
primary key,
|
|
||||||
name varchar(50) not null,
|
|
||||||
comment varchar(255),
|
|
||||||
type varchar(20) not null,
|
|
||||||
pd_type varchar(20) not null,
|
|
||||||
"default" text,
|
|
||||||
sort integer,
|
|
||||||
length integer not null,
|
|
||||||
is_pk boolean not null,
|
|
||||||
is_nullable boolean not null,
|
|
||||||
gen_business_id integer not null
|
|
||||||
references sys_gen_business
|
|
||||||
on delete cascade
|
|
||||||
);
|
|
||||||
|
|
||||||
comment on table sys_gen_model is '代码生成模型表';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.id is '主键 ID';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.name is '列名称';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.comment is '列描述';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.type is 'SQLA 模型列类型';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.pd_type is '列类型对应的 pydantic 类型';
|
|
||||||
|
|
||||||
comment on column sys_gen_model."default" is '列默认值';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.sort is '列排序';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.length is '列长度';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.is_pk is '是否主键';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.is_nullable is '是否可为空';
|
|
||||||
|
|
||||||
comment on column sys_gen_model.gen_business_id is '代码生成业务ID';
|
|
||||||
|
|
||||||
alter table sys_gen_model
|
|
||||||
owner to postgres;
|
|
||||||
|
|
||||||
create index ix_sys_gen_model_id
|
|
||||||
on sys_gen_model (id);
|
|
||||||
|
|
||||||
create table sys_user_role
|
create table sys_user_role
|
||||||
(
|
(
|
||||||
id serial,
|
id serial,
|
||||||
|
|||||||
Reference in New Issue
Block a user