| | |
| | | import { BasicdataSiteEntity } from '../../entity/site'; |
| | | import { BasicdataSiteService } from '../../service/site'; |
| | | import { BaseSysDepartmentEntity } from '../../../base/entity/sys/department'; |
| | | import { WithDeptFilterWhere } from '../../../base/middleware/with-dept-filter-where' |
| | | |
| | | /** |
| | | * 站点信息后台管理 |
| | | */ |
| | | @CoolController({ |
| | | api: ['add', 'delete', 'update', 'info', 'list', 'page'], |
| | | entity: BasicdataSiteEntity, |
| | | service: BasicdataSiteService, |
| | | pageQueryOp: { |
| | | keyWordLikeFields: ['a.name', 'a.address', 'a.leader'], |
| | | fieldEq: ['a.departmentId', 'a.siteType', 'a.status'], |
| | | // ✅ page 方法已在 Service 中重写,这里配置仅作兜底 |
| | | select: ['a.*', 'b.name AS departmentName'], |
| | | join: [ |
| | | { |
| | |
| | | type: 'leftJoin', |
| | | }, |
| | | ], |
| | | where: async ctx => { |
| | | const conditions: any[][] = []; |
| | | conditions.push(...(await WithDeptFilterWhere(ctx, { alias: 'a', field: 'departmentId' }))); |
| | | |
| | | // 其他关联表(举例) |
| | | // conditions.push(...(await deptFilterWhere(ctx, 'd', 'id'))); |
| | | |
| | | return conditions; |
| | | }, |
| | | }, |
| | | }) |
| | | export class AdminBasicdataSiteController extends BaseController { } |
| | | export class AdminBasicdataSiteController extends BaseController {} |