按日期查询报错;

This commit is contained in:
王奎兴
2026-06-03 09:42:27 +08:00
parent 32dde06899
commit 08ac9b2eba
5 changed files with 17 additions and 5 deletions
@@ -270,11 +270,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="boxPalletNo != null and boxPalletNo != ''"> <if test="boxPalletNo != null and boxPalletNo != ''">
and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%') and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%')
</if> </if>
<if test="expiryDate != null and expiryDate != ''"> <if test="expiryDateStr != null and expiryDateStr != ''">
AND TO_CHAR(a.expiry_date, 'yyyy-MM-dd') = #{expiryDate} AND TO_CHAR(a.expiry_date, 'yyyy-MM-dd') = #{expiryDateStr}
</if> </if>
<if test="productionDate != null and productionDate != ''"> <if test="productionDateStr != null and productionDateStr != ''">
AND TO_CHAR(a.production_date, 'yyyy-MM-dd') = #{productionDate} AND TO_CHAR(a.production_date, 'yyyy-MM-dd') = #{productionDateStr}
</if> </if>
</sql> </sql>
@@ -247,4 +247,6 @@ public class MaterialInventoryDO extends MaterialBaseDO {
/** 为 true 时 SQL 排除库存数量为 0(含 null 视为 0) */ /** 为 true 时 SQL 排除库存数量为 0(含 null 视为 0) */
private Boolean excludeZeroInventoryQuantity; private Boolean excludeZeroInventoryQuantity;
private String expiryDateStr;
private String productionDateStr;
} }
@@ -188,5 +188,7 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
/** 为 true 时排除库存数量为 0 的行(出库分配选库存用);库存查询页不传或 false */ /** 为 true 时排除库存数量为 0 的行(出库分配选库存用);库存查询页不传或 false */
@ApiModelProperty(value = "是否排除库存数量为0", example = "false") @ApiModelProperty(value = "是否排除库存数量为0", example = "false")
private Boolean excludeZeroInventoryQuantity; private Boolean excludeZeroInventoryQuantity;
private String expiryDate;
private String productionDate;
} }
@@ -81,6 +81,8 @@ public class MaterialInventoryApi extends BaseController {
//转换实体 //转换实体
MaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO); MaterialInventoryDO materialInventoryDO = materialInventoryAssembler.toDO(materialInventoryDTO);
materialInventoryDO.setExpiryDateStr(materialInventoryDTO.getExpiryDate());
materialInventoryDO.setProductionDateStr(materialInventoryDTO.getProductionDate());
startPage(); startPage();
// 使用带批次属性的查询方法,批次属性值从库存表中获取 // 使用带批次属性的查询方法,批次属性值从库存表中获取
List<MaterialInventoryPO> list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO); List<MaterialInventoryPO> list = materialInventoryApplicationService.queryListWithBatchAttributes(materialInventoryDO);
@@ -220,4 +222,4 @@ public class MaterialInventoryApi extends BaseController {
return AjaxResult.success(materialInventoryApplicationService.sumInventoryQuantity(materialInventoryDO)); return AjaxResult.success(materialInventoryApplicationService.sumInventoryQuantity(materialInventoryDO));
} }
} }
@@ -232,6 +232,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="boxPalletNo != null and boxPalletNo != ''"> <if test="boxPalletNo != null and boxPalletNo != ''">
and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%') and a.BOX_PALLET_NO like concat('%', #{boxPalletNo}, '%')
</if> </if>
<if test="expiryDateStr != null and expiryDateStr != ''">
AND TO_CHAR(b.expiry_date, 'yyyy-MM-dd') = #{expiryDateStr}
</if>
<if test="productionDateStr != null and productionDateStr != ''">
AND TO_CHAR(b.production_date, 'yyyy-MM-dd') = #{productionDateStr}
</if>
</sql> </sql>
<!-- 与 selectMaterialInventoryPo1 相同条件,表别名为 mi(用于 queryListByWl 最新明细子查询) --> <!-- 与 selectMaterialInventoryPo1 相同条件,表别名为 mi(用于 queryListByWl 最新明细子查询) -->