|
@@ -25,6 +25,21 @@ public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenova
|
|
private String region = "PartsAttachingEntity";
|
|
private String region = "PartsAttachingEntity";
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public RenovationPartsAttachingEntity findById(Long id) {
|
|
|
|
+ RenovationPartsAttachingEntity entity = null;
|
|
|
|
+ if (cacheChannel.exists(region, "id::" + id)) {
|
|
|
|
+ CacheObject cache = cacheChannel.get(region, "id::" + id);
|
|
|
|
+ entity = BeanUtil.toBean(cache.getValue(), RenovationPartsAttachingEntity.class);
|
|
|
|
+ } else {
|
|
|
|
+ entity = super.findById(id);
|
|
|
|
+ if (ObjectUtil.isNotNull(entity)) {
|
|
|
|
+ cacheChannel.set(region, "id::" + entity.getId(), entity, 60 * 30);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public ResponseRenovationPartsAttaching findAttachinByDetailId(Long id) {
|
|
public ResponseRenovationPartsAttaching findAttachinByDetailId(Long id) {
|
|
ResponseRenovationPartsAttaching entity = null;
|
|
ResponseRenovationPartsAttaching entity = null;
|
|
if (cacheChannel.exists(region, "responseId::" + id)) {
|
|
if (cacheChannel.exists(region, "responseId::" + id)) {
|
|
@@ -33,7 +48,7 @@ public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenova
|
|
} else {
|
|
} else {
|
|
entity = getBaseMapper().findAttachinByDetailId(id);
|
|
entity = getBaseMapper().findAttachinByDetailId(id);
|
|
if (ObjectUtil.isNotNull(entity)) {
|
|
if (ObjectUtil.isNotNull(entity)) {
|
|
- cacheChannel.set(region, "responseId::" + entity.getId(), entity, 60 * 30);
|
|
|
|
|
|
+ cacheChannel.set(region, "responseId::" + id, entity, 60 * 30);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return entity;
|
|
return entity;
|
|
@@ -48,7 +63,7 @@ public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenova
|
|
} else {
|
|
} else {
|
|
entity = getBaseMapper().findByDetailId(id);
|
|
entity = getBaseMapper().findByDetailId(id);
|
|
if (ObjectUtil.isNotNull(entity)) {
|
|
if (ObjectUtil.isNotNull(entity)) {
|
|
- cacheChannel.set(region, "detailId::" + entity.getId(), entity, 60 * 30);
|
|
|
|
|
|
+ cacheChannel.set(region, "detailId::" + id, entity, 60 * 30);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return entity;
|
|
return entity;
|
|
@@ -58,17 +73,21 @@ public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenova
|
|
public boolean updateById(RenovationPartsAttachingEntity entity) {
|
|
public boolean updateById(RenovationPartsAttachingEntity entity) {
|
|
boolean updateById = super.updateById(entity);
|
|
boolean updateById = super.updateById(entity);
|
|
if (updateById) {
|
|
if (updateById) {
|
|
- cacheChannel.set(region, "detailId::" + entity.getId(), entity, 60 * 30);
|
|
|
|
|
|
+ cacheChannel.evict(region, "responseId::" + entity.getPartsDetailId());
|
|
|
|
+ cacheChannel.set(region, "detailId::" + entity.getPartsDetailId(), entity, 60 * 30);
|
|
|
|
+ cacheChannel.set(region, "id::" + entity.getId(), entity, 60 * 30);
|
|
}
|
|
}
|
|
return updateById;
|
|
return updateById;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean removeById(Long id) {
|
|
public boolean removeById(Long id) {
|
|
|
|
+ RenovationPartsAttachingEntity entity = super.findById(id);
|
|
boolean removeById = super.removeById(id);
|
|
boolean removeById = super.removeById(id);
|
|
- if (removeById) {
|
|
|
|
- cacheChannel.evict(region, "responseId::" + id);
|
|
|
|
- cacheChannel.evict(region, "detailId::" + id);
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(entity) && removeById) {
|
|
|
|
+ cacheChannel.evict(region, "responseId::" + entity.getPartsDetailId());
|
|
|
|
+ cacheChannel.evict(region, "detailId::" + entity.getPartsDetailId());
|
|
|
|
+ cacheChannel.evict(region, "id::" + entity.getPartsDetailId());
|
|
}
|
|
}
|
|
return removeById;
|
|
return removeById;
|
|
}
|
|
}
|