//查询问卷主表的问卷类型 ContOptWelfareEntity contOptWelfareEntity = contOptWelfareMapper.selectOne( new LambdaQueryWrapper<ContOptWelfareEntity>() .select(ContOptWelfareEntity::getType) .eq(ContOptWelfareEntity::getWelfareNo, welfareNo) );空指针异常
时间: 2024-02-14 17:11:57 浏览: 100
空指针异常
这段代码可能会抛出空指针异常的原因可能是`contOptWelfareMapper.selectOne`方法返回了`null`,导致后续对`contOptWelfareEntity`对象进行操作时出现了`NullPointerException`。可以加上对`contOptWelfareEntity`对象是否为`null`的判断,例如:
```
ContOptWelfareEntity contOptWelfareEntity = contOptWelfareMapper.selectOne(
new LambdaQueryWrapper<ContOptWelfareEntity>()
.select(ContOptWelfareEntity::getType)
.eq(ContOptWelfareEntity::getWelfareNo, welfareNo)
);
if (contOptWelfareEntity != null) {
// 对contOptWelfareEntity进行操作
} else {
// 处理contOptWelfareEntity为null的情况
}
```
阅读全文