fix:修复字典切面响应单个空对象没有判空;物料实例加检索条件。
This commit is contained in:
@@ -407,6 +407,11 @@ public class DictAspect {
|
||||
*/
|
||||
private Boolean checkHasDict(List<Object> records){
|
||||
if(LegendConvertUtils.isNotEmpty(records) && records.size()>0){
|
||||
// 添加对第一个元素的空值检查
|
||||
Object firstRecord = records.get(0);
|
||||
if (firstRecord == null) {
|
||||
return false;
|
||||
}
|
||||
for (Field field : LegendConvertUtils.getAllFields(records.get(0))) {
|
||||
if (LegendConvertUtils.isNotEmpty(field.getAnnotation(Dict.class))) {
|
||||
return true;
|
||||
|
||||
@@ -604,6 +604,10 @@ public class LegendConvertUtils {
|
||||
* @return
|
||||
*/
|
||||
public static Field[] getAllFields(Object object) {
|
||||
// 添加空值检查
|
||||
if (object == null) {
|
||||
return new Field[0];
|
||||
}
|
||||
Class<?> clazz = object.getClass();
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
while (clazz != null) {
|
||||
|
||||
@@ -121,14 +121,17 @@ public class MaterialInfomationRespVO {
|
||||
|
||||
@Schema(description = "是否危险品,1-是,0-否")
|
||||
@ExcelProperty("是否危险品,1-是,0-否")
|
||||
@Dict(dicCode = "yes_or_no")
|
||||
private Integer hazardous;
|
||||
|
||||
@Schema(description = "是否标准溶液,1-是,0-否")
|
||||
@ExcelProperty("是否标准溶液,1-是,0-否")
|
||||
@Dict(dicCode = "yes_or_no")
|
||||
private Integer standardSolutionFlag;
|
||||
|
||||
@Schema(description = "是否标准物质,1-是,0-否")
|
||||
@ExcelProperty("是否标准物质,1-是,0-否")
|
||||
@Dict(dicCode = "yes_or_no")
|
||||
private Integer standardMaterialFlag;
|
||||
|
||||
@Schema(description = "配置人")
|
||||
|
||||
@@ -106,7 +106,10 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
||||
MPJLambdaWrapper<MaterialInfomationDO> wrapper = getInfomationDOMPJLambdaWrapper();
|
||||
wrapper.eqIfExists(MaterialInfomationDO::getCode, queryVO.getCode())
|
||||
.eqIfExists(MaterialInfomationDO::getUsageStatus, queryVO.getUsageStatus())
|
||||
.eqIfExists(MaterialInfomationDO::getUseEndFlag, queryVO.getUseEndFlag());
|
||||
.eqIfExists(MaterialInfomationDO::getUseEndFlag, queryVO.getUseEndFlag())
|
||||
.eqIfExists(MaterialProductDO::getHazardous, queryVO.getHazardous())
|
||||
.eqIfExists(MaterialProductDO::getStandardMaterialFlag, queryVO.getStandardMaterialFlag())
|
||||
.eqIfExists(MaterialProductDO::getStandardSolutionFlag, queryVO.getStandardSolutionFlag());
|
||||
return selectJoinOne(MaterialInfomationRespVO.class, wrapper);
|
||||
}
|
||||
|
||||
@@ -132,7 +135,7 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
||||
.selectAs("batch.BAT_NO", MaterialInfomationRespVO::getBatchNo)
|
||||
.selectAs("gongduan.ASN_DEPT_NAME", MaterialInfomationRespVO::getAssignDepartmentName)
|
||||
.selectAs(ConfigWarehouseLocationDO::getCode, MaterialInfomationRespVO::getLocationCode)
|
||||
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||
.innerJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialInfomationDO::getBatchId)
|
||||
.leftJoin(MaterialBatchDO.class, "gongduan", MaterialBatchDO::getId, MaterialInfomationDO::getGongduanId)
|
||||
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
|
||||
|
||||
Reference in New Issue
Block a user