parent
cfd8254673
commit
f72c88eb30
7 changed files with 0 additions and 371 deletions
@ -1,82 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.entity; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName; |
|
||||||
import io.swagger.annotations.ApiModel; |
|
||||||
import io.swagger.annotations.ApiModelProperty; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.EqualsAndHashCode; |
|
||||||
import org.springblade.core.tenant.mp.TenantEntity; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表实体类 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@TableName("blade_sms") |
|
||||||
@EqualsAndHashCode(callSuper = true) |
|
||||||
@ApiModel(value = "Sms对象", description = "短信配置表") |
|
||||||
public class Sms extends TenantEntity { |
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L; |
|
||||||
|
|
||||||
/** |
|
||||||
* 资源编号 |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "资源编号") |
|
||||||
private String smsCode; |
|
||||||
|
|
||||||
/** |
|
||||||
* 模板ID |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "模板ID") |
|
||||||
private String templateId; |
|
||||||
/** |
|
||||||
* 分类 |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "分类") |
|
||||||
private Integer category; |
|
||||||
/** |
|
||||||
* accessKey |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "accessKey") |
|
||||||
private String accessKey; |
|
||||||
/** |
|
||||||
* secretKey |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "secretKey") |
|
||||||
private String secretKey; |
|
||||||
/** |
|
||||||
* regionId |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "regionId") |
|
||||||
private String regionId; |
|
||||||
/** |
|
||||||
* 短信签名 |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "短信签名") |
|
||||||
private String signName; |
|
||||||
/** |
|
||||||
* 备注 |
|
||||||
*/ |
|
||||||
@ApiModelProperty(value = "备注") |
|
||||||
private String remark; |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
@ -1,42 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.mapper; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import org.springblade.modules.resource.entity.Sms; |
|
||||||
import org.springblade.modules.resource.vo.SmsVO; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表 Mapper 接口 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
public interface SmsMapper extends BaseMapper<Sms> { |
|
||||||
|
|
||||||
/** |
|
||||||
* 自定义分页 |
|
||||||
* |
|
||||||
* @param page |
|
||||||
* @param sms |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
List<SmsVO> selectSmsPage(IPage page, SmsVO sms); |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,30 +0,0 @@ |
|||||||
<?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="org.springblade.modules.resource.mapper.SmsMapper"> |
|
||||||
|
|
||||||
<!-- 通用查询映射结果 --> |
|
||||||
<resultMap id="smsResultMap" type="org.springblade.modules.resource.entity.Sms"> |
|
||||||
<result column="id" property="id"/> |
|
||||||
<result column="create_user" property="createUser"/> |
|
||||||
<result column="create_dept" property="createDept"/> |
|
||||||
<result column="create_time" property="createTime"/> |
|
||||||
<result column="update_user" property="updateUser"/> |
|
||||||
<result column="update_time" property="updateTime"/> |
|
||||||
<result column="status" property="status"/> |
|
||||||
<result column="is_deleted" property="isDeleted"/> |
|
||||||
<result column="sms_code" property="smsCode"/> |
|
||||||
<result column="template_id" property="templateId"/> |
|
||||||
<result column="category" property="category"/> |
|
||||||
<result column="access_key" property="accessKey"/> |
|
||||||
<result column="secret_key" property="secretKey"/> |
|
||||||
<result column="region_id" property="regionId"/> |
|
||||||
<result column="sign_name" property="signName"/> |
|
||||||
<result column="remark" property="remark"/> |
|
||||||
</resultMap> |
|
||||||
|
|
||||||
|
|
||||||
<select id="selectSmsPage" resultMap="smsResultMap"> |
|
||||||
select * from blade_sms where is_deleted = 0 |
|
||||||
</select> |
|
||||||
|
|
||||||
</mapper> |
|
||||||
@ -1,56 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.service; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import org.springblade.core.mp.base.BaseService; |
|
||||||
import org.springblade.modules.resource.entity.Sms; |
|
||||||
import org.springblade.modules.resource.vo.SmsVO; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表 服务类 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
public interface ISmsService extends BaseService<Sms> { |
|
||||||
|
|
||||||
/** |
|
||||||
* 自定义分页 |
|
||||||
* |
|
||||||
* @param page |
|
||||||
* @param sms |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
IPage<SmsVO> selectSmsPage(IPage<SmsVO> page, SmsVO sms); |
|
||||||
|
|
||||||
/** |
|
||||||
* 提交oss信息 |
|
||||||
* |
|
||||||
* @param oss |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
boolean submit(Sms oss); |
|
||||||
|
|
||||||
/** |
|
||||||
* 启动配置 |
|
||||||
* |
|
||||||
* @param id |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
boolean enable(Long id); |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,67 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.service.impl; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
||||||
import org.springblade.core.log.exception.ServiceException; |
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl; |
|
||||||
import org.springblade.core.secure.utils.AuthUtil; |
|
||||||
import org.springblade.core.tool.utils.Func; |
|
||||||
import org.springblade.modules.resource.entity.Sms; |
|
||||||
import org.springblade.modules.resource.mapper.SmsMapper; |
|
||||||
import org.springblade.modules.resource.service.ISmsService; |
|
||||||
import org.springblade.modules.resource.vo.SmsVO; |
|
||||||
import org.springframework.stereotype.Service; |
|
||||||
import org.springframework.transaction.annotation.Transactional; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表 服务实现类 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
@Service |
|
||||||
public class SmsServiceImpl extends BaseServiceImpl<SmsMapper, Sms> implements ISmsService { |
|
||||||
|
|
||||||
@Override |
|
||||||
public IPage<SmsVO> selectSmsPage(IPage<SmsVO> page, SmsVO sms) { |
|
||||||
return page.setRecords(baseMapper.selectSmsPage(page, sms)); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean submit(Sms sms) { |
|
||||||
LambdaQueryWrapper<Sms> lqw = Wrappers.<Sms>query().lambda() |
|
||||||
.eq(Sms::getSmsCode, sms.getSmsCode()).eq(Sms::getTenantId, AuthUtil.getTenantId()); |
|
||||||
Long cnt = baseMapper.selectCount(Func.isEmpty(sms.getId()) ? lqw : lqw.notIn(Sms::getId, sms.getId())); |
|
||||||
if (cnt > 0L) { |
|
||||||
throw new ServiceException("当前资源编号已存在!"); |
|
||||||
} |
|
||||||
return this.saveOrUpdate(sms); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
@Transactional(rollbackFor = Exception.class) |
|
||||||
public boolean enable(Long id) { |
|
||||||
// 先禁用
|
|
||||||
boolean temp1 = this.update(Wrappers.<Sms>update().lambda().set(Sms::getStatus, 1)); |
|
||||||
// 在启用
|
|
||||||
boolean temp2 = this.update(Wrappers.<Sms>update().lambda().set(Sms::getStatus, 2).eq(Sms::getId, id)); |
|
||||||
return temp1 && temp2; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,45 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.vo; |
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel; |
|
||||||
import lombok.Data; |
|
||||||
import lombok.EqualsAndHashCode; |
|
||||||
import org.springblade.modules.resource.entity.Sms; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表视图实体类 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@EqualsAndHashCode(callSuper = true) |
|
||||||
@ApiModel(value = "SmsVO对象", description = "短信配置表") |
|
||||||
public class SmsVO extends Sms { |
|
||||||
private static final long serialVersionUID = 1L; |
|
||||||
|
|
||||||
/** |
|
||||||
* 分类名 |
|
||||||
*/ |
|
||||||
private String categoryName; |
|
||||||
|
|
||||||
/** |
|
||||||
* 是否启用 |
|
||||||
*/ |
|
||||||
private String statusName; |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,49 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are met: |
|
||||||
* |
|
||||||
* Redistributions of source code must retain the above copyright notice, |
|
||||||
* this list of conditions and the following disclaimer. |
|
||||||
* Redistributions in binary form must reproduce the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer in the |
|
||||||
* documentation and/or other materials provided with the distribution. |
|
||||||
* Neither the name of the dreamlu.net developer nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* Author: Chill 庄骞 (smallchill@163.com) |
|
||||||
*/ |
|
||||||
package org.springblade.modules.resource.wrapper; |
|
||||||
|
|
||||||
import org.springblade.common.cache.DictCache; |
|
||||||
import org.springblade.common.enums.DictEnum; |
|
||||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
|
||||||
import org.springblade.core.tool.utils.BeanUtil; |
|
||||||
import org.springblade.modules.resource.entity.Sms; |
|
||||||
import org.springblade.modules.resource.vo.SmsVO; |
|
||||||
|
|
||||||
import java.util.Objects; |
|
||||||
|
|
||||||
/** |
|
||||||
* 短信配置表包装类,返回视图层所需的字段 |
|
||||||
* |
|
||||||
* @author BladeX |
|
||||||
*/ |
|
||||||
public class SmsWrapper extends BaseEntityWrapper<Sms, SmsVO> { |
|
||||||
|
|
||||||
public static SmsWrapper build() { |
|
||||||
return new SmsWrapper(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public SmsVO entityVO(Sms sms) { |
|
||||||
SmsVO smsVO = Objects.requireNonNull(BeanUtil.copy(sms, SmsVO.class)); |
|
||||||
String categoryName = DictCache.getValue(DictEnum.SMS, sms.getCategory()); |
|
||||||
String statusName = DictCache.getValue(DictEnum.YES_NO, sms.getStatus()); |
|
||||||
smsVO.setCategoryName(categoryName); |
|
||||||
smsVO.setStatusName(statusName); |
|
||||||
return smsVO; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
Loading…
Reference in new issue