feat: 拦截器实现/gateway微服务打通

This commit is contained in:
landaiqing
2024-06-02 14:54:37 +08:00
parent bb74574bc3
commit 8f8e8225dd
27 changed files with 235 additions and 1000 deletions

View File

@@ -3,9 +3,11 @@ package com.schisandra.auth.application.config;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.schisandra.auth.application.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.List; import java.util.List;
@@ -35,4 +37,10 @@ public class GlobalConfig extends WebMvcConfigurationSupport {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper); MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper);
return converter; return converter;
} }
@Override
protected void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginInterceptor())
.addPathPatterns("/**");
}
} }

View File

@@ -0,0 +1,41 @@
package com.schisandra.auth.application.context;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
/**
* @description: 登录上下文对象
* @author: landaiqing
* @date: 2024/6/2 14:24
*/
public class LoginContextHolder {
private static final InheritableThreadLocal<Map<String, Object>> THREAD_LOCAL = new InheritableThreadLocal<>();
public static void set(String key, Object val) {
Map<String, Object> map = getThreadLoacalMap();
map.put(key, val);
}
public static Object get(String key) {
Map<String, Object> threadLoacalMap = getThreadLoacalMap();
return threadLoacalMap.get(key);
}
public static void remove() {
THREAD_LOCAL.remove();
}
public static String getUserId() {
return (String) getThreadLoacalMap().get("userId");
}
public static Map<String, Object> getThreadLoacalMap() {
Map<String, Object> map = THREAD_LOCAL.get();
if (Objects.isNull(map)) {
map = new ConcurrentHashMap<>();
THREAD_LOCAL.set(map);
}
return map;
}
}

View File

@@ -0,0 +1,22 @@
package com.schisandra.auth.application.interceptor;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Classname FeignConfiguration
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.interceptor
* @Author: landaiqing
* @CreateTime: 2024-03-03 21:11
* @Description: TODO
* @Version: 1.0
*/
@Configuration
public class FeignConfiguration {
@Bean
public RequestInterceptor requestInterceptor(){
return new FeignRequestInterceptor();
}
}

View File

@@ -0,0 +1,34 @@
package com.schisandra.auth.application.interceptor;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
/**
* @Classname FeignRequestInterceptor
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.interceptor
* @Author: landaiqing
* @CreateTime: 2024-03-03 21:04
* @Description: Feign请求拦截器
* @Version: 1.0
*/
@Component
public class FeignRequestInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest();
String userId = request.getHeader("userId");
if (StringUtils.isNotBlank(userId)) {
requestTemplate.header("userId", userId);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.schisandra.auth.application.interceptor;
import com.schisandra.auth.application.context.LoginContextHolder;
import org.springframework.lang.Nullable;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @description: 登录拦截器
* @author: landaiqing
* @date: 2024/6/2 14:24
*/
public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String userId = request.getHeader("userId");
LoginContextHolder.set("userId",userId);
return true;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
LoginContextHolder.remove();
}
}

View File

@@ -0,0 +1,42 @@
package com.schisandra.auth.common.context;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Classname LoginContextHolder
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.context
* @Author: landaiqing
* @CreateTime: 2024-03-03 18:11
* @Description: 登录上下文对象
* @Version: 1.0
*/
public class LoginContextHolder {
private static final InheritableThreadLocal <Map<String,Object>> THREAD_LOCAL=new InheritableThreadLocal<>();
public static void set(String key,Object val){
Map<String,Object> map=getThreadLoacalMap();
map.put(key, val);
}
public static Object get(String key){
Map<String,Object> threadLoacalMap=getThreadLoacalMap();
return threadLoacalMap.get(key);
}
public static void remove(){
THREAD_LOCAL.remove();
}
public static String getUserId(){
return (String) getThreadLoacalMap().get("userId");
}
public static Map<String,Object> getThreadLoacalMap(){
Map<String,Object> map =THREAD_LOCAL.get();
if (Objects.isNull(map)){
map=new ConcurrentHashMap<>();
THREAD_LOCAL.set(map);
}
return map;
}
}

View File

@@ -0,0 +1,20 @@
package com.schisandra.auth.common.utils;
import com.schisandra.auth.common.context.LoginContextHolder;
/**
* @Classname LoginUtil
* @BelongsProject: qing-yu-club
* @BelongsPackage: com.landaiqing.subject.application.util
* @Author: landaiqing
* @CreateTime: 2024-03-03 18:33
* @Description: 用户登录util
* @Version: 1.0
*/
public class LoginUtil {
public static String getUserId() {
return LoginContextHolder.getUserId();
}
}

View File

@@ -5,7 +5,7 @@ import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
public interface SchisandraAuthPermissionDomainService { public interface SchisandraAuthPermissionDomainService {
Object update(SchisandraAuthPermissionBO schisandraAuthPermissionBO); int update(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
Object delete(SchisandraAuthPermissionBO schisandraAuthPermissionBO); Object delete(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
Object insert(SchisandraAuthPermissionBO schisandraAuthPermissionBO); Object insert(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
SchisandraAuthPermissionBO select(SchisandraAuthPermissionBO schisandraAuthPermissionBO); SchisandraAuthPermissionBO select(SchisandraAuthPermissionBO schisandraAuthPermissionBO);

View File

@@ -38,7 +38,7 @@ public interface SchisandraAuthRoleDomainService {
*@Time 21:03 *@Time 21:03
*/ */
Object insert(SchisandraAuthRoleBO schisandraAuthRoleBO); int insert(SchisandraAuthRoleBO schisandraAuthRoleBO);
/*** /***
*@ClassName: SchisandraAuthRoleDomainService *@ClassName: SchisandraAuthRoleDomainService
*@Description 查询角色信息 *@Description 查询角色信息

View File

@@ -2,9 +2,6 @@ package com.schisandra.auth.domain.service;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO; import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import java.util.List;
/** /**
* 用户领域service * 用户领域service
@@ -14,10 +11,6 @@ import java.util.List;
*/ */
public interface SchisandraSmsConfigDomainService { public interface SchisandraSmsConfigDomainService {
List<SchisandraSmsConfigBO> queryAll();
SchisandraSmsConfigBO queryByConfigId(String configId); SchisandraSmsConfigBO queryByConfigId(String configId);
} }

View File

@@ -23,10 +23,9 @@ public class SchisandraAuthPermissionDomainServiceImpl implements SchisandraAuth
* @date: 2024/4/17 17:06 * @date: 2024/4/17 17:06
*/ */
@Override @Override
public Object update(SchisandraAuthPermissionBO schisandraAuthPermissionBO) { public int update(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO); SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);
SchisandraAuthPermission schisandraAuthPermission1 =schisandraAuthPermissionService.update(schisandraAuthPermission); return schisandraAuthPermissionService.update(schisandraAuthPermission);
return schisandraAuthPermission1;
} }
/** /**
* @description: 删除 * @description: 删除

View File

@@ -23,32 +23,32 @@ import javax.annotation.Resource;
@Slf4j @Slf4j
public class SchisandraAuthRoleDomainServiceImpl implements SchisandraAuthRoleDomainService { public class SchisandraAuthRoleDomainServiceImpl implements SchisandraAuthRoleDomainService {
@Resource @Resource
private SchisandraAuthRoleService schisandraAuthRoleService; private SchisandraAuthRoleService schisandraAuthRoleService;
@Override @Override
public Object update(SchisandraAuthRoleBO schisandraAuthRoleBO) { public Object update(SchisandraAuthRoleBO schisandraAuthRoleBO) {
SchisandraAuthRole schisandraAuthRole =SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO); SchisandraAuthRole schisandraAuthRole = SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO);
SchisandraAuthRole schisandraAuthRole1=schisandraAuthRoleService.update(schisandraAuthRole); SchisandraAuthRole update = schisandraAuthRoleService.update(schisandraAuthRole);
return schisandraAuthRole1; return update;
} }
@Override @Override
public Object delete(Long id) { public Object delete(Long id) {
boolean isDeleted=schisandraAuthRoleService.deleteById(id); boolean isDeleted = schisandraAuthRoleService.deleteById(id);
return isDeleted; return isDeleted;
} }
@Override @Override
public Object insert(SchisandraAuthRoleBO schisandraAuthRoleBO) { public int insert(SchisandraAuthRoleBO schisandraAuthRoleBO) {
SchisandraAuthRole schisandraAuthRole =SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO); SchisandraAuthRole schisandraAuthRole = SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO);
SchisandraAuthRole schisandraAuthRole1=schisandraAuthRoleService.insert(schisandraAuthRole); return schisandraAuthRoleService.insert(schisandraAuthRole);
return schisandraAuthRole1;
} }
@Override @Override
public Object select(SchisandraAuthRoleBO schisandraAuthRoleBO) { public Object select(SchisandraAuthRoleBO schisandraAuthRoleBO) {
SchisandraAuthRole schisandraAuthRole =SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO); SchisandraAuthRole schisandraAuthRole = SchisandraAuthRoleBOConverter.INSTANCE.convertBOToEntity(schisandraAuthRoleBO);
if(schisandraAuthRoleBO.getId()!=null){ if (schisandraAuthRoleBO.getId() != null) {
SchisandraAuthRole schisandraAuthRole1=schisandraAuthRoleService.queryById(schisandraAuthRoleBO.getId()); SchisandraAuthRole schisandraAuthRole1 = schisandraAuthRoleService.queryById(schisandraAuthRoleBO.getId());
return schisandraAuthRole1; return schisandraAuthRole1;
} }
return null; return null;

View File

@@ -15,20 +15,11 @@ import java.util.List;
public class SchisandraSmsConfigDomainServiceImpl implements SchisandraSmsConfigDomainService { public class SchisandraSmsConfigDomainServiceImpl implements SchisandraSmsConfigDomainService {
@Resource @Resource
private SchisandraSmsConfigService schisandraSmsConfigService; private SchisandraSmsConfigService schisandraSmsConfigService;
@Override
public List<SchisandraSmsConfigBO> queryAll() {
List<SchisandraSmsConfig> schisandraSmsConfigs = schisandraSmsConfigService.queryAll();
return SchisandraSmsConfigBOConvert.INSTANCE.convertEntityToBOList(schisandraSmsConfigs);
}
@Override @Override
public SchisandraSmsConfigBO queryByConfigId(String configId) { public SchisandraSmsConfigBO queryByConfigId(String configId) {
SchisandraSmsConfig schisandraSmsConfig= schisandraSmsConfigService.queryByConfigId(configId); SchisandraSmsConfig schisandraSmsConfig= schisandraSmsConfigService.queryByConfigId(configId);
return SchisandraSmsConfigBOConvert.INSTANCE.convertEntityToBO(schisandraSmsConfig);
SchisandraSmsConfigBO schisandraSmsConfigBO = SchisandraSmsConfigBOConvert.INSTANCE.convertEntityToBO(schisandraSmsConfig);
return schisandraSmsConfigBO;
} }
} }

View File

@@ -2,13 +2,8 @@ package com.schisandra.auth.infra.basic.dao;
import com.mybatisflex.core.BaseMapper; import com.mybatisflex.core.BaseMapper;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission; import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* (SchisandraAuthPermission)表数据库访问层 * (SchisandraAuthPermission)表数据库访问层
* *
@@ -18,49 +13,6 @@ import java.util.List;
@Repository @Repository
public interface SchisandraAuthPermissionDao extends BaseMapper<SchisandraAuthPermission> { public interface SchisandraAuthPermissionDao extends BaseMapper<SchisandraAuthPermission> {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraAuthPermission queryById(Long id);
/**
* 查询指定行数据
*
* @param schisandraAuthPermission 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<SchisandraAuthPermission> queryAllByLimit(SchisandraAuthPermission schisandraAuthPermission, @Param("pageable") Pageable pageable);
/**
* 统计总行数
*
* @param schisandraAuthPermission 查询条件
* @return 总行数
*/
long count(SchisandraAuthPermission schisandraAuthPermission);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<SchisandraAuthPermission> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<SchisandraAuthPermission> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<SchisandraAuthPermission> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthPermission> entities);
} }

View File

@@ -18,51 +18,5 @@ import java.util.List;
@Repository @Repository
public interface SchisandraAuthRoleDao extends BaseMapper<SchisandraAuthRole> { public interface SchisandraAuthRoleDao extends BaseMapper<SchisandraAuthRole> {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraAuthRole queryById(Long id);
/**
* 查询指定行数据
*
* @param schisandraAuthRole 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<SchisandraAuthRole> queryAllByLimit(SchisandraAuthRole schisandraAuthRole, @Param("pageable") Pageable pageable);
/**
* 统计总行数
*
* @param schisandraAuthRole 查询条件
* @return 总行数
*/
long count(SchisandraAuthRole schisandraAuthRole);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<SchisandraAuthRole> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<SchisandraAuthRole> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<SchisandraAuthRole> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthRole> entities);
} }

View File

@@ -1,12 +1,9 @@
package com.schisandra.auth.infra.basic.dao; package com.schisandra.auth.infra.basic.dao;
import com.mybatisflex.core.BaseMapper;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig; import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* (SchisandraSmsConfig)表数据库访问层 * (SchisandraSmsConfig)表数据库访问层
* *
@@ -14,76 +11,8 @@ import java.util.List;
* @since 2024-05-11 15:47:58 * @since 2024-05-11 15:47:58
*/ */
@Repository @Repository
public interface SchisandraSmsConfigDao { public interface SchisandraSmsConfigDao extends BaseMapper<SchisandraSmsConfig> {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraSmsConfig queryById(Integer id);
/**
* 查询指定行数据
*
* @param schisandraSmsConfig 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<SchisandraSmsConfig> queryAllByLimit(SchisandraSmsConfig schisandraSmsConfig, @Param("pageable") Pageable pageable);
/**
* 统计总行数
*
* @param schisandraSmsConfig 查询条件
* @return 总行数
*/
long count(SchisandraSmsConfig schisandraSmsConfig);
/**
* 新增数据
*
* @param schisandraSmsConfig 实例对象
* @return 影响行数
*/
int insert(SchisandraSmsConfig schisandraSmsConfig);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<SchisandraSmsConfig> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<SchisandraSmsConfig> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<SchisandraSmsConfig> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<SchisandraSmsConfig> entities);
/**
* 修改数据
*
* @param schisandraSmsConfig 实例对象
* @return 影响行数
*/
int update(SchisandraSmsConfig schisandraSmsConfig);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
List<SchisandraSmsConfig> queryAll();
SchisandraSmsConfig queryByConfigId(String configId);
} }

View File

@@ -22,14 +22,6 @@ public interface SchisandraAuthPermissionService {
*/ */
SchisandraAuthPermission queryById(Long id); SchisandraAuthPermission queryById(Long id);
/**
* 分页查询
*
* @param schisandraAuthPermission 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<SchisandraAuthPermission> queryByPage(SchisandraAuthPermission schisandraAuthPermission, PageRequest pageRequest);
/** /**
* 新增数据 * 新增数据
@@ -43,9 +35,9 @@ public interface SchisandraAuthPermissionService {
* 修改数据 * 修改数据
* *
* @param schisandraAuthPermission 实例对象 * @param schisandraAuthPermission 实例对象
* @return 实例对象 * @return int
*/ */
SchisandraAuthPermission update(SchisandraAuthPermission schisandraAuthPermission); int update(SchisandraAuthPermission schisandraAuthPermission);
/** /**
* 通过主键删除数据 * 通过主键删除数据

View File

@@ -20,14 +20,6 @@ public interface SchisandraAuthRoleService {
*/ */
SchisandraAuthRole queryById(Long id); SchisandraAuthRole queryById(Long id);
/**
* 分页查询
*
* @param schisandraAuthRole 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<SchisandraAuthRole> queryByPage(SchisandraAuthRole schisandraAuthRole, PageRequest pageRequest);
/** /**
* 新增数据 * 新增数据
@@ -35,7 +27,7 @@ public interface SchisandraAuthRoleService {
* @param schisandraAuthRole 实例对象 * @param schisandraAuthRole 实例对象
* @return 实例对象 * @return 实例对象
*/ */
SchisandraAuthRole insert(SchisandraAuthRole schisandraAuthRole); int insert(SchisandraAuthRole schisandraAuthRole);
/** /**
* 修改数据 * 修改数据

View File

@@ -22,14 +22,6 @@ public interface SchisandraSmsConfigService {
*/ */
SchisandraSmsConfig queryById(Integer id); SchisandraSmsConfig queryById(Integer id);
/**
* 分页查询
*
* @param schisandraSmsConfig 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<SchisandraSmsConfig> queryByPage(SchisandraSmsConfig schisandraSmsConfig, PageRequest pageRequest);
/** /**
* 新增数据 * 新增数据
@@ -37,7 +29,7 @@ public interface SchisandraSmsConfigService {
* @param schisandraSmsConfig 实例对象 * @param schisandraSmsConfig 实例对象
* @return 实例对象 * @return 实例对象
*/ */
SchisandraSmsConfig insert(SchisandraSmsConfig schisandraSmsConfig); int insert(SchisandraSmsConfig schisandraSmsConfig);
/** /**
* 修改数据 * 修改数据
@@ -55,7 +47,6 @@ public interface SchisandraSmsConfigService {
*/ */
boolean deleteById(Integer id); boolean deleteById(Integer id);
List<SchisandraSmsConfig> queryAll();
SchisandraSmsConfig queryByConfigId(String configId); SchisandraSmsConfig queryByConfigId(String configId);
} }

View File

@@ -30,21 +30,9 @@ public class SchisandraAuthPermissionServiceImpl implements SchisandraAuthPermis
*/ */
@Override @Override
public SchisandraAuthPermission queryById(Long id) { public SchisandraAuthPermission queryById(Long id) {
return this.schisandraAuthPermissionDao.queryById(id); return this.schisandraAuthPermissionDao.selectOneById(id);
} }
/**
* 分页查询
*
* @param schisandraAuthPermission 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<SchisandraAuthPermission> queryByPage(SchisandraAuthPermission schisandraAuthPermission, PageRequest pageRequest) {
long total = this.schisandraAuthPermissionDao.count(schisandraAuthPermission);
return new PageImpl<>(this.schisandraAuthPermissionDao.queryAllByLimit(schisandraAuthPermission, pageRequest), pageRequest, total);
}
/** /**
* 新增数据 * 新增数据
@@ -65,9 +53,8 @@ public class SchisandraAuthPermissionServiceImpl implements SchisandraAuthPermis
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public SchisandraAuthPermission update(SchisandraAuthPermission schisandraAuthPermission) { public int update(SchisandraAuthPermission schisandraAuthPermission) {
this.schisandraAuthPermissionDao.update(schisandraAuthPermission); return this.schisandraAuthPermissionDao.update(schisandraAuthPermission);
return this.queryById(schisandraAuthPermission.getId());
} }
/** /**

View File

@@ -1,13 +1,10 @@
package com.schisandra.auth.infra.basic.service.impl; package com.schisandra.auth.infra.basic.service.impl;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthRole;
import com.schisandra.auth.infra.basic.dao.SchisandraAuthRoleDao; import com.schisandra.auth.infra.basic.dao.SchisandraAuthRoleDao;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthRole;
import com.schisandra.auth.infra.basic.entity.table.SchisandraAuthRoleTableDef; import com.schisandra.auth.infra.basic.entity.table.SchisandraAuthRoleTableDef;
import com.schisandra.auth.infra.basic.service.SchisandraAuthRoleService; import com.schisandra.auth.infra.basic.service.SchisandraAuthRoleService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -32,32 +29,20 @@ public class SchisandraAuthRoleServiceImpl implements SchisandraAuthRoleService
*/ */
@Override @Override
public SchisandraAuthRole queryById(Long id) { public SchisandraAuthRole queryById(Long id) {
return this.schisandraAuthRoleDao.queryById(id); return this.schisandraAuthRoleDao.selectOneById(id);
} }
/**
* 分页查询
*
* @param schisandraAuthRole 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<SchisandraAuthRole> queryByPage(SchisandraAuthRole schisandraAuthRole, PageRequest pageRequest) {
long total = this.schisandraAuthRoleDao.count(schisandraAuthRole);
return new PageImpl<>(this.schisandraAuthRoleDao.queryAllByLimit(schisandraAuthRole, pageRequest), pageRequest, total);
}
/** /**
* 新增数据 * 新增数据
* *
* @param schisandraAuthRole 实例对象 * @param schisandraAuthRole 实例对象
* @return 实例对象 * @return int
*/ */
@Override @Override
public SchisandraAuthRole insert(SchisandraAuthRole schisandraAuthRole) { public int insert(SchisandraAuthRole schisandraAuthRole) {
this.schisandraAuthRoleDao.insert(schisandraAuthRole); return this.schisandraAuthRoleDao.insert(schisandraAuthRole);
return schisandraAuthRole;
} }
/** /**

View File

@@ -1,12 +1,10 @@
package com.schisandra.auth.infra.basic.service.impl; package com.schisandra.auth.infra.basic.service.impl;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import com.schisandra.auth.infra.basic.dao.SchisandraSmsConfigDao; import com.schisandra.auth.infra.basic.dao.SchisandraSmsConfigDao;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import com.schisandra.auth.infra.basic.entity.table.SchisandraSmsConfigTableDef;
import com.schisandra.auth.infra.basic.service.SchisandraSmsConfigService; import com.schisandra.auth.infra.basic.service.SchisandraSmsConfigService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@@ -30,21 +28,9 @@ public class SchisandraSmsConfigServiceImpl implements SchisandraSmsConfigServic
*/ */
@Override @Override
public SchisandraSmsConfig queryById(Integer id) { public SchisandraSmsConfig queryById(Integer id) {
return this.schisandraSmsConfigDao.queryById(id); return this.schisandraSmsConfigDao.selectOneById(id);
} }
/**
* 分页查询
*
* @param schisandraSmsConfig 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<SchisandraSmsConfig> queryByPage(SchisandraSmsConfig schisandraSmsConfig, PageRequest pageRequest) {
long total = this.schisandraSmsConfigDao.count(schisandraSmsConfig);
return new PageImpl<>(this.schisandraSmsConfigDao.queryAllByLimit(schisandraSmsConfig, pageRequest), pageRequest, total);
}
/** /**
* 新增数据 * 新增数据
@@ -53,9 +39,9 @@ public class SchisandraSmsConfigServiceImpl implements SchisandraSmsConfigServic
* @return 实例对象 * @return 实例对象
*/ */
@Override @Override
public SchisandraSmsConfig insert(SchisandraSmsConfig schisandraSmsConfig) { public int insert(SchisandraSmsConfig schisandraSmsConfig) {
this.schisandraSmsConfigDao.insert(schisandraSmsConfig); return schisandraSmsConfigDao.insert(schisandraSmsConfig,true);
return schisandraSmsConfig;
} }
/** /**
@@ -81,13 +67,8 @@ public class SchisandraSmsConfigServiceImpl implements SchisandraSmsConfigServic
return this.schisandraSmsConfigDao.deleteById(id) > 0; return this.schisandraSmsConfigDao.deleteById(id) > 0;
} }
@Override
public List<SchisandraSmsConfig> queryAll() {
return schisandraSmsConfigDao.queryAll();
}
@Override @Override
public SchisandraSmsConfig queryByConfigId(String configId) { public SchisandraSmsConfig queryByConfigId(String configId) {
return schisandraSmsConfigDao.queryByConfigId(configId); return schisandraSmsConfigDao.selectOneByCondition(SchisandraSmsConfigTableDef.SCHISANDRA_SMS_CONFIG.CONFIG_ID.eq(configId));
} }
} }

View File

@@ -19,139 +19,6 @@
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/> <result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SchisandraAuthPermissionMap">
select id,`name`,parent_id,`type`,menu_url,`status`,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted
from schisandra_auth_permission
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SchisandraAuthPermissionMap">
select
id,name,parent_id,`type`,menu_url,`status`,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted
from schisandra_auth_permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and `name` = #{name}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="type != null">
and `type` = #{type}
</if>
<if test="menuUrl != null and menuUrl != ''">
and menu_url = #{menuUrl}
</if>
<if test="status != null">
and `status` = #{status}
</if>
<if test="show != null">
and `show` = #{show}
</if>
<if test="icon != null and icon != ''">
and icon = #{icon}
</if>
<if test="permissionKey != null and permissionKey != ''">
and permission_key = #{permissionKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from schisandra_auth_permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and `name` = #{name}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="type != null">
and `type` = #{type}
</if>
<if test="menuUrl != null and menuUrl != ''">
and menu_url = #{menuUrl}
</if>
<if test="status != null">
and `status` = #{status}
</if>
<if test="show != null">
and `show` = #{show}
</if>
<if test="icon != null and icon != ''">
and `icon` = #{icon}
</if>
<if test="permissionKey != null and permissionKey != ''">
and permission_key = #{permissionKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
schisandra_auth_permission(`name`,parent_id,`type`,menu_url,`status`,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name},#{entity.parentId},#{entity.type},#{entity.menuUrl},#{entity.status},#{entity.show},#{entity.icon},#{entity.permissionKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
schisandra_auth_permission(`name`,parent_id,`type`,menu_url,`status`,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name},#{entity.parentId},#{entity.type},#{entity.menuUrl},#{entity.status},#{entity.show},#{entity.icon},#{entity.permissionKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
name = values(name)parent_id = values(parent_id)type = values(type)menu_url = values(menu_url)status =
values(status)show = values(show)icon = values(icon)permission_key = values(permission_key)created_by =
values(created_by)created_time = values(created_time)update_by = values(update_by)update_time =
values(update_time)is_deleted = values(is_deleted)
</insert>
</mapper> </mapper>

View File

@@ -13,100 +13,5 @@
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/> <result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SchisandraAuthRoleMap">
select id,role_name,role_key,created_by,created_time,update_by,update_time,is_deleted
from schisandra_auth_role
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SchisandraAuthRoleMap">
select
id,role_name,role_key,created_by,created_time,update_by,update_time,is_deleted
from schisandra_auth_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleName != null and roleName != ''">
and role_name = #{roleName}
</if>
<if test="roleKey != null and roleKey != ''">
and role_key = #{roleKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from schisandra_auth_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleName != null and roleName != ''">
and role_name = #{roleName}
</if>
<if test="roleKey != null and roleKey != ''">
and role_key = #{roleKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_auth_role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleName},#{entity.roleKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_auth_role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleName},#{entity.roleKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
role_name = values(role_name)role_key = values(role_key)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
</mapper> </mapper>

View File

@@ -48,482 +48,5 @@
<result property="service" column="service" jdbcType="VARCHAR"/> <result property="service" column="service" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SchisandraSmsConfigMap">
select id,config_id,request_url,template_name,`action`,region,access_key_id,access_key_secret,supplier,signature,sdk_app_id,template_id,weight,retry_interval,max_retries,maximum,base_url,server_ip,server_port,sender,status_call_back,url,template_url,code_url,verify_url,need_up,conn_timeout,is_simple,callback_url,mch_id,app_key,app_id,version,single_msg_url,mass_msg_url,signature_Id,created_by,created_time,update_time,update_by,is_deleted,extra_json,service
from schisandra_sms_config
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SchisandraSmsConfigMap">
select
id,config_id,request_url,template_name,`action`,region,access_key_id,access_key_secret,supplier,signature,sdk_app_id,template_id,weight,retry_interval,max_retries,maximum,base_url,server_ip,server_port,sender,status_call_back,url,template_url,code_url,verify_url,need_up,conn_timeout,is_simple,callback_url,mch_id,app_key,app_id,version,single_msg_url,mass_msg_url,signature_Id,created_by,created_time,update_time,update_by,is_deleted,extra_json,service
from schisandra_sms_config
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="configId != null and configId != ''">
and config_id = #{configId}
</if>
<if test="requestUrl != null and requestUrl != ''">
and request_url = #{requestUrl}
</if>
<if test="templateName != null and templateName != ''">
and template_name = #{templateName}
</if>
<if test="action != null and action != ''">
and `action` = #{action}
</if>
<if test="region != null and region != ''">
and region = #{region}
</if>
<if test="accessKeyId != null and accessKeyId != ''">
and access_key_id = #{accessKeyId}
</if>
<if test="accessKeySecret != null and accessKeySecret != ''">
and access_key_secret = #{accessKeySecret}
</if>
<if test="supplier != null and supplier != ''">
and supplier = #{supplier}
</if>
<if test="signature != null and signature != ''">
and signature = #{signature}
</if>
<if test="sdkAppId != null and sdkAppId != ''">
and sdk_app_id = #{sdkAppId}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="weight != null">
and weight = #{weight}
</if>
<if test="retryInterval != null">
and retry_interval = #{retryInterval}
</if>
<if test="maxRetries != null">
and max_retries = #{maxRetries}
</if>
<if test="maximum != null">
and maximum = #{maximum}
</if>
<if test="baseUrl != null and baseUrl != ''">
and base_url = #{baseUrl}
</if>
<if test="serverIp != null and serverIp != ''">
and server_ip = #{serverIp}
</if>
<if test="serverPort != null">
and server_port = #{serverPort}
</if>
<if test="sender != null and sender != ''">
and sender = #{sender}
</if>
<if test="statusCallBack != null and statusCallBack != ''">
and status_call_back = #{statusCallBack}
</if>
<if test="url != null and url != ''">
and url = #{url}
</if>
<if test="templateUrl != null and templateUrl != ''">
and template_url = #{templateUrl}
</if>
<if test="codeUrl != null and codeUrl != ''">
and code_url = #{codeUrl}
</if>
<if test="verifyUrl != null and verifyUrl != ''">
and verify_url = #{verifyUrl}
</if>
<if test="needUp != null and needUp != ''">
and need_up = #{needUp}
</if>
<if test="connTimeout != null">
and conn_timeout = #{connTimeout}
</if>
<if test="isSimple != null and isSimple != ''">
and is_simple = #{isSimple}
</if>
<if test="callbackUrl != null and callbackUrl != ''">
and callback_url = #{callbackUrl}
</if>
<if test="mchId != null">
and mch_id = #{mchId}
</if>
<if test="appKey != null and appKey != ''">
and app_key = #{appKey}
</if>
<if test="appId != null">
and app_id = #{appId}
</if>
<if test="version != null and version != ''">
and version = #{version}
</if>
<if test="singleMsgUrl != null and singleMsgUrl != ''">
and single_msg_url = #{singleMsgUrl}
</if>
<if test="massMsgUrl != null and massMsgUrl != ''">
and mass_msg_url = #{massMsgUrl}
</if>
<if test="signatureId != null and signatureId != ''">
and signature_Id = #{signatureId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
<if test="extraJson != null and extraJson != ''">
and extra_json = #{extraJson}
</if>
<if test="service != null and service != ''">
and service = #{service}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from schisandra_sms_config
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="configId != null and configId != ''">
and config_id = #{configId}
</if>
<if test="requestUrl != null and requestUrl != ''">
and request_url = #{requestUrl}
</if>
<if test="templateName != null and templateName != ''">
and template_name = #{templateName}
</if>
<if test="action != null and action != ''">
and action = #{action}
</if>
<if test="region != null and region != ''">
and region = #{region}
</if>
<if test="accessKeyId != null and accessKeyId != ''">
and access_key_id = #{accessKeyId}
</if>
<if test="accessKeySecret != null and accessKeySecret != ''">
and access_key_secret = #{accessKeySecret}
</if>
<if test="supplier != null and supplier != ''">
and supplier = #{supplier}
</if>
<if test="signature != null and signature != ''">
and signature = #{signature}
</if>
<if test="sdkAppId != null and sdkAppId != ''">
and sdk_app_id = #{sdkAppId}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="weight != null">
and weight = #{weight}
</if>
<if test="retryInterval != null">
and retry_interval = #{retryInterval}
</if>
<if test="maxRetries != null">
and max_retries = #{maxRetries}
</if>
<if test="maximum != null">
and maximum = #{maximum}
</if>
<if test="baseUrl != null and baseUrl != ''">
and base_url = #{baseUrl}
</if>
<if test="serverIp != null and serverIp != ''">
and server_ip = #{serverIp}
</if>
<if test="serverPort != null">
and server_port = #{serverPort}
</if>
<if test="sender != null and sender != ''">
and sender = #{sender}
</if>
<if test="statusCallBack != null and statusCallBack != ''">
and status_call_back = #{statusCallBack}
</if>
<if test="url != null and url != ''">
and url = #{url}
</if>
<if test="templateUrl != null and templateUrl != ''">
and template_url = #{templateUrl}
</if>
<if test="codeUrl != null and codeUrl != ''">
and code_url = #{codeUrl}
</if>
<if test="verifyUrl != null and verifyUrl != ''">
and verify_url = #{verifyUrl}
</if>
<if test="needUp != null and needUp != ''">
and need_up = #{needUp}
</if>
<if test="connTimeout != null">
and conn_timeout = #{connTimeout}
</if>
<if test="isSimple != null and isSimple != ''">
and is_simple = #{isSimple}
</if>
<if test="callbackUrl != null and callbackUrl != ''">
and callback_url = #{callbackUrl}
</if>
<if test="mchId != null">
and mch_id = #{mchId}
</if>
<if test="appKey != null and appKey != ''">
and app_key = #{appKey}
</if>
<if test="appId != null">
and app_id = #{appId}
</if>
<if test="version != null and version != ''">
and version = #{version}
</if>
<if test="singleMsgUrl != null and singleMsgUrl != ''">
and single_msg_url = #{singleMsgUrl}
</if>
<if test="massMsgUrl != null and massMsgUrl != ''">
and mass_msg_url = #{massMsgUrl}
</if>
<if test="signatureId != null and signatureId != ''">
and signature_Id = #{signatureId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
<if test="extraJson != null and extraJson != ''">
and extra_json = #{extraJson}
</if>
<if test="service != null and service != ''">
and service = #{service}
</if>
</where>
</select>
<select id="queryAll" resultMap="SchisandraSmsConfigMap">
select *
from schisandra_sms_config
where is_deleted = 0
</select>
<select id="queryByConfigId" resultMap="SchisandraSmsConfigMap">
select *
from schisandra_sms_config
where config_id = #{configId}
and is_deleted = 0
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_sms_config(config_id,request_url,template_name,action,region,access_key_id,access_key_secret,supplier,signature,sdk_app_id,template_id,weight,retry_interval,max_retries,maximum,base_url,server_ip,server_port,sender,status_call_back,url,template_url,code_url,verify_url,need_up,conn_timeout,is_simple,callback_url,mch_id,app_key,app_id,version,single_msg_url,mass_msg_url,signature_Id,created_by,created_time,update_time,update_by,is_deleted,extra_json,service
)
values (#{configId},#{requestUrl},#{templateName},#{action},#{region},#{accessKeyId},#{accessKeySecret},#{supplier},#{signature},#{sdkAppId},#{templateId},#{weight},#{retryInterval},#{maxRetries},#{maximum},#{baseUrl},#{serverIp},#{serverPort},#{sender},#{statusCallBack},#{url},#{templateUrl},#{codeUrl},#{verifyUrl},#{needUp},#{connTimeout},#{isSimple},#{callbackUrl},#{mchId},#{appKey},#{appId},#{version},#{singleMsgUrl},#{massMsgUrl},#{signatureId},#{createdBy},#{createdTime},#{updateTime},#{updateBy},#{isDeleted},#{extraJson},#{service})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
schisandra_sms_config(config_id,request_url,template_name,action,region,access_key_id,access_key_secret,supplier,signature,sdk_app_id,template_id,weight,retry_interval,max_retries,maximum,base_url,server_ip,server_port,sender,status_call_back,url,template_url,code_url,verify_url,need_up,conn_timeout,is_simple,callback_url,mch_id,app_key,app_id,version,single_msg_url,mass_msg_url,signature_Id,created_by,created_time,update_time,update_by,is_deleted,extra_json,service
)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.configId},#{entity.requestUrl},#{entity.templateName},#{entity.action},#{entity.region},#{entity.accessKeyId},#{entity.accessKeySecret},#{entity.supplier},#{entity.signature},#{entity.sdkAppId},#{entity.templateId},#{entity.weight},#{entity.retryInterval},#{entity.maxRetries},#{entity.maximum},#{entity.baseUrl},#{entity.serverIp},#{entity.serverPort},#{entity.sender},#{entity.statusCallBack},#{entity.url},#{entity.templateUrl},#{entity.codeUrl},#{entity.verifyUrl},#{entity.needUp},#{entity.connTimeout},#{entity.isSimple},#{entity.callbackUrl},#{entity.mchId},#{entity.appKey},#{entity.appId},#{entity.version},#{entity.singleMsgUrl},#{entity.massMsgUrl},#{entity.signatureId},#{entity.createdBy},#{entity.createdTime},#{entity.updateTime},#{entity.updateBy},#{entity.isDeleted},#{entity.extraJson},#{entity.service})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
schisandra_sms_config(config_id,request_url,template_name,action,region,access_key_id,access_key_secret,supplier,signature,sdk_app_id,template_id,weight,retry_interval,max_retries,maximum,base_url,server_ip,server_port,sender,status_call_back,url,template_url,code_url,verify_url,need_up,conn_timeout,is_simple,callback_url,mch_id,app_key,app_id,version,single_msg_url,mass_msg_url,signature_Id,created_by,created_time,update_time,update_by,is_deleted,extra_json,service
)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.configId},#{entity.requestUrl},#{entity.templateName},#{entity.action},#{entity.region},#{entity.accessKeyId},#{entity.accessKeySecret},#{entity.supplier},#{entity.signature},#{entity.sdkAppId},#{entity.templateId},#{entity.weight},#{entity.retryInterval},#{entity.maxRetries},#{entity.maximum},#{entity.baseUrl},#{entity.serverIp},#{entity.serverPort},#{entity.sender},#{entity.statusCallBack},#{entity.url},#{entity.templateUrl},#{entity.codeUrl},#{entity.verifyUrl},#{entity.needUp},#{entity.connTimeout},#{entity.isSimple},#{entity.callbackUrl},#{entity.mchId},#{entity.appKey},#{entity.appId},#{entity.version},#{entity.singleMsgUrl},#{entity.massMsgUrl},#{entity.signatureId},#{entity.createdBy},#{entity.createdTime},#{entity.updateTime},#{entity.updateBy},#{entity.isDeleted},#{entity.extraJson},#{entity.service})
</foreach>
on duplicate key update
config_id = values(config_id)request_url = values(request_url)template_name = values(template_name)action =
values(action)region = values(region)access_key_id = values(access_key_id)access_key_secret =
values(access_key_secret)supplier = values(supplier)signature = values(signature)sdk_app_id =
values(sdk_app_id)template_id = values(template_id)weight = values(weight)retry_interval =
values(retry_interval)max_retries = values(max_retries)maximum = values(maximum)base_url =
values(base_url)server_ip = values(server_ip)server_port = values(server_port)sender =
values(sender)status_call_back = values(status_call_back)url = values(url)template_url =
values(template_url)code_url = values(code_url)verify_url = values(verify_url)need_up =
values(need_up)conn_timeout = values(conn_timeout)is_simple = values(is_simple)callback_url =
values(callback_url)mch_id = values(mch_id)app_key = values(app_key)app_id = values(app_id)version =
values(version)single_msg_url = values(single_msg_url)mass_msg_url = values(mass_msg_url)signature_Id =
values(signature_Id)created_by = values(created_by)created_time = values(created_time)update_time =
values(update_time)update_by = values(update_by)is_deleted = values(is_deleted)extra_json =
values(extra_json)service = values(service)
</insert>
<!--通过主键修改数据-->
<update id="update">
update schisandra_sms_config
<set>
<if test="configId != null and configId != ''">
config_id = #{configId},
</if>
<if test="requestUrl != null and requestUrl != ''">
request_url = #{requestUrl},
</if>
<if test="templateName != null and templateName != ''">
template_name = #{templateName},
</if>
<if test="action != null and action != ''">
action = #{action},
</if>
<if test="region != null and region != ''">
region = #{region},
</if>
<if test="accessKeyId != null and accessKeyId != ''">
access_key_id = #{accessKeyId},
</if>
<if test="accessKeySecret != null and accessKeySecret != ''">
access_key_secret = #{accessKeySecret},
</if>
<if test="supplier != null and supplier != ''">
supplier = #{supplier},
</if>
<if test="signature != null and signature != ''">
signature = #{signature},
</if>
<if test="sdkAppId != null and sdkAppId != ''">
sdk_app_id = #{sdkAppId},
</if>
<if test="templateId != null and templateId != ''">
template_id = #{templateId},
</if>
<if test="weight != null">
weight = #{weight},
</if>
<if test="retryInterval != null">
retry_interval = #{retryInterval},
</if>
<if test="maxRetries != null">
max_retries = #{maxRetries},
</if>
<if test="maximum != null">
maximum = #{maximum},
</if>
<if test="baseUrl != null and baseUrl != ''">
base_url = #{baseUrl},
</if>
<if test="serverIp != null and serverIp != ''">
server_ip = #{serverIp},
</if>
<if test="serverPort != null">
server_port = #{serverPort},
</if>
<if test="sender != null and sender != ''">
sender = #{sender},
</if>
<if test="statusCallBack != null and statusCallBack != ''">
status_call_back = #{statusCallBack},
</if>
<if test="url != null and url != ''">
url = #{url},
</if>
<if test="templateUrl != null and templateUrl != ''">
template_url = #{templateUrl},
</if>
<if test="codeUrl != null and codeUrl != ''">
code_url = #{codeUrl},
</if>
<if test="verifyUrl != null and verifyUrl != ''">
verify_url = #{verifyUrl},
</if>
<if test="needUp != null and needUp != ''">
need_up = #{needUp},
</if>
<if test="connTimeout != null">
conn_timeout = #{connTimeout},
</if>
<if test="isSimple != null and isSimple != ''">
is_simple = #{isSimple},
</if>
<if test="callbackUrl != null and callbackUrl != ''">
callback_url = #{callbackUrl},
</if>
<if test="mchId != null">
mch_id = #{mchId},
</if>
<if test="appKey != null and appKey != ''">
app_key = #{appKey},
</if>
<if test="appId != null">
app_id = #{appId},
</if>
<if test="version != null and version != ''">
version = #{version},
</if>
<if test="singleMsgUrl != null and singleMsgUrl != ''">
single_msg_url = #{singleMsgUrl},
</if>
<if test="massMsgUrl != null and massMsgUrl != ''">
mass_msg_url = #{massMsgUrl},
</if>
<if test="signatureId != null and signatureId != ''">
signature_Id = #{signatureId},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
<if test="extraJson != null and extraJson != ''">
extra_json = #{extraJson},
</if>
<if test="service != null and service != ''">
service = #{service},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from schisandra_sms_config
where id = #{id}
</delete>
</mapper> </mapper>

View File

@@ -29,7 +29,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
public Mono<Void> handle(ServerWebExchange serverWebExchange, Throwable throwable) { public Mono<Void> handle(ServerWebExchange serverWebExchange, Throwable throwable) {
ServerHttpRequest request = serverWebExchange.getRequest(); ServerHttpRequest request = serverWebExchange.getRequest();
ServerHttpResponse response = serverWebExchange.getResponse(); ServerHttpResponse response = serverWebExchange.getResponse();
Integer code=200; int code=200;
String message=""; String message="";
if(throwable instanceof SaTokenException){ if(throwable instanceof SaTokenException){
code=401; code=401;