feat: OAuth

This commit is contained in:
landaiqing
2024-05-26 22:25:55 +08:00
parent 1154a53e9f
commit 90cc9e19f9
80 changed files with 1753 additions and 523 deletions

View File

@@ -2,7 +2,7 @@ package com.schisandra.system.api;
import com.schisandra.system.entity.Result;
import com.schisandra.system.entity.SchisandraSysConfigDTO;
import feign.Param;
import com.schisandra.system.entity.SchisandraSysOauthDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -10,7 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient("schisandra-cloud-storage-system-dev")
public interface SmsConfigFeignService {
public interface SchisandraSystemFeignService {
@RequestMapping(value = "/system/getConfigByKey",method = RequestMethod.GET)
Result<SchisandraSysConfigDTO> getConfigByKey(@RequestParam(value = "key") String key);
@PostMapping("/system/oauth/getOauthConfigByType")
Result<SchisandraSysOauthDTO> getOauthConfigByType(@RequestParam("type") String type);
}

View File

@@ -0,0 +1,98 @@
package com.schisandra.system.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* dto
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Data
public class SchisandraSysOauthDTO implements Serializable {
/**
*
*/
private Long id;
/**
* 类型
*/
private String clientType;
/**
* Client Id
*/
private String clientId;
/**
* Client Secret
*/
private String clientSecret;
/**
* 应用回调地址
*/
private String redirectUri;
/**
* Key
*/
private String stackOverflowKey;
/**
* 团队名
*/
private String domainPrefix;
/**
* 目录(租户) ID
*/
private String tenantId;
/**
*
*/
private String alipayPublicKey;
/**
*
*/
private String agentId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
/**
* 状态
*/
private String status;
}

View File

@@ -6,14 +6,12 @@ import com.google.common.base.Preconditions;
import com.schisandra.system.application.convert.SchisandraSysConfigDTOConverter;
import com.schisandra.system.application.dto.SchisandraSysConfigDTO;
import com.schisandra.system.common.entity.Result;
import com.schisandra.system.domain.entity.SchisandraSysConfigBO;
import com.schisandra.system.domain.bo.SchisandraSysConfigBO;
import com.schisandra.system.domain.service.SchisandraSysConfigDomainService;
import feign.Param;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* controller

View File

@@ -6,7 +6,7 @@ import com.google.common.base.Preconditions;
import com.schisandra.system.application.convert.SchisandraSysLogDTOConverter;
import com.schisandra.system.application.dto.SchisandraSysLogDTO;
import com.schisandra.system.common.entity.Result;
import com.schisandra.system.domain.entity.SchisandraSysLogBO;
import com.schisandra.system.domain.bo.SchisandraSysLogBO;
import com.schisandra.system.domain.service.SchisandraSysLogDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -0,0 +1,145 @@
package com.schisandra.system.application.controller;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.schisandra.system.application.convert.SchisandraSysOauthDTOConverter;
import com.schisandra.system.application.dto.SchisandraSysOauthDTO;
import com.schisandra.system.common.entity.Result;
import com.schisandra.system.domain.bo.SchisandraSysOauthBO;
import com.schisandra.system.domain.service.SchisandraSysOauthDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* controller
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@RestController
@RequestMapping("/system/oauth/")
@Slf4j
public class SchisandraSysOauthController {
@Resource
private SchisandraSysOauthDomainService schisandraSysOauthDomainService;
/**
* 新增
*/
@RequestMapping("add")
public Result<Boolean> add(@RequestBody SchisandraSysOauthDTO schisandraSysOauthDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraSysOauthController.add.dto:{}", JSON.toJSONString(schisandraSysOauthDTO));
}
Preconditions.checkNotNull(schisandraSysOauthDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientType(), "类型不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientId(), "Client Id不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientSecret(), "Client Secret不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getRedirectUri(), "应用回调地址不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStackOverflowKey(), "Key不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getDomainPrefix(), "团队名不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getTenantId(), "目录(租户) ID不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAlipayPublicKey(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAgentId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStatus(), "状态不能为空");
SchisandraSysOauthBO SchisandraSysOauthBO = SchisandraSysOauthDTOConverter.INSTANCE.convertDTOToBO(schisandraSysOauthDTO);
return Result.ok(schisandraSysOauthDomainService.add(SchisandraSysOauthBO));
} catch (Exception e) {
log.error("SchisandraSysOauthController.register.error:{}", e.getMessage(), e);
return Result.fail("新增失败");
}
}
/**
* 修改
*/
@RequestMapping("update")
public Result<Boolean> update(@RequestBody SchisandraSysOauthDTO schisandraSysOauthDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraSysOauthController.update.dto:{}", JSON.toJSONString(schisandraSysOauthDTO));
}
Preconditions.checkNotNull(schisandraSysOauthDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientType(), "类型不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientId(), "Client Id不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientSecret(), "Client Secret不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getRedirectUri(), "应用回调地址不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStackOverflowKey(), "Key不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getDomainPrefix(), "团队名不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getTenantId(), "目录(租户) ID不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAlipayPublicKey(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAgentId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStatus(), "状态不能为空");
SchisandraSysOauthBO schisandraSysOauthBO = SchisandraSysOauthDTOConverter.INSTANCE.convertDTOToBO(schisandraSysOauthDTO);
return Result.ok(schisandraSysOauthDomainService.update(schisandraSysOauthBO));
} catch (Exception e) {
log.error("SchisandraSysOauthController.update.error:{}", e.getMessage(), e);
return Result.fail("更新信息失败");
}
}
/**
* 删除
*/
@RequestMapping("delete")
public Result<Boolean> delete(@RequestBody SchisandraSysOauthDTO schisandraSysOauthDTO) {
try {
if (log.isInfoEnabled()) {
log.info("SchisandraSysOauthController.delete.dto:{}", JSON.toJSONString(schisandraSysOauthDTO));
}
Preconditions.checkNotNull(schisandraSysOauthDTO.getId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientType(), "类型不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientId(), "Client Id不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getClientSecret(), "Client Secret不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getRedirectUri(), "应用回调地址不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStackOverflowKey(), "Key不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getDomainPrefix(), "团队名不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getTenantId(), "目录(租户) ID不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAlipayPublicKey(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getAgentId(), "不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedBy(), "创建人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getCreatedTime(), "创建时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateTime(), "更新时间不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getUpdateBy(), "更新人不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getIsDeleted(), "是否删除 0 未删除 1已删除不能为空");
Preconditions.checkNotNull(schisandraSysOauthDTO.getStatus(), "状态不能为空");
SchisandraSysOauthBO schisandraSysOauthBO = SchisandraSysOauthDTOConverter.INSTANCE.convertDTOToBO(schisandraSysOauthDTO);
return Result.ok(schisandraSysOauthDomainService.delete(schisandraSysOauthBO));
} catch (Exception e) {
log.error("SchisandraSysOauthController.delete.error:{}", e.getMessage(), e);
return Result.fail("删除信息失败");
}
}
@PostMapping("getOauthConfigByType")
public Result<SchisandraSysOauthDTO> getOauthConfigByType(@RequestParam("type") String type) {
if (log.isInfoEnabled()) {
log.info("SchisandraSysOauthController.getOauthConfig.key:{}", type);
}
SchisandraSysOauthBO schisandraSysOauthBO = schisandraSysOauthDomainService.getOauthConfigByType(type);
SchisandraSysOauthDTO schisandraSysOauthDTO = SchisandraSysOauthDTOConverter.INSTANCE.convertBOToDTO(schisandraSysOauthBO);
return Result.ok(schisandraSysOauthDTO);
}
}

View File

@@ -2,7 +2,7 @@ package com.schisandra.system.application.convert;
import com.schisandra.system.application.dto.SchisandraSysConfigDTO;
import com.schisandra.system.domain.entity.SchisandraSysConfigBO;
import com.schisandra.system.domain.bo.SchisandraSysConfigBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@@ -2,7 +2,7 @@ package com.schisandra.system.application.convert;
import com.schisandra.system.application.dto.SchisandraSysLogDTO;
import com.schisandra.system.domain.entity.SchisandraSysLogBO;
import com.schisandra.system.domain.bo.SchisandraSysLogBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@@ -0,0 +1,23 @@
package com.schisandra.system.application.convert;
import com.schisandra.system.application.dto.SchisandraSysOauthDTO;
import com.schisandra.system.domain.bo.SchisandraSysOauthBO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* dto转换器
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Mapper
public interface SchisandraSysOauthDTOConverter {
SchisandraSysOauthDTOConverter INSTANCE = Mappers.getMapper(SchisandraSysOauthDTOConverter.class);
SchisandraSysOauthBO convertDTOToBO(SchisandraSysOauthDTO schisandraSysOauthDTO);
SchisandraSysOauthDTO convertBOToDTO(SchisandraSysOauthBO schisandraSysOauth);
}

View File

@@ -0,0 +1,98 @@
package com.schisandra.system.application.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* dto
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Data
public class SchisandraSysOauthDTO implements Serializable {
/**
*
*/
private Long id;
/**
* 类型
*/
private String clientType;
/**
* Client Id
*/
private String clientId;
/**
* Client Secret
*/
private String clientSecret;
/**
* 应用回调地址
*/
private String redirectUri;
/**
* Key
*/
private String stackOverflowKey;
/**
* 团队名
*/
private String domainPrefix;
/**
* 目录(租户) ID
*/
private String tenantId;
/**
*
*/
private String alipayPublicKey;
/**
*
*/
private String agentId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
/**
* 状态
*/
private String status;
}

View File

@@ -0,0 +1,98 @@
package com.schisandra.system.domain.bo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* bo
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Data
public class SchisandraSysOauthBO implements Serializable {
/**
*
*/
private Long id;
/**
* 类型
*/
private String clientType;
/**
* Client Id
*/
private String clientId;
/**
* Client Secret
*/
private String clientSecret;
/**
* 应用回调地址
*/
private String redirectUri;
/**
* Key
*/
private String stackOverflowKey;
/**
* 团队名
*/
private String domainPrefix;
/**
* 目录(租户) ID
*/
private String tenantId;
/**
*
*/
private String alipayPublicKey;
/**
*
*/
private String agentId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
/**
* 状态
*/
private String status;
}

View File

@@ -1,6 +1,6 @@
package com.schisandra.system.domain.convert;
import com.schisandra.system.domain.entity.SchisandraSysConfigBO;
import com.schisandra.system.domain.bo.SchisandraSysConfigBO;
import com.schisandra.system.infra.basic.entity.SchisandraSysConfig;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@@ -1,7 +1,7 @@
package com.schisandra.system.domain.convert;
import com.schisandra.system.domain.entity.SchisandraSysLogBO;
import com.schisandra.system.domain.bo.SchisandraSysLogBO;
import com.schisandra.system.infra.basic.entity.SchisandraSysLog;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@@ -0,0 +1,23 @@
package com.schisandra.system.domain.convert;
import com.schisandra.system.domain.bo.SchisandraSysOauthBO;
import com.schisandra.system.infra.basic.entity.SchisandraSysOauth;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* bo转换器
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Mapper
public interface SchisandraSysOauthBOConverter {
SchisandraSysOauthBOConverter INSTANCE = Mappers.getMapper(SchisandraSysOauthBOConverter.class);
SchisandraSysOauth convertBOToEntity(SchisandraSysOauthBO schisandraSysOauthBO);
SchisandraSysOauthBO convertEntityToBO(SchisandraSysOauth schisandraSysOauth);
}

View File

@@ -1,6 +1,6 @@
package com.schisandra.system.domain.service;
import com.schisandra.system.domain.entity.SchisandraSysConfigBO;
import com.schisandra.system.domain.bo.SchisandraSysConfigBO;
/**
* 领域service

View File

@@ -1,6 +1,6 @@
package com.schisandra.system.domain.service;
import com.schisandra.system.domain.entity.SchisandraSysLogBO;
import com.schisandra.system.domain.bo.SchisandraSysLogBO;
/**
* 领域service

View File

@@ -0,0 +1,31 @@
package com.schisandra.system.domain.service;
import com.schisandra.system.domain.bo.SchisandraSysOauthBO;
/**
* 领域service
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
public interface SchisandraSysOauthDomainService {
/**
* 添加 信息
*/
Boolean add(SchisandraSysOauthBO schisandraSysOauthBO);
/**
* 更新 信息
*/
Boolean update(SchisandraSysOauthBO schisandraSysOauthBO);
/**
* 删除 信息
*/
Boolean delete(SchisandraSysOauthBO schisandraSysOauthBO);
SchisandraSysOauthBO getOauthConfigByType(String type);
}

View File

@@ -3,7 +3,7 @@ package com.schisandra.system.domain.service.impl;
import com.schisandra.system.common.enums.IsDeletedFlagEnum;
import com.schisandra.system.domain.convert.SchisandraSysConfigBOConverter;
import com.schisandra.system.domain.entity.SchisandraSysConfigBO;
import com.schisandra.system.domain.bo.SchisandraSysConfigBO;
import com.schisandra.system.domain.service.SchisandraSysConfigDomainService;
import com.schisandra.system.infra.basic.entity.SchisandraSysConfig;
import com.schisandra.system.infra.basic.service.SchisandraSysConfigService;

View File

@@ -1,9 +1,8 @@
package com.schisandra.system.domain.service.impl;
import com.schisandra.system.common.enums.IsDeletedFlagEnum;
import com.schisandra.system.domain.convert.SchisandraSysLogBOConverter;
import com.schisandra.system.domain.entity.SchisandraSysLogBO;
import com.schisandra.system.domain.bo.SchisandraSysLogBO;
import com.schisandra.system.domain.service.SchisandraSysLogDomainService;
import com.schisandra.system.infra.basic.entity.SchisandraSysLog;
import com.schisandra.system.infra.basic.service.SchisandraSysLogService;

View File

@@ -0,0 +1,56 @@
package com.schisandra.system.domain.service.impl;
import com.schisandra.system.common.enums.IsDeletedFlagEnum;
import com.schisandra.system.domain.bo.SchisandraSysOauthBO;
import com.schisandra.system.domain.convert.SchisandraSysOauthBOConverter;
import com.schisandra.system.domain.service.SchisandraSysOauthDomainService;
import com.schisandra.system.infra.basic.entity.SchisandraSysOauth;
import com.schisandra.system.infra.basic.service.SchisandraSysOauthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 领域service实现了
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Service
@Slf4j
public class SchisandraSysOauthDomainServiceImpl implements SchisandraSysOauthDomainService {
@Resource
private SchisandraSysOauthService schisandraSysOauthService;
@Override
public Boolean add(SchisandraSysOauthBO schisandraSysOauthBO) {
SchisandraSysOauth schisandraSysOauth = SchisandraSysOauthBOConverter.INSTANCE.convertBOToEntity(schisandraSysOauthBO);
schisandraSysOauth.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
return schisandraSysOauthService.insert(schisandraSysOauth) > 0;
}
@Override
public Boolean update(SchisandraSysOauthBO schisandraSysOauthBO) {
SchisandraSysOauth schisandraSysOauth = SchisandraSysOauthBOConverter.INSTANCE.convertBOToEntity(schisandraSysOauthBO);
return schisandraSysOauthService.update(schisandraSysOauth) > 0;
}
@Override
public Boolean delete(SchisandraSysOauthBO schisandraSysOauthBO) {
SchisandraSysOauth schisandraSysOauth = new SchisandraSysOauth();
schisandraSysOauth.setId(schisandraSysOauthBO.getId());
schisandraSysOauth.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
return schisandraSysOauthService.update(schisandraSysOauth) > 0;
}
@Override
public SchisandraSysOauthBO getOauthConfigByType(String type) {
SchisandraSysOauth schisandraSysOauth= schisandraSysOauthService.getOauthConfigByType(type);
SchisandraSysOauthBO schisandraSysOauthBO = SchisandraSysOauthBOConverter.INSTANCE.convertEntityToBO(schisandraSysOauth);
return schisandraSysOauthBO;
}
}

View File

@@ -0,0 +1,18 @@
package com.schisandra.system.infra.basic.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.schisandra.system.infra.basic.entity.SchisandraSysOauth;
import org.springframework.stereotype.Repository;
/**
* 表数据库访问层
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Repository
public interface SchisandraSysOauthDao extends BaseMapper<SchisandraSysOauth> {
}

View File

@@ -0,0 +1,119 @@
package com.schisandra.system.infra.basic.entity;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
/**
* 实体类
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Data
@TableName("schisandra_sys_oauth")
public class SchisandraSysOauth implements Serializable {
/**
*
*/
@TableId(value = "`id`", type = IdType.AUTO)
private Long id;
/**
* 类型
*/
@TableField("`client_type`")
private String clientType;
/**
* Client Id
*/
@TableField("`client_id`")
private String clientId;
/**
* Client Secret
*/
@TableField("`client_secret`")
private String clientSecret;
/**
* 应用回调地址
*/
@TableField("`redirect_uri`")
private String redirectUri;
/**
* Key
*/
@TableField("`stack_overflow_Key`")
private String stackOverflowKey;
/**
* 团队名
*/
@TableField("`domain_prefix`")
private String domainPrefix;
/**
* 目录(租户) ID
*/
@TableField("`tenant_id`")
private String tenantId;
/**
*
*/
@TableField("`alipay_public_key`")
private String alipayPublicKey;
/**
*
*/
@TableField("`agent_id`")
private String agentId;
/**
* 创建人
*/
@TableField("`created_by`")
private String createdBy;
/**
* 创建时间
*/
@TableField("`created_time`")
private Date createdTime;
/**
* 更新时间
*/
@TableField("`update_time`")
private Date updateTime;
/**
* 更新人
*/
@TableField("`update_by`")
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
@TableField("`is_deleted`")
private Integer isDeleted;
/**
* 状态
*/
@TableField("`status`")
private String status;
}

View File

@@ -0,0 +1,51 @@
package com.schisandra.system.infra.basic.service;
import com.schisandra.system.infra.basic.entity.SchisandraSysOauth;
/**
* 表服务接口
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
public interface SchisandraSysOauthService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraSysOauth queryById(Long id);
/**
* 新增数据
*
* @param schisandraSysOauth 实例对象
* @return 实例对象
*/
int insert(SchisandraSysOauth schisandraSysOauth);
/**
* 修改数据
*
* @param schisandraSysOauth 实例对象
* @return 实例对象
*/
int update(SchisandraSysOauth schisandraSysOauth);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 根据条件查询角色
*/
SchisandraSysOauth queryByCondition(SchisandraSysOauth schisandraSysOauth);
SchisandraSysOauth getOauthConfigByType(String type);
}

View File

@@ -0,0 +1,109 @@
package com.schisandra.system.infra.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.schisandra.system.infra.basic.dao.SchisandraSysOauthDao;
import com.schisandra.system.infra.basic.entity.SchisandraSysOauth;
import com.schisandra.system.infra.basic.service.SchisandraSysOauthService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Objects;
/**
* 表服务实现类
*
* @author landaiqing
* @since 2024-05-25 23:08:26
*/
@Service("SchisandraSysOauthService")
public class SchisandraSysOauthServiceImpl implements SchisandraSysOauthService {
@Resource
private SchisandraSysOauthDao schisandraSysOauthDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SchisandraSysOauth queryById(Long id) {
return this.schisandraSysOauthDao.selectById(id);
}
/**
* 新增数据
*
* @param schisandraSysOauth 实例对象
* @return 实例对象
*/
@Override
public int insert(SchisandraSysOauth schisandraSysOauth) {
return this.schisandraSysOauthDao.insert(schisandraSysOauth);
}
/**
* 修改数据
*
* @param schisandraSysOauth 实例对象
* @return 实例对象
*/
@Override
public int update(SchisandraSysOauth schisandraSysOauth) {
return this.schisandraSysOauthDao.updateById(schisandraSysOauth);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.schisandraSysOauthDao.deleteById(id) > 0;
}
/**
* 条件查询
*
* @param schisandraSysOauth 条件
* @return 实例对象
*/
@Override
public SchisandraSysOauth queryByCondition(SchisandraSysOauth schisandraSysOauth) {
LambdaQueryWrapper<SchisandraSysOauth> queryWrapper = Wrappers.<SchisandraSysOauth>lambdaQuery()
.eq(Objects.nonNull(schisandraSysOauth.getId()), SchisandraSysOauth::getId, schisandraSysOauth.getId())
.eq(Objects.nonNull(schisandraSysOauth.getClientType()), SchisandraSysOauth::getClientType, schisandraSysOauth.getClientType())
.eq(Objects.nonNull(schisandraSysOauth.getClientId()), SchisandraSysOauth::getClientId, schisandraSysOauth.getClientId())
.eq(Objects.nonNull(schisandraSysOauth.getClientSecret()), SchisandraSysOauth::getClientSecret, schisandraSysOauth.getClientSecret())
.eq(Objects.nonNull(schisandraSysOauth.getRedirectUri()), SchisandraSysOauth::getRedirectUri, schisandraSysOauth.getRedirectUri())
.eq(Objects.nonNull(schisandraSysOauth.getStackOverflowKey()), SchisandraSysOauth::getStackOverflowKey, schisandraSysOauth.getStackOverflowKey())
.eq(Objects.nonNull(schisandraSysOauth.getDomainPrefix()), SchisandraSysOauth::getDomainPrefix, schisandraSysOauth.getDomainPrefix())
.eq(Objects.nonNull(schisandraSysOauth.getTenantId()), SchisandraSysOauth::getTenantId, schisandraSysOauth.getTenantId())
.eq(Objects.nonNull(schisandraSysOauth.getAlipayPublicKey()), SchisandraSysOauth::getAlipayPublicKey, schisandraSysOauth.getAlipayPublicKey())
.eq(Objects.nonNull(schisandraSysOauth.getAgentId()), SchisandraSysOauth::getAgentId, schisandraSysOauth.getAgentId())
.eq(Objects.nonNull(schisandraSysOauth.getCreatedBy()), SchisandraSysOauth::getCreatedBy, schisandraSysOauth.getCreatedBy())
.eq(Objects.nonNull(schisandraSysOauth.getCreatedTime()), SchisandraSysOauth::getCreatedTime, schisandraSysOauth.getCreatedTime())
.eq(Objects.nonNull(schisandraSysOauth.getUpdateTime()), SchisandraSysOauth::getUpdateTime, schisandraSysOauth.getUpdateTime())
.eq(Objects.nonNull(schisandraSysOauth.getUpdateBy()), SchisandraSysOauth::getUpdateBy, schisandraSysOauth.getUpdateBy())
.eq(Objects.nonNull(schisandraSysOauth.getIsDeleted()), SchisandraSysOauth::getIsDeleted, schisandraSysOauth.getIsDeleted())
.eq(Objects.nonNull(schisandraSysOauth.getStatus()), SchisandraSysOauth::getStatus, schisandraSysOauth.getStatus())
;
return schisandraSysOauthDao.selectOne(queryWrapper);
}
@Override
public SchisandraSysOauth getOauthConfigByType(String type) {
return schisandraSysOauthDao.selectOne(new QueryWrapper<SchisandraSysOauth>()
.eq("client_type",type)
.eq("is_deleted",0));
}
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.schisandra.system.infra.basic.dao.SchisandraSysOauthDao">
<resultMap id="BaseResultMap" type="com.schisandra.system.infra.basic.entity.SchisandraSysOauth">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="client_type" jdbcType="VARCHAR" property="clientType"/>
<result column="client_id" jdbcType="VARCHAR" property="clientId"/>
<result column="client_secret" jdbcType="VARCHAR" property="clientSecret"/>
<result column="redirect_uri" jdbcType="VARCHAR" property="redirectUri"/>
<result column="stack_overflow_Key" jdbcType="VARCHAR" property="stackOverflowKey"/>
<result column="domain_prefix" jdbcType="VARCHAR" property="domainPrefix"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="alipay_public_key" jdbcType="VARCHAR" property="alipayPublicKey"/>
<result column="agent_id" jdbcType="VARCHAR" property="agentId"/>
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
</resultMap>
</mapper>

View File

@@ -75,3 +75,15 @@ sa-token:
token-prefix: schisandra
is-print: false
feign:
client:
config:
default:
connectTimeout: 60000
readTimeout: 60000
ribbon:
ConnectTimeout: 60000
ReadTimeout: 60000

View File

@@ -11,6 +11,7 @@ spring:
group: DEFAULT_GROUP
namespace:
file-extension: yaml
timeout: 60000
discovery:
enabled: true
server-addr: 1.95.0.111:8848