|
@@ -1,10 +1,12 @@
|
|
|
package com.fdkk.sxz.webApi.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.fdkk.sxz.base.impl.BaseServiceImpl;
|
|
|
import com.fdkk.sxz.entity.RenovationPartsAttachingEntity;
|
|
|
+import com.fdkk.sxz.vo.response.ResponseRenovationPartsAttaching;
|
|
|
import com.fdkk.sxz.webApi.mapper.IRenovationPartsAttachingMapper;
|
|
|
import com.fdkk.sxz.webApi.service.IRenovationPartsAttachingService;
|
|
|
-import com.fdkk.sxz.vo.response.ResponseRenovationPartsAttaching;
|
|
|
+import net.oschina.j2cache.CacheChannel;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -14,19 +16,47 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
*/
|
|
|
@Service
|
|
|
@Transactional
|
|
|
-public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenovationPartsAttachingMapper , RenovationPartsAttachingEntity> implements IRenovationPartsAttachingService {
|
|
|
+public class RenovationPartsAttachingServiceImpl extends BaseServiceImpl<IRenovationPartsAttachingMapper, RenovationPartsAttachingEntity> implements IRenovationPartsAttachingService {
|
|
|
|
|
|
@Autowired
|
|
|
private IRenovationPartsAttachingMapper mapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CacheChannel cacheChannel;
|
|
|
|
|
|
@Override
|
|
|
public ResponseRenovationPartsAttaching findAttachinByDetailId(Long id) {
|
|
|
- return mapper.findAttachinByDetailId(id);
|
|
|
+ ResponseRenovationPartsAttaching entity = mapper.findAttachinByDetailId(id);
|
|
|
+ if (ObjectUtil.isNotNull(entity)) {
|
|
|
+ cacheChannel.set("PartsAttachingResponse", "id::" + entity.getId(), entity, 60 * 30);
|
|
|
+ }
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public RenovationPartsAttachingEntity findByDetailId(Long id) {
|
|
|
- return mapper.findByDetailId(id);
|
|
|
+ RenovationPartsAttachingEntity entity = mapper.findByDetailId(id);
|
|
|
+ if (ObjectUtil.isNotNull(id)) {
|
|
|
+ cacheChannel.set("PartsAttachingEntity", "id::" + entity.getId(), entity, 60 * 30);
|
|
|
+ }
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean updateById(RenovationPartsAttachingEntity entity) {
|
|
|
+ boolean updateById = super.updateById(entity);
|
|
|
+ if (updateById) {
|
|
|
+ cacheChannel.set("PartsAttachingEntity", "id::" + entity.getId(), entity, 60 * 30);
|
|
|
+ }
|
|
|
+ return updateById;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean removeById(Long id) {
|
|
|
+ boolean removeById = super.removeById(id);
|
|
|
+ if (removeById) {
|
|
|
+ cacheChannel.evict("PartsAttachingResponse", "id::" + id);
|
|
|
+ cacheChannel.evict("PartsAttachingEntity", "id::" + id);
|
|
|
+ }
|
|
|
+ return removeById;
|
|
|
}
|
|
|
}
|