解决数组越界

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))); list.add(cb.isNull(getExpression(attributeName,join,root)));
break; break;
case BETWEEN: case BETWEEN:
List<Object> between = new ArrayList<>((List<Object>)val); if (val instanceof List) {
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()), List<?> betweenList = (List<?>) val;
(Comparable) between.get(0), (Comparable) between.get(1))); // 确保列表不为空且包含两个元素
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; break;
default: break; default: break;
} }

View File

@@ -62,7 +62,6 @@ public class TbProductStockDetailController {
@PostMapping("/stock") @PostMapping("/stock")
@Log("查询/product/Stock") @Log("查询/product/Stock")
@ApiOperation("查询/product/Stock") @ApiOperation("查询/product/Stock")
// @PreAuthorize("@el.check('tbProductStockDetail:list')")
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){ public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK); 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())); tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap()));
} }
BeanUtils.copyProperties(tbProduct, tbProductVo); BeanUtils.copyProperties(tbProduct, tbProductVo);
tbProductVo.setImages(ListUtil.stringChangeStringList(tbProduct.getImages()));
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();