feat(sj_1.0.0): 新增通知人接口和更新通知人
This commit is contained in:
parent
b738133d58
commit
a8a6ecc475
@ -72,7 +72,6 @@ CREATE TABLE `sj_notify_recipient`
|
|||||||
(
|
(
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||||||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
|
||||||
`recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
|
`recipient_name` varchar(64) NOT NULL COMMENT '接收人名称',
|
||||||
`notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书',
|
`notify_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书',
|
||||||
`notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
|
`notify_attribute` varchar(512) NOT NULL COMMENT '配置属性',
|
||||||
|
@ -37,11 +37,6 @@ public class NotifyRecipient implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String namespaceId;
|
private String namespaceId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 组名称
|
|
||||||
*/
|
|
||||||
private String groupName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收人名称
|
* 接收人名称
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient">
|
<resultMap id="BaseResultMap" type="com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient">
|
||||||
<id column="id" property="id" />
|
<id column="id" property="id" />
|
||||||
<result column="namespace_id" property="namespaceId" />
|
<result column="namespace_id" property="namespaceId" />
|
||||||
<result column="group_name" property="groupName" />
|
|
||||||
<result column="recipient_name" property="recipientName" />
|
<result column="recipient_name" property="recipientName" />
|
||||||
<result column="notify_type" property="notifyType" />
|
<result column="notify_type" property="notifyType" />
|
||||||
<result column="notify_attribute" property="notifyAttribute" />
|
<result column="notify_attribute" property="notifyAttribute" />
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.annotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: opensnail
|
||||||
|
* @date : 2024-04-18
|
||||||
|
* @since : sj_1.0.0
|
||||||
|
*/
|
||||||
|
public @interface Update {
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,41 @@
|
|||||||
package com.aizuda.snailjob.server.web.model.request;
|
package com.aizuda.snailjob.server.web.model.request;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.annotation.Update;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author opensnail
|
* @author opensnail
|
||||||
* @date 2024-04-17 22:03:33
|
* @date 2024-04-17 22:03:33
|
||||||
* @since sj_1.0.0
|
* @since sj_1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class NotifyRecipientRequestVO {
|
public class NotifyRecipientRequestVO {
|
||||||
|
|
||||||
|
@NotNull(message = "id不能为空", groups = Update.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收人名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "接收人名称不能为空")
|
||||||
|
private String recipientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书
|
||||||
|
*/
|
||||||
|
@NotNull(message = "通知类型不能为空")
|
||||||
|
private Integer notifyType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置属性
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "配置属性不能为空")
|
||||||
|
private String notifyAttribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.aizuda.snailjob.server.web.service.convert;
|
package com.aizuda.snailjob.server.web.service.convert;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
||||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -13,10 +14,11 @@ import java.util.List;
|
|||||||
* @since sj_1.0.0
|
* @since sj_1.0.0
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface NotifyRecipientResponseVOConverter {
|
public interface NotifyRecipientConverter {
|
||||||
|
|
||||||
NotifyRecipientResponseVOConverter INSTANCE = Mappers.getMapper(NotifyRecipientResponseVOConverter.class);
|
NotifyRecipientConverter INSTANCE = Mappers.getMapper(NotifyRecipientConverter.class);
|
||||||
|
|
||||||
List<NotifyRecipientResponseVO> toNotifyRecipientResponseVOs(List<NotifyRecipient> notifyRecipients);
|
List<NotifyRecipientResponseVO> toNotifyRecipientResponseVOs(List<NotifyRecipient> notifyRecipients);
|
||||||
|
|
||||||
|
NotifyRecipient toNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||||
}
|
}
|
@ -1,11 +1,12 @@
|
|||||||
package com.aizuda.snailjob.server.web.service.impl;
|
package com.aizuda.snailjob.server.web.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||||
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
|
||||||
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
||||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||||
import com.aizuda.snailjob.server.web.service.convert.NotifyRecipientResponseVOConverter;
|
import com.aizuda.snailjob.server.web.service.convert.NotifyRecipientConverter;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
|
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -31,16 +32,16 @@ public class NotifyRecipientServiceImpl implements NotifyRecipientService {
|
|||||||
|
|
||||||
PageDTO<NotifyRecipient> notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, new LambdaQueryWrapper<>());
|
PageDTO<NotifyRecipient> notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, new LambdaQueryWrapper<>());
|
||||||
|
|
||||||
return new PageResult<>(pageDTO, NotifyRecipientResponseVOConverter.INSTANCE.toNotifyRecipientResponseVOs(notifyRecipientPageDTO.getRecords()));
|
return new PageResult<>(pageDTO, NotifyRecipientConverter.INSTANCE.toNotifyRecipientResponseVOs(notifyRecipientPageDTO.getRecords()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean saveNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
public Boolean saveNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
||||||
return null;
|
return 1 == notifyRecipientMapper.insert(NotifyRecipientConverter.INSTANCE.toNotifyRecipient(requestVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
public Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
||||||
return null;
|
return 1 == notifyRecipientMapper.updateById(NotifyRecipientConverter.INSTANCE.toNotifyRecipient(requestVO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user