手术管理->优化字典数据获取逻辑
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
<if test="listClass != null">list_class = #{listClass},</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</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="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = now()
|
||||
|
||||
@@ -128,16 +128,21 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
@Override
|
||||
public R<SurgeryDto> getSurgeryDetail(Long id) {
|
||||
String cacheKey = RedisKeys.getSurgeryKey(id);
|
||||
SurgeryDto surgeryDto = redisCache.getCacheObject(cacheKey);
|
||||
Object cachedObject = redisCache.getCacheObject(cacheKey);
|
||||
|
||||
// 先从Redis缓存中获取
|
||||
if (surgeryDto != null) {
|
||||
log.info("从Redis缓存中获取手术信息 - surgeryId: {}", id);
|
||||
return R.ok(surgeryDto);
|
||||
if (cachedObject != null) {
|
||||
if (cachedObject instanceof 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) {
|
||||
return R.fail("手术信息不存在");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user