LambdaQueryWrapper

LambdaQueryWrapper

解决拼接条件表达式时候,数据库字段名写错导致异常的问题

代码范例

LambdaQueryWrapper<AlarmRuleNew> alarmRuleNewLambdaQueryWrapper = new LambdaQueryWrapper<AlarmRuleNew>();
// 写表达式时,直接用::形式获取对应的字段名
alarmRuleNewLambdaQueryWrapper.eq(AlarmRuleNew::getRuleKey,"3"); 
List<AlarmRuleNew> list = daoContext.getAlarmRuleNewDaoService().list(alarmRuleNewLambdaQueryWrapper);
posted @ 2023-01-27 15:24  SpecialSpeculator  阅读(251)  评论(0编辑  收藏  举报