解决数组越界

This commit is contained in:
liuyingfang
2024-03-05 19:54:58 +08:00
parent 2477e2171e
commit cfbabc1fb3
3 changed files with 13 additions and 4 deletions

View File

@@ -160,9 +160,18 @@ public class QueryHelp {
list.add(cb.isNull(getExpression(attributeName,join,root)));
break;
case BETWEEN:
List<Object> between = new ArrayList<>((List<Object>)val);
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
(Comparable) between.get(0), (Comparable) between.get(1)));
if (val instanceof List) {
List<?> betweenList = (List<?>) val;
// 确保列表不为空且包含两个元素
if (betweenList.size() == 2) {
// 进行类型转换并执行 BETWEEN 查询
List<Object> between = new ArrayList<>(betweenList);
list.add(cb.between(
getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
(Comparable) between.get(0),
(Comparable) between.get(1)));
}
}
break;
default: break;
}

View File

@@ -62,7 +62,6 @@ public class TbProductStockDetailController {
@PostMapping("/stock")
@Log("查询/product/Stock")
@ApiOperation("查询/product/Stock")
// @PreAuthorize("@el.check('tbProductStockDetail:list')")
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK);
}

View File

@@ -176,6 +176,7 @@ public class TbProductServiceImpl implements TbProductService {
tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap()));
}
BeanUtils.copyProperties(tbProduct, tbProductVo);
tbProductVo.setImages(ListUtil.stringChangeStringList(tbProduct.getImages()));
HashMap<String, String> map = new HashMap<>();