You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					54 lines
				
				2.0 KiB
			
		
		
			
		
	
	
					54 lines
				
				2.0 KiB
			| 
											8 months ago
										 | from typing import List | ||
|  | 
 | ||
|  | from sqlalchemy import desc, delete, func, select, update | ||
|  | from sqlalchemy.ext.asyncio import AsyncSession | ||
|  | from module_admin.entity.vo.user_vo import CurrentUserModel | ||
|  | from module_admin.entity.vo.dataint_vo import CdplbPageObject | ||
|  | from module_admin.entity.do.dataint_do import SysCdplb | ||
|  | from sqlalchemy import select, text, cast, Integer, and_, or_, outerjoin, func, join | ||
|  | from utils.page_util import PageUtil | ||
|  | 
 | ||
|  | 
 | ||
|  | class CdplbDao: | ||
|  |     """
 | ||
|  |     菜单管理模块数据库操作层 | ||
|  |     """
 | ||
|  | 
 | ||
|  |     @classmethod | ||
|  |     async def get_cdplb_list(cls, db: AsyncSession, cdplb_query: CdplbPageObject): | ||
|  |         query = ( | ||
|  |             select(SysCdplb).where( | ||
|  |                 SysCdplb.bath_obj_tabName == cdplb_query.bath_obj_tabName if cdplb_query.bath_obj_tabName else True, | ||
|  |                 SysCdplb.bath_obj_fldName == cdplb_query.bath_obj_fldName if cdplb_query.bath_obj_fldName else True, | ||
|  |                 SysCdplb.pos_name == cdplb_query.pos_name if cdplb_query.pos_name else True, | ||
|  |                 SysCdplb.status == cdplb_query.status if cdplb_query.status else True | ||
|  |             ).distinct() | ||
|  |         ) | ||
|  |         query_result = await PageUtil.paginate(db, query, cdplb_query.page_num, cdplb_query.page_size, True) | ||
|  |         return query_result | ||
|  | 
 | ||
|  |     @classmethod | ||
|  |     async def insert_cdplb(cls, db: AsyncSession, sysCdplb: SysCdplb): | ||
|  |         db.add(sysCdplb) | ||
|  |         await db.flush() | ||
|  |         return sysCdplb | ||
|  | 
 | ||
|  |     @classmethod | ||
|  |     async def get_cdplb_by_id(cls, db: AsyncSession, onum: str): | ||
|  |         result = ( | ||
|  |             ( | ||
|  |                 await db.execute( | ||
|  |                     select(SysCdplb).where(SysCdplb.onum == onum).distinct() | ||
|  |                 ) | ||
|  |             ).scalars().first() | ||
|  |         ) | ||
|  |         return result | ||
|  | 
 | ||
|  |     @classmethod | ||
|  |     async def update_cdplb(cls, db: AsyncSession, saveObj: dict): | ||
|  |         await db.execute(update(SysCdplb), [saveObj]) | ||
|  | 
 | ||
|  |     @classmethod | ||
|  |     async def delete_cdplb(cls, db: AsyncSession, array: List[str]): | ||
|  |         await db.execute(delete(SysCdplb).where(SysCdplb.onum.in_(array))) |