ÎļþÃû´Ó Source/UBCS/ubcs-service-api/ubcs-omd-api/src/main/java/com/vci/ubcs/omd/cache/OmdBtmTypeCache.java ÐÞ¸Ä |
| | |
| | | package com.vci.ubcs.omd.cache; |
| | | |
| | | import com.vci.ubcs.omd.feign.IOmdBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.OmdBtmTypeVO; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | * @author LiHang |
| | | * @date 2023/4/24 |
| | | */ |
| | | public class OmdBtmTypeCache { |
| | | public class BtmTypeCache { |
| | | |
| | | private static final String BTM_DETAIL = "btm:id"; |
| | | |
| | |
| | | |
| | | private static final String BTM_IDS = "btm:ids"; |
| | | |
| | | private static IOmdBtmTypeClient btmTypeClient; |
| | | private static IBtmTypeClient btmTypeClient; |
| | | |
| | | private static IOmdBtmTypeClient getBtmTypeClient() { |
| | | private static IBtmTypeClient getBtmTypeClient() { |
| | | if (btmTypeClient == null) { |
| | | btmTypeClient = SpringUtil.getBean(IOmdBtmTypeClient.class); |
| | | btmTypeClient = SpringUtil.getBean(IBtmTypeClient.class); |
| | | } |
| | | return btmTypeClient; |
| | | } |
| | |
| | | * @param oid ä¸»é® |
| | | * @return ä¸å¡ç±»å详æ
ä¿¡æ¯ |
| | | */ |
| | | public static OmdBtmTypeVO getDetail(String oid){ |
| | | public static BtmTypeVO getDetail(String oid){ |
| | | String keyPrefix = BTM_DETAIL.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(BTM_TYPE_CACHE, keyPrefix, oid, () -> { |
| | | R<OmdBtmTypeVO> result = getBtmTypeClient().getDetail(oid); |
| | | R<BtmTypeVO> result = getBtmTypeClient().getDetail(oid); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | |
| | | * @param ids å¯¹è±¡è±æåç§° 使¯ä¸è½è¶
è¿1000 |
| | | * @return ä¸å¡å¯¹è±¡ |
| | | */ |
| | | public static List<OmdBtmTypeVO> selectByIdCollection(List<String> ids) { |
| | | public static List<BtmTypeVO> selectByIdCollection(List<String> ids) { |
| | | String keyPrefix = BTM_IDS.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(BTM_TYPE_CACHE,keyPrefix,Func.toStr(ids), () -> { |
| | | R<List<OmdBtmTypeVO>> result = getBtmTypeClient().selectByIdCollection(ids); |
| | | R<List<BtmTypeVO>> result = getBtmTypeClient().selectByIdCollection(ids); |
| | | return result.getData(); |
| | | }); |
| | | } |
| | |
| | | * @param pkBtmTypeCollection ä¸å¡ç±»å主é®éå |
| | | * @return ä¸å¡ç±»åå表ï¼å¦ææä¸åå¨çä¸ä¼è¿åï¼å
¨é¨ä¸åå¨çåè¿å空å表 |
| | | */ |
| | | public static List<OmdBtmTypeVO> listBtmTypeByOidCollection(Collection<String> pkBtmTypeCollection) { |
| | | public static List<BtmTypeVO> listBtmTypeByOidCollection(Collection<String> pkBtmTypeCollection) { |
| | | String keyPrefix = BTM_IDS.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(BTM_TYPE_CACHE,keyPrefix,Func.toStr(pkBtmTypeCollection.stream().map(s -> s.substring(0,5))),() ->{ |
| | | R<List<OmdBtmTypeVO>> result = getBtmTypeClient().listBtmTypeByOidCollection(pkBtmTypeCollection); |
| | | R<List<BtmTypeVO>> result = getBtmTypeClient().listBtmTypeByOidCollection(pkBtmTypeCollection); |
| | | return result.getData(); |
| | | }); |
| | | } |