package com.iailab.module.data.channel.http.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.data.channel.http.dao.HttpTokenDao; import com.iailab.module.data.channel.http.entity.HttpTokenEntity; import com.iailab.module.data.channel.http.service.HttpTokenService; import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; import com.iailab.module.data.common.utils.HttpsRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class HttpTokenServiceImpl extends ServiceImpl implements HttpTokenService { @Resource private HttpsRequest httpsRequest; @Resource private HttpTokenDao httpTokenDao; @Override public PageResult queryPage(HttpTokenPageReqVO reqVO) { return httpTokenDao.selectPage(reqVO); } @Override public HttpTokenEntity info(String id) { return httpTokenDao.selectById(id); } @Override public void add(HttpTokenEntity httpTokenEntity) { httpTokenDao.insert(httpTokenEntity); } @Override public void update(HttpTokenEntity httpTokenEntity) { httpTokenDao.updateById(httpTokenEntity); } @Override public void delete(String id) { httpTokenDao.deleteById(id); } @Override public List list() { return httpTokenDao.selectList(new QueryWrapper<>()); } @Override public HttpTokenEntity getByApiId(String apiId) { QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(apiId), "api_id", apiId); return httpTokenDao.selectOne(wrapper); } @Override public String queryToken(String clientId) { return httpTokenDao.selectOne(new QueryWrapper().eq("client_id", clientId)).getToken(); } }