8 changed files with 87 additions and 3 deletions
@ -0,0 +1,18 @@ |
|||||
|
package com.bx.implatform.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
@Data |
||||
|
@TableName("im_platform_configuration") |
||||
|
public class PlatformConfiguration { |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
private String platformName; |
||||
|
private String uniqueToken; |
||||
|
private String domainName; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.bx.implatform.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.bx.implatform.entity.PlatformConfiguration; |
||||
|
import com.bx.implatform.entity.QuickReply; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface PlatformConfigurationMapper extends BaseMapper<PlatformConfiguration> { |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.bx.implatform.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.bx.implatform.entity.PlatformConfiguration; |
||||
|
|
||||
|
public interface PlatformConfigurationService extends IService<PlatformConfiguration> { |
||||
|
|
||||
|
/** |
||||
|
* 根据 sourceUrl 获取平台名称 |
||||
|
*/ |
||||
|
String getPlatformNameBySourceUrl(String sourceUrl); |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.bx.implatform.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.bx.implatform.entity.PlatformConfiguration; |
||||
|
import com.bx.implatform.mapper.PlatformConfigurationMapper; |
||||
|
import com.bx.implatform.service.PlatformConfigurationService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class PlatformConfigurationServiceImpl extends ServiceImpl<PlatformConfigurationMapper, PlatformConfiguration> implements PlatformConfigurationService { |
||||
|
@Override |
||||
|
public String getPlatformNameBySourceUrl(String sourceUrl) { |
||||
|
if (!StringUtils.hasText(sourceUrl)) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
LambdaQueryWrapper<PlatformConfiguration> wrapper = Wrappers.lambdaQuery(); |
||||
|
|
||||
|
wrapper.eq(PlatformConfiguration::getDomainName, sourceUrl); |
||||
|
|
||||
|
PlatformConfiguration config = this.getOne(wrapper); |
||||
|
log.info("【测试】前端传的uniqueToken:{}",config ); |
||||
|
return config != null ? config.getPlatformName() : null; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue