手术管理->优化字典数据获取逻辑

This commit is contained in:
2026-01-07 22:56:48 +08:00
parent 240d5dc3f7
commit 38ef377cbd
2 changed files with 11 additions and 6 deletions

View File

@@ -120,7 +120,7 @@
<if test="listClass != null">list_class = #{listClass},</if> <if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if> <if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="pyStr !=null">pyStr = #{pyStr},</if> <if test="pyStr !=null">py_str = #{pyStr},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = now() update_time = now()

View File

@@ -128,16 +128,21 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
@Override @Override
public R<SurgeryDto> getSurgeryDetail(Long id) { public R<SurgeryDto> getSurgeryDetail(Long id) {
String cacheKey = RedisKeys.getSurgeryKey(id); String cacheKey = RedisKeys.getSurgeryKey(id);
SurgeryDto surgeryDto = redisCache.getCacheObject(cacheKey); Object cachedObject = redisCache.getCacheObject(cacheKey);
// 先从Redis缓存中获取 // 先从Redis缓存中获取
if (surgeryDto != null) { if (cachedObject != null) {
log.info("从Redis缓存中获取手术信息 - surgeryId: {}", id); if (cachedObject instanceof SurgeryDto) {
return R.ok(surgeryDto); SurgeryDto surgeryDto = (SurgeryDto) cachedObject;
log.info("从Redis缓存中获取手术信息 - surgeryId: {}", id);
return R.ok(surgeryDto);
} else {
log.warn("Redis缓存中手术信息类型不匹配 - surgeryId: {}", id);
}
} }
// 缓存中没有,从数据库查询 // 缓存中没有,从数据库查询
surgeryDto = surgeryAppMapper.getSurgeryDetail(id); SurgeryDto surgeryDto = surgeryAppMapper.getSurgeryDetail(id);
if (surgeryDto == null) { if (surgeryDto == null) {
return R.fail("手术信息不存在"); return R.fail("手术信息不存在");
} }