(session: SessionDep, trans: Trans, variable: SystemVariable)
| 36 | |
| 37 | |
| 38 | def list_all(session: SessionDep, trans: Trans, variable: SystemVariable): |
| 39 | if variable.name is None: |
| 40 | records = session.query(SystemVariable).order_by(SystemVariable.type.desc(), |
| 41 | SystemVariable.name.asc()).all() |
| 42 | else: |
| 43 | records = session.query(SystemVariable).filter( |
| 44 | and_(SystemVariable.name.ilike(f'%{variable.name}%'), SystemVariable.type != 'system')).order_by( |
| 45 | SystemVariable.type.desc(), SystemVariable.name.asc()).all() |
| 46 | |
| 47 | res = [] |
| 48 | for r in records: |
| 49 | data = SystemVariable(**r.__dict__) |
| 50 | if data.type == 'system': |
| 51 | data.name = trans(data.name) |
| 52 | res.append(data) |
| 53 | return res |
| 54 | |
| 55 | |
| 56 | async def list_page(session: SessionDep, trans: Trans, pageNum: int, pageSize: int, variable: SystemVariable): |
no test coverage detected