feat: 调整事由相关接口

This commit is contained in:
2024-11-26 20:27:46 +08:00
parent 4b01a567d4
commit 6ace9f4ba6
2 changed files with 24 additions and 9 deletions

View File

@@ -79,6 +79,8 @@ public class MyPostgreSQLDialect extends PostgreSQLDialect {
functionContributions.getFunctionRegistry().registerPattern(
"anyString", "any(?1)", stringType);
functionContributions.getFunctionRegistry().registerPattern("pg_array_length", "array_length(?1, 1)", functionContributions.getTypeConfiguration()
.getBasicTypeRegistry().resolve(StandardBasicTypes.INTEGER));
}

View File

@@ -1,14 +1,12 @@
package cn.lihongjie.coal.warehouseReceipt.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.lihongjie.coal.base.dto.CommonQuery;
import cn.lihongjie.coal.base.dto.IdRequest;
import cn.lihongjie.coal.base.service.BaseService;
import cn.lihongjie.coal.common.Ctx;
import cn.lihongjie.coal.common.FreeMakerUtils;
import cn.lihongjie.coal.common.JpaUtils;
import cn.lihongjie.coal.common.NumberUtils;
import cn.lihongjie.coal.common.*;
import cn.lihongjie.coal.exception.BizException;
import cn.lihongjie.coal.orderNoRule.dto.GenOrderNoRequest;
import cn.lihongjie.coal.orderNoRule.service.OrderNoRuleService;
@@ -312,7 +310,6 @@ public class WarehouseReceiptService
Map map = (Map) content.get(0);
return NumberUtil.parseInt(map.get("currNumber").toString());
}
private void handleType3Create(WarehouseReceiptEntity entity) {
@@ -510,9 +507,25 @@ public class WarehouseReceiptService
}
public Page<WarehouseReceiptDto> list(CommonQuery query) {
Specification specification = query.specification(conversionService);
if (MapUtil.getBool(query.getExtras(), "excludeEmptyFileIds", false)) {
specification =
specification.and(
(root, criteriaQuery, criteriaBuilder) -> {
return criteriaBuilder.greaterThan(
criteriaBuilder.function(
"pg_array_length",
Integer.class,
root.get("fileIds")),
0);
});
}
Page<WarehouseReceiptEntity> page =
repository.findAll(
query.specification(conversionService),
specification,
PageRequest.of(
query.getPageNo(),
query.getPageSize(),
@@ -576,7 +589,7 @@ public class WarehouseReceiptService
with bq as (select distinct on ( gs.id, w.id
<#if shelveSummary>
, d.shelve_id
</#if>
@@ -624,7 +637,7 @@ public class WarehouseReceiptService
w.code as warehouse_code,
gc.code as category_code,
gc.name as category_name,
<#if shelveSummary>
ws.id as shelve_id,
ws.name as shelve_name,
@@ -670,7 +683,7 @@ public class WarehouseReceiptService
left join t_warehouse_goods_unit gu on gs.unit_id = gu.id
left join t_warehouse_goods_brand gb on gs.brand_id = gb.id
left join t_warehouse_goods_category gc on gs.category_id = gc.id
<#if shelveSummary>
left join t_warehouse_shelve ws on d.shelve_id = ws.id
</#if>