| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @Service |
| | | public class HttpApiServiceImpl extends ServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService { |
| | | |
| | | @Resource |
| | | private HttpApiDao httpApiDao; |
| | | |
| | | |
| | | private static Map<String, HttpApiEntity> idMap = new ConcurrentHashMap<>(); |
| | | |
| | | @Override |
| | | public PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO) { |
| | |
| | | |
| | | @Override |
| | | public void update(HttpApiEntity httpApiEntity) { |
| | | idMap.remove(httpApiEntity.getId()); |
| | | httpApiDao.updateById(httpApiEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | idMap.remove(id); |
| | | httpApiDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity selectXstHttpTagApi() { |
| | | return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag")); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity getFromCatch(String id) { |
| | | if (idMap.containsKey(id)) { |
| | | return idMap.get(id); |
| | | } |
| | | HttpApiEntity entity = httpApiDao.selectById(id); |
| | | if (entity == null) { |
| | | return null; |
| | | } |
| | | idMap.put(id, entity); |
| | | return idMap.get(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpApiEntity> list() { |
| | | return httpApiDao.selectList(new QueryWrapper<>()); |
| | | } |