-
获取Entity并进行更新
EhrIndexInfoChangeRecord ehrIndexInfoChangeRecord = baseMapper.selectOne( new LambdaQueryWrapper<EhrIndexInfoChangeRecord>(). eq(EhrIndexInfoChangeRecord::getArchivesId, archieveId). eq(EhrIndexInfoChangeRecord::getIndexCode, indexCode). orderByDesc(EhrIndexInfoChangeRecord::getIndexTime).last("limit 1")); ehrIndexInfoChangeRecord.setIndexVal(value); baseMapper.updateById(ehrIndexInfoChangeRecord);
-
如果是这样则会更新所有符合条件的查询,感觉很危险
EhrIndexInfoChangeRecord ehrIndexInfoChangeRecord = new EhrIndexInfoChangeRecord(); ehrIndexInfoChangeRecord.setIndexVal(value); baseMapper.update(ehrIndexInfoChangeRecord, new LambdaQueryWrapper<EhrIndexInfoChangeRecord>().eq( EhrIndexInfoChangeRecord::getArchivesId, archieveId).eq(EhrIndexInfoChangeRecord::getIndexCode, indexCode));