|
|
@@ -979,8 +979,8 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
|
|
|
// 构建查询条件
|
|
|
const whereConditions = { personId };
|
|
|
|
|
|
- // 月份过滤
|
|
|
- const dateFilter = month ? `DATE_FORMAT(op.joinDate, '%Y-%m') = '${month}'` : '';
|
|
|
+ // 月份过滤 - PostgreSQL使用TO_CHAR函数
|
|
|
+ const dateFilter = month ? `TO_CHAR(op.joinDate, 'YYYY-MM') = :month` : '';
|
|
|
|
|
|
// 先获取总数
|
|
|
const countQueryBuilder = this.orderPersonRepository
|
|
|
@@ -988,8 +988,7 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
|
|
|
.where('op.personId = :personId', { personId });
|
|
|
|
|
|
if (month) {
|
|
|
- countQueryBuilder.andWhere('DATE_FORMAT(op.joinDate, :format) = :month', {
|
|
|
- format: '%Y-%m',
|
|
|
+ countQueryBuilder.andWhere("TO_CHAR(op.joinDate, 'YYYY-MM') = :month", {
|
|
|
month
|
|
|
});
|
|
|
}
|
|
|
@@ -1002,8 +1001,7 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
|
|
|
.where('op.personId = :personId', { personId });
|
|
|
|
|
|
if (month) {
|
|
|
- dataQueryBuilder.andWhere('DATE_FORMAT(op.joinDate, :format) = :month', {
|
|
|
- format: '%Y-%m',
|
|
|
+ dataQueryBuilder.andWhere("TO_CHAR(op.joinDate, 'YYYY-MM') = :month", {
|
|
|
month
|
|
|
});
|
|
|
}
|
|
|
@@ -1113,10 +1111,9 @@ export class OrderService extends GenericCrudService<EmploymentOrder> {
|
|
|
queryBuilder.andWhere('asset.assetType = :assetType', { assetType });
|
|
|
}
|
|
|
|
|
|
- // 月份过滤 - relatedTime是timestamp类型
|
|
|
+ // 月份过滤 - relatedTime是timestamp类型,PostgreSQL使用TO_CHAR函数
|
|
|
if (month) {
|
|
|
- queryBuilder.andWhere('DATE_FORMAT(asset.relatedTime, :format) = :month', {
|
|
|
- format: '%Y-%m',
|
|
|
+ queryBuilder.andWhere("TO_CHAR(asset.relatedTime, 'YYYY-MM') = :month", {
|
|
|
month
|
|
|
});
|
|
|
}
|