feat: 短信验证模块

This commit is contained in:
zlg
2024-05-08 23:08:29 +08:00
parent 14cfec6f3d
commit c0075ef88a
18 changed files with 1507 additions and 154 deletions

View File

@@ -0,0 +1,32 @@
package com.schisandra.auth.application.config;
import com.schisandra.auth.application.convert.SchisandraSmsConfigDTOConvert;
import com.schisandra.auth.application.dto.SchisandraSmsConfigDTO;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.domain.service.SchisandraSmsConfigDomainService;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import javax.annotation.Resource;
import java.util.List;
@Configuration
public class SmsInitConfig {
@Resource
SmsReadConfig smsReadConfig;
@Resource
SchisandraSmsConfigDomainService schisandraSmsConfigDomainService;
@EventListener
public void init(ContextRefreshedEvent event){
List<SchisandraSmsConfigBO> SchisandraSmsConfigBOs= schisandraSmsConfigDomainService.queryAll();
List<SchisandraSmsConfigDTO> schisandraSmsConfigDTOS = SchisandraSmsConfigDTOConvert.INSTANCE.convertBOToDTOList(SchisandraSmsConfigBOs);
for (SchisandraSmsConfigDTO schisandraSmsConfig : schisandraSmsConfigDTOS){
System.out.println(schisandraSmsConfig.toString());
if (schisandraSmsConfig!=null){
// 创建SmsBlend 短信实例
SmsFactory.createSmsBlend(smsReadConfig);
};
}}
}

View File

@@ -0,0 +1,89 @@
package com.schisandra.auth.application.config;
import com.schisandra.auth.application.convert.SchisandraSmsConfigDTOConvert;
import com.schisandra.auth.application.dto.SchisandraSmsConfigDTO;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.domain.service.SchisandraSmsConfigDomainService;
import com.schisandra.auth.infra.basic.dao.SchisandraSmsConfigDao;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.dromara.sms4j.aliyun.config.AlibabaConfig;
import org.dromara.sms4j.huawei.config.HuaweiConfig;
import org.dromara.sms4j.provider.config.BaseConfig;
import org.dromara.sms4j.tencent.config.TencentConfig;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Classname SmsConfig
* @BelongsProject: schisandra-cloud-storage
* @BelongsPackage: com.schisandra.auth.common.config
* @Author: landaiqing
* @CreateTime: 2024-05-08 18:46
* @Description: TODO
* @Version: 1.0
*/
@Component
public class SmsReadConfig implements org.dromara.sms4j.core.datainterface.SmsReadConfig {
@Resource
SchisandraSmsConfigDomainService schisandraSmsConfigDomainService;
@Override
public BaseConfig getSupplierConfig(String configId) {
return null;
}
@Override
public List<BaseConfig> getSupplierConfigList() {
List<BaseConfig> configs = new ArrayList<>();
List<SchisandraSmsConfigBO> SchisandraSmsConfigBOs= schisandraSmsConfigDomainService.queryAll();
List<SchisandraSmsConfigDTO> schisandraSmsConfigDTOS = SchisandraSmsConfigDTOConvert.INSTANCE.convertBOToDTOList(SchisandraSmsConfigBOs);
for (SchisandraSmsConfigDTO schisandraSmsConfig : schisandraSmsConfigDTOS){
if ("alibaba".equals(schisandraSmsConfig.getConfigId())) {
AlibabaConfig alibabaConfig = new AlibabaConfig();
alibabaConfig.setConfigId(schisandraSmsConfig.getConfigId());
alibabaConfig.setRequestUrl(schisandraSmsConfig.getRequestUrl());
alibabaConfig.setAccessKeyId(schisandraSmsConfig.getAccessKeyId());
alibabaConfig.setAccessKeySecret(schisandraSmsConfig.getAccessKeySecret());
alibabaConfig.setSignature(schisandraSmsConfig.getSignature());
alibabaConfig.setTemplateId(schisandraSmsConfig.getTemplateId());
alibabaConfig.setTemplateName(schisandraSmsConfig.getTemplateName());
alibabaConfig.setSdkAppId(schisandraSmsConfig.getSdkAppId());
configs.add(alibabaConfig);
}
if ("tencent".equals(schisandraSmsConfig.getConfigId())) {
TencentConfig tencentConfig=new TencentConfig();
tencentConfig.setConfigId(schisandraSmsConfig.getConfigId());
tencentConfig.setAccessKeyId(schisandraSmsConfig.getAccessKeyId());
tencentConfig.setAccessKeySecret(schisandraSmsConfig.getAccessKeySecret());
tencentConfig.setSdkAppId(schisandraSmsConfig.getSdkAppId());
tencentConfig.setService(schisandraSmsConfig.getSdkAppId());
tencentConfig.setRequestUrl(schisandraSmsConfig.getRequestUrl());
tencentConfig.setTerritory(schisandraSmsConfig.getRegion());
tencentConfig.setAction(schisandraSmsConfig.getAction());
tencentConfig.setSignature(schisandraSmsConfig.getSignature());
tencentConfig.setTemplateId(schisandraSmsConfig.getTemplateId());
tencentConfig.setVersion(schisandraSmsConfig.getVersion());
tencentConfig.setConnTimeout(schisandraSmsConfig.getConnTimeout());
tencentConfig.setSdkAppId(schisandraSmsConfig.getSdkAppId());
configs.add(tencentConfig);
}
if ("huawei".equals(schisandraSmsConfig.getConfigId())) {
HuaweiConfig huaweiConfig = new HuaweiConfig();
huaweiConfig.setConfigId(schisandraSmsConfig.getConfigId());
huaweiConfig.setSdkAppId(schisandraSmsConfig.getSdkAppId());
huaweiConfig.setAccessKeySecret(schisandraSmsConfig.getAccessKeySecret());
huaweiConfig.setAccessKeyId(schisandraSmsConfig.getAccessKeyId());
huaweiConfig.setUrl(schisandraSmsConfig.getUrl());
huaweiConfig.setSignature(schisandraSmsConfig.getSignature());
huaweiConfig.setTemplateId(schisandraSmsConfig.getTemplateId());
configs.add(huaweiConfig);
}}
return configs;
}
}

View File

@@ -1,46 +1,51 @@
package com.schisandra.auth.application.controller; package com.schisandra.auth.application.controller;
import com.schisandra.auth.common.utils.RedisUtils; import com.schisandra.auth.common.entity.Result;
import com.schisandra.auth.common.redis.RedisUtil;
import com.schisandra.auth.common.utils.SmsCodeUtils; import com.schisandra.auth.common.utils.SmsCodeUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.sms4j.api.SmsBlend;
import org.dromara.sms4j.api.entity.SmsResponse; import org.dromara.sms4j.api.entity.SmsResponse;
import org.dromara.sms4j.core.factory.SmsFactory; import org.dromara.sms4j.core.factory.SmsFactory;
import org.dromara.sms4j.provider.enumerate.SupplierType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.LinkedHashMap; import javax.annotation.Resource;
import static java.util.concurrent.TimeUnit.SECONDS;
@RestController @RestController
@RequestMapping("/sms/") @RequestMapping("/sms/")
@Slf4j @Slf4j
public class SmsController { public class SmsController {
@Autowired @Resource
private RedisUtils redisUtils; private RedisUtil redisUtil;
private final SmsBlend aliSms = SmsFactory.createSmsBlend(SupplierType.ALIBABA);
@GetMapping("/send")
public SmsResponse send(String phone, String templateId) {
return aliSms.sendMessage(phone, templateId, new LinkedHashMap<>());
}
private final String authPhonePrefix="auth.phone";
/**
* @description: 发送短信验证码
* @param: [phone]
* @return: com.schisandra.auth.common.entity.Result
* @author zlg
* @date: 2024/5/8 22:53
*/
@GetMapping("/sendByTemplate") @GetMapping("/sendByTemplate")
public SmsResponse sendByTemplate(String phone) { public Result sendByTemplate(String phone) {
// SmsBlend smsBlend = SmsFactory.getSmsBlend("alibaba"); String prefix = redisUtil.buildKey(authPhonePrefix, phone);
String code = SmsCodeUtils.generateValidateCode(4).toString(); String code = SmsCodeUtils.generateValidateCode(4).toString();
// redisUtils.cacheValue( phone, code, 60); if (!redisUtil.exist(prefix)){
SmsResponse smsResponse=SmsFactory.getBySupplier("alibaba").sendMessage(phone,code);
SmsResponse smsResponse=aliSms.sendMessage(phone, code);
if (smsResponse.isSuccess()){ if (smsResponse.isSuccess()){
redisUtils.cacheValue( phone, code, 60); redisUtil.setNx(prefix, code, 60L,SECONDS);
return smsResponse; return Result.ok();
}else { }else {
return smsResponse; return Result.fail();
} }
}else {
return Result.fail("发送频繁,请稍后重试");
}
} }
} }

View File

@@ -0,0 +1,43 @@
package com.schisandra.auth.application.convert;
import com.schisandra.auth.application.dto.SchisandraSmsConfigDTO;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* (SchisandraSmsConfig)实体类
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
@Mapper(componentModel = "spring")
public interface SchisandraSmsConfigDTOConvert {
SchisandraSmsConfigDTOConvert INSTANCE = Mappers.getMapper(SchisandraSmsConfigDTOConvert.class);
/**
* @description 将bo转换为实体
* @param schisandraSmsConfigDTO
* @return com.schisandra.auth.infra.basic.entity.SchisandraAuthUser
* @author landaiqing
* @date 2024/3/21 23:13
*/
SchisandraSmsConfigBO convertDTOToBO(SchisandraSmsConfigDTO schisandraSmsConfigDTO);
/**
* @description 将实体转换为bo
* @param schisandraSmsConfigBO
* @return com.schisandra.auth.domain.bo.SchisandraAuthUserBO
* @author landaiqing
* @date 2024/3/21 23:13
*/
SchisandraSmsConfigDTO convertBOToDTO(SchisandraSmsConfigBO schisandraSmsConfigBO);
List<SchisandraSmsConfigDTO> convertBOToDTOList(List<SchisandraSmsConfigBO> schisandraSmsConfigBO);
}

View File

@@ -0,0 +1,155 @@
package com.schisandra.auth.application.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* (SchisandraSmsConfig)实体类
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
@Data
public class SchisandraSmsConfigDTO implements Serializable {
/**
* id
*/
private Integer id;
/**
* 配置id
*/
private String configId;
/**
* 请求地址
*/
private String requestUrl;
/**
* 模板变量名称
*/
private String templateName;
/**
* 接口名称
*/
private String action;
/**
* 地域信息
*/
private String region;
private String accessKeyId;
private String accessKeySecret;
/**
* 厂商名称标识
*/
private String supplier;
/**
* 短信签名
*/
private String signature;
private String sdkAppId;
/**
* 模板ID
*/
private String templateId;
/**
* 权重
*/
private Integer weight;
/**
* 短信重试次数默认0次不重试
*/
private Integer retryInterval;
/**
* 短信重试次数默认0次不重试
*/
private Integer maxRetries;
/**
* 厂商的发送数量上限,默认不设置上限
*/
private Long maximum;
/**
* REST API Base URL
*/
private String baseUrl;
/**
* 请求域名
*/
private String serverIp;
/**
* 请求端口
*/
private Integer serverPort;
/**
* 国内短信签名通道号
*/
private String sender;
/**
* 短信状态报告接收地
*/
private String statusCallBack;
/**
* APP接入地址
*/
private String url;
/**
* 模板短信请求地址
*/
private String templateUrl;
/**
* 验证码短信请求地址
*/
private String codeUrl;
/**
* 验证码验证请求地址
*/
private String verifyUrl;
/**
* 是否需要支持短信上行。true:需要false:不需要false
*/
private String needUp;
/**
* 请求超时时间
*/
private Integer connTimeout;
/**
* 是否为简易模式
*/
private String isSimple;
/**
* 短信发送后将向这个地址推送(运营商返回的)发送报告
*/
private String callbackUrl;
/**
* 企业ID
*/
private Integer mchId;
private String appKey;
private Integer appId;
/**
* 版本号
*/
private String version;
/**
* 单发链接
*/
private String singleMsgUrl;
/**
* 群发链接
*/
private String massMsgUrl;
/**
* 签名ID
*/
private String signatureId;
}

View File

@@ -1,44 +0,0 @@
package com.schisandra.auth.common.config;
import org.dromara.sms4j.aliyun.config.AlibabaConfig;
import org.dromara.sms4j.core.datainterface.SmsReadConfig;
import org.dromara.sms4j.provider.config.BaseConfig;
import org.dromara.sms4j.unisms.config.UniConfig;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Classname SmsConfig
* @BelongsProject: schisandra-cloud-storage
* @BelongsPackage: com.schisandra.auth.common.config
* @Author: landaiqing
* @CreateTime: 2024-05-08 18:46
* @Description: TODO
* @Version: 1.0
*/
@Component
public class SmsConfig implements SmsReadConfig {
//这里的configId指的是框架在调用该接口方法时候会传递进来的参数用户可以根据此参数作为标准来动态的进行查询
@Override
public BaseConfig getSupplierConfig(String configId) {
AlibabaConfig alibabaConfig=new AlibabaConfig();
alibabaConfig.setConfigId("alibaba");
alibabaConfig.setRequestUrl("dysmsapi.aliyuncs.com");
alibabaConfig.setAccessKeyId("LTAI5tDy2edL9LhW43rnus69");
alibabaConfig.setAccessKeySecret("YWp44dcFrBICrjZgqvJBE7ZHArZfIP");
alibabaConfig.setSignature("阿里云短信测试");
alibabaConfig.setTemplateId("SMS_154950909");
alibabaConfig.setTemplateName("code");
alibabaConfig.setSdkAppId("sms");
return alibabaConfig;
}
@Override
public List<BaseConfig> getSupplierConfigList() {
//此处仅为示例,实际环境中,数据可以来自任意位置,
return null;
}
}

View File

@@ -1,86 +0,0 @@
package com.schisandra.auth.common.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* @author luft-mensch
*/
@Component
public class RedisUtils {
@Resource
private RedisTemplate<String,Object> redisTemplate;
private Logger logger = LoggerFactory.getLogger(this.getClass());
public boolean cacheValue(String key, Object value, long time) {
try {
ValueOperations<String, Object> valueOperations = redisTemplate.opsForValue();
valueOperations.set(key, value);
if (time > 0) {
// 如果有设置超时时间的话
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (Throwable e) {
logger.error("缓存[" + key + "]失败, value[" + value + "] " + e.getMessage());
}
return false;
}
public boolean cacheValue(String key, Object value) {
return cacheValue(key, value, -1);
}
public boolean containsKey(String key) {
try {
return redisTemplate.hasKey(key);
} catch (Throwable e) {
logger.error("判断缓存是否存在时失败key[" + key + "]", "err[" + e.getMessage() + "]");
}
return false;
}
public Object getValue(String key) {
try {
ValueOperations<String, Object> valueOperations = redisTemplate.opsForValue();
return valueOperations.get(key);
} catch (Throwable e) {
logger.error("获取缓存时失败key[" + key + "]", "err[" + e.getMessage() + "]");
}
return null;
}
public boolean removeValue(String key) {
try {
redisTemplate.delete(key);
return true;
} catch (Throwable e) {
logger.error("移除缓存时失败key[" + key + "]", "err[" + e.getMessage() + "]");
}
return false;
}
public boolean removeKeys(String pattern) {
try {
Set<String> keySet = redisTemplate.keys(pattern + "*");
redisTemplate.delete(keySet);
return true;
} catch (Throwable e) {
logger.error("移除key[" + pattern + "]前缀的缓存时失败", "err[" + e.getMessage() + "]");
}
return false;
}
}

View File

@@ -13,7 +13,8 @@ import java.util.Date;
* @since 2024-04-15 19:04:11 * @since 2024-04-15 19:04:11
*/ */
@Data @Data
public class SchisandraAuthPermissionBO implements Serializable { public class
SchisandraAuthPermissionBO implements Serializable {
private Long id; private Long id;

View File

@@ -0,0 +1,155 @@
package com.schisandra.auth.domain.bo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* (SchisandraSmsConfig)实体类
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
@Data
public class SchisandraSmsConfigBO implements Serializable {
/**
* id
*/
private Integer id;
/**
* 配置id
*/
private String configId;
/**
* 请求地址
*/
private String requestUrl;
/**
* 模板变量名称
*/
private String templateName;
/**
* 接口名称
*/
private String action;
/**
* 地域信息
*/
private String region;
private String accessKeyId;
private String accessKeySecret;
/**
* 厂商名称标识
*/
private String supplier;
/**
* 短信签名
*/
private String signature;
private String sdkAppId;
/**
* 模板ID
*/
private String templateId;
/**
* 权重
*/
private Integer weight;
/**
* 短信重试次数默认0次不重试
*/
private Integer retryInterval;
/**
* 短信重试次数默认0次不重试
*/
private Integer maxRetries;
/**
* 厂商的发送数量上限,默认不设置上限
*/
private Long maximum;
/**
* REST API Base URL
*/
private String baseUrl;
/**
* 请求域名
*/
private String serverIp;
/**
* 请求端口
*/
private Integer serverPort;
/**
* 国内短信签名通道号
*/
private String sender;
/**
* 短信状态报告接收地
*/
private String statusCallBack;
/**
* APP接入地址
*/
private String url;
/**
* 模板短信请求地址
*/
private String templateUrl;
/**
* 验证码短信请求地址
*/
private String codeUrl;
/**
* 验证码验证请求地址
*/
private String verifyUrl;
/**
* 是否需要支持短信上行。true:需要false:不需要false
*/
private String needUp;
/**
* 请求超时时间
*/
private Integer connTimeout;
/**
* 是否为简易模式
*/
private String isSimple;
/**
* 短信发送后将向这个地址推送(运营商返回的)发送报告
*/
private String callbackUrl;
/**
* 企业ID
*/
private Integer mchId;
private String appKey;
private Integer appId;
/**
* 版本号
*/
private String version;
/**
* 单发链接
*/
private String singleMsgUrl;
/**
* 群发链接
*/
private String massMsgUrl;
/**
* 签名ID
*/
private String signatureId;
}

View File

@@ -0,0 +1,48 @@
package com.schisandra.auth.domain.convert;
import com.schisandra.auth.domain.bo.SchisandraAuthUserBO;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthUser;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* (SchisandraSmsConfig)实体类
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
@Mapper(componentModel = "spring")
public interface SchisandraSmsConfigBOConvert {
SchisandraSmsConfigBOConvert INSTANCE = Mappers.getMapper(SchisandraSmsConfigBOConvert.class);
/**
* @description 将bo转换为实体
* @param schisandraSmsConfigBO
* @return com.schisandra.auth.infra.basic.entity.SchisandraAuthUser
* @author landaiqing
* @date 2024/3/21 23:13
*/
SchisandraSmsConfig convertBOToEntity(SchisandraSmsConfigBO schisandraSmsConfigBO);
/**
* @description 将实体转换为bo
* @param schisandraSmsConfig
* @return com.schisandra.auth.domain.bo.SchisandraAuthUserBO
* @author landaiqing
* @date 2024/3/21 23:13
*/
SchisandraSmsConfigBO convertEntityToBO(SchisandraSmsConfig schisandraSmsConfig);
List<SchisandraSmsConfigBO> convertEntityToBOList(List<SchisandraSmsConfig> schisandraSmsConfigs);
}

View File

@@ -0,0 +1,22 @@
package com.schisandra.auth.domain.service;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import java.util.List;
/**
* 用户领域service
*
* @author landaiqing
* @date 2024/3/21
*/
public interface SchisandraSmsConfigDomainService {
List<SchisandraSmsConfigBO> queryAll();
}

View File

@@ -0,0 +1,26 @@
package com.schisandra.auth.domain.service.impl;
import com.schisandra.auth.domain.bo.SchisandraSmsConfigBO;
import com.schisandra.auth.domain.convert.SchisandraSmsConfigBOConvert;
import com.schisandra.auth.domain.service.SchisandraSmsConfigDomainService;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import com.schisandra.auth.infra.basic.service.SchisandraSmsConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
public class SchisandraSmsConfigDomainServiceImpl implements SchisandraSmsConfigDomainService {
@Resource
private SchisandraSmsConfigService schisandraSmsConfigService;
@Override
public List<SchisandraSmsConfigBO> queryAll() {
List<SchisandraSmsConfig> schisandraSmsConfigs = schisandraSmsConfigService.queryAll();
return SchisandraSmsConfigBOConvert.INSTANCE.convertEntityToBOList(schisandraSmsConfigs);
}
}

View File

@@ -0,0 +1,86 @@
package com.schisandra.auth.infra.basic.dao;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* (SchisandraSmsConfig)表数据库访问层
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
public interface SchisandraSmsConfigDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraSmsConfig queryById(Integer id);
/**
* 查询指定行数据
*
* @param schisandraSmsConfig 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<SchisandraSmsConfig> queryAllByLimit(SchisandraSmsConfig schisandraSmsConfig, @Param("pageable") Pageable pageable);
List<SchisandraSmsConfig> queryAll();
/**
* 统计总行数
*
* @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);
}

View File

@@ -0,0 +1,174 @@
package com.schisandra.auth.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (SchisandraSmsConfig)实体类
*
* @author makejava
* @since 2024-05-08 20:09:54
*/
@Data
public class SchisandraSmsConfig implements Serializable {
/**
* id
*/
private Integer id;
/**
* 配置id
*/
private String configId;
/**
* 请求地址
*/
private String requestUrl;
/**
* 模板变量名称
*/
private String templateName;
/**
* 接口名称
*/
private String action;
/**
* 地域信息
*/
private String region;
private String accessKeyId;
private String accessKeySecret;
/**
* 厂商名称标识
*/
private String supplier;
/**
* 短信签名
*/
private String signature;
private String sdkAppId;
/**
* 模板ID
*/
private String templateId;
/**
* 权重
*/
private Integer weight;
/**
* 短信重试次数默认0次不重试
*/
private Integer retryInterval;
/**
* 短信重试次数默认0次不重试
*/
private Integer maxRetries;
/**
* 厂商的发送数量上限,默认不设置上限
*/
private Long maximum;
/**
* REST API Base URL
*/
private String baseUrl;
/**
* 请求域名
*/
private String serverIp;
/**
* 请求端口
*/
private Integer serverPort;
/**
* 国内短信签名通道号
*/
private String sender;
/**
* 短信状态报告接收地
*/
private String statusCallBack;
/**
* APP接入地址
*/
private String url;
/**
* 模板短信请求地址
*/
private String templateUrl;
/**
* 验证码短信请求地址
*/
private String codeUrl;
/**
* 验证码验证请求地址
*/
private String verifyUrl;
/**
* 是否需要支持短信上行。true:需要false:不需要false
*/
private String needUp;
/**
* 请求超时时间
*/
private Integer connTimeout;
/**
* 是否为简易模式
*/
private String isSimple;
/**
* 短信发送后将向这个地址推送(运营商返回的)发送报告
*/
private String callbackUrl;
/**
* 企业ID
*/
private Integer mchId;
private String appKey;
private Integer appId;
/**
* 版本号
*/
private String version;
/**
* 单发链接
*/
private String singleMsgUrl;
/**
* 群发链接
*/
private String massMsgUrl;
/**
* 签名ID
*/
private String signatureId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 是否删除 0 未删除 1已删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,60 @@
package com.schisandra.auth.infra.basic.service;
import com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* (SchisandraSmsConfig)表服务接口
*
* @author makejava
* @since 2024-05-08 20:09:55
*/
public interface SchisandraSmsConfigService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SchisandraSmsConfig queryById(Integer id);
List<SchisandraSmsConfig> queryAll();
/**
* 分页查询
*
* @param schisandraSmsConfig 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<SchisandraSmsConfig> queryByPage(SchisandraSmsConfig schisandraSmsConfig, PageRequest pageRequest);
/**
* 新增数据
*
* @param schisandraSmsConfig 实例对象
* @return 实例对象
*/
SchisandraSmsConfig insert(SchisandraSmsConfig schisandraSmsConfig);
/**
* 修改数据
*
* @param schisandraSmsConfig 实例对象
* @return 实例对象
*/
SchisandraSmsConfig update(SchisandraSmsConfig schisandraSmsConfig);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@@ -0,0 +1,88 @@
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.service.SchisandraSmsConfigService;
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 java.util.List;
/**
* (SchisandraSmsConfig)表服务实现类
*
* @author makejava
* @since 2024-05-08 20:09:55
*/
@Service("schisandraSmsConfigService")
public class SchisandraSmsConfigServiceImpl implements SchisandraSmsConfigService {
@Resource
private SchisandraSmsConfigDao schisandraSmsConfigDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SchisandraSmsConfig queryById(Integer id) {
return this.schisandraSmsConfigDao.queryById(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);
}
@Override
public List<SchisandraSmsConfig> queryAll() {
return this.schisandraSmsConfigDao.queryAll();
}
/**
* 新增数据
*
* @param schisandraSmsConfig 实例对象
* @return 实例对象
*/
@Override
public SchisandraSmsConfig insert(SchisandraSmsConfig schisandraSmsConfig) {
this.schisandraSmsConfigDao.insert(schisandraSmsConfig);
return schisandraSmsConfig;
}
/**
* 修改数据
*
* @param schisandraSmsConfig 实例对象
* @return 实例对象
*/
@Override
public SchisandraSmsConfig update(SchisandraSmsConfig schisandraSmsConfig) {
this.schisandraSmsConfigDao.update(schisandraSmsConfig);
return this.queryById(schisandraSmsConfig.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.schisandraSmsConfigDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,499 @@
<?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.auth.infra.basic.dao.SchisandraSmsConfigDao">
<resultMap type="com.schisandra.auth.infra.basic.entity.SchisandraSmsConfig" id="SchisandraSmsConfigMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="configId" column="config_id" jdbcType="VARCHAR"/>
<result property="requestUrl" column="request_url" jdbcType="VARCHAR"/>
<result property="templateName" column="template_name" jdbcType="VARCHAR"/>
<result property="action" column="action" jdbcType="VARCHAR"/>
<result property="region" column="region" jdbcType="VARCHAR"/>
<result property="accessKeyId" column="access_key_id" jdbcType="VARCHAR"/>
<result property="accessKeySecret" column="access_key_secret" jdbcType="VARCHAR"/>
<result property="supplier" column="supplier" jdbcType="VARCHAR"/>
<result property="signature" column="signature" jdbcType="VARCHAR"/>
<result property="sdkAppId" column="sdk_app_id" jdbcType="VARCHAR"/>
<result property="templateId" column="template_id" jdbcType="VARCHAR"/>
<result property="weight" column="weight" jdbcType="INTEGER"/>
<result property="retryInterval" column="retry_interval" jdbcType="INTEGER"/>
<result property="maxRetries" column="max_retries" jdbcType="INTEGER"/>
<result property="maximum" column="maximum" jdbcType="INTEGER"/>
<result property="baseUrl" column="base_url" jdbcType="VARCHAR"/>
<result property="serverIp" column="server_ip" jdbcType="VARCHAR"/>
<result property="serverPort" column="server_port" jdbcType="INTEGER"/>
<result property="sender" column="sender" jdbcType="VARCHAR"/>
<result property="statusCallBack" column="status_call_back" jdbcType="VARCHAR"/>
<result property="url" column="url" jdbcType="VARCHAR"/>
<result property="templateUrl" column="template_url" jdbcType="VARCHAR"/>
<result property="codeUrl" column="code_url" jdbcType="VARCHAR"/>
<result property="verifyUrl" column="verify_url" jdbcType="VARCHAR"/>
<result property="needUp" column="need_up" jdbcType="VARCHAR"/>
<result property="connTimeout" column="conn_timeout" jdbcType="INTEGER"/>
<result property="isSimple" column="is_simple" jdbcType="VARCHAR"/>
<result property="callbackUrl" column="callback_url" jdbcType="VARCHAR"/>
<result property="mchId" column="mch_id" jdbcType="INTEGER"/>
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="INTEGER"/>
<result property="version" column="version" jdbcType="VARCHAR"/>
<result property="singleMsgUrl" column="single_msg_url" jdbcType="VARCHAR"/>
<result property="massMsgUrl" column="mass_msg_url" jdbcType="VARCHAR"/>
<result property="signatureId" column="signature_Id" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</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
from schisandra_sms_config
where id = #{id}
</select>
<select id="queryAll" 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
from schisandra_sms_config
</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
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>
</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>
</where>
</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)
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})
</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)
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})
</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)
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})
</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)
</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>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from schisandra_sms_config
where id = #{id}
</delete>
</mapper>

View File

@@ -72,7 +72,7 @@ sa-token:
sms: sms:
# 标注从yml读取配置 # 标注从yml读取配置
config-type: interface config-type: yaml
restricted: true restricted: true
accountMax: 10 accountMax: 10
minuteMax: 1 minuteMax: 1