@@ -19,7 +19,7 @@ async def get(self, db: AsyncSession, pk: int) -> DictData | None:
1919 :param pk: 字典数据 ID
2020 :return:
2121 """
22- return await self .select_model (db , pk , load_strategies = { 'type' : 'noload' } )
22+ return await self .select_model (db , pk )
2323
2424 async def get_by_type_code (self , db : AsyncSession , type_code : str ) -> Sequence [DictData ]:
2525 """
@@ -34,7 +34,6 @@ async def get_by_type_code(self, db: AsyncSession, type_code: str) -> Sequence[D
3434 sort_columns = 'sort' ,
3535 sort_orders = 'desc' ,
3636 type_code = type_code ,
37- load_strategies = {'type' : 'noload' },
3837 )
3938
4039 async def get_all (self , db : AsyncSession ) -> Sequence [DictData ]:
@@ -44,7 +43,7 @@ async def get_all(self, db: AsyncSession) -> Sequence[DictData]:
4443 :param db: 数据库会话
4544 :return:
4645 """
47- return await self .select_models (db , load_strategies = { 'type' : 'noload' } )
46+ return await self .select_models (db )
4847
4948 async def get_select (
5049 self ,
@@ -77,7 +76,7 @@ async def get_select(
7776 if type_id is not None :
7877 filters ['type_id' ] = type_id
7978
80- return await self .select_order ('id' , 'desc' , load_strategies = { 'type' : 'noload' }, ** filters )
79+ return await self .select_order ('id' , 'desc' , ** filters )
8180
8281 async def get_by_label_and_type_code (self , db : AsyncSession , label : str , type_code : str ) -> DictData | None :
8382 """
@@ -128,15 +127,15 @@ async def delete(self, db: AsyncSession, pks: list[int]) -> int:
128127 """
129128 return await self .delete_model_by_column (db , allow_multiple = True , id__in = pks )
130129
131- async def get_with_relation (self , db : AsyncSession , pk : int ) -> DictData | None :
130+ async def delete_by_type_id (self , db : AsyncSession , type_ids : list [ int ] ) -> int :
132131 """
133- 获取字典数据及关联数据
132+ 通过类型 ID 删除字典数据
134133
135134 :param db: 数据库会话
136- :param pk: 字典数据 ID
135+ :param type_ids: 字典类型 ID 列表
137136 :return:
138137 """
139- return await self .select_model (db , pk , load_strategies = [ 'type' ] )
138+ return await self .delete_model_by_column (db , allow_multiple = True , type_id__in = type_ids )
140139
141140
142141dict_data_dao : CRUDDictData = CRUDDictData (DictData )
0 commit comments