店铺信息getById加入缓存
This commit is contained in:
@@ -19,9 +19,13 @@ import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -32,6 +36,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@DubboService
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "shopInfo")
|
||||
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
@@ -44,6 +49,12 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
@Resource
|
||||
private ShopExtendService shopExtendService;
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "#id")
|
||||
public ShopInfo getById(Serializable id) {
|
||||
return super.getById(id);
|
||||
}
|
||||
|
||||
private ShopInfo getShopInfo(Long shopId) {
|
||||
ShopInfo shopInfo = getById(shopId);
|
||||
if (shopInfo == null) {
|
||||
@@ -112,6 +123,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(key = "#shopInfoEditDTO.id")
|
||||
public Boolean edit(ShopInfoEditDTO shopInfoEditDTO) {
|
||||
ShopInfo shopInfo;
|
||||
if (!StpKit.USER.isAdmin()) {
|
||||
|
||||
Reference in New Issue
Block a user