feat(sj_1.0.0): 新增通知人列表
This commit is contained in:
parent
caaa5f9cc3
commit
49daf08655
@ -1,8 +1,10 @@
|
||||
package com.aizuda.snailjob.server.web.controller;
|
||||
|
||||
import com.aizuda.snailjob.server.web.annotation.LoginRequired;
|
||||
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.NotifyRecipientRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.CommonLabelValueResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -26,17 +28,26 @@ public class NotifyRecipientController {
|
||||
private final NotifyRecipientService notifyRecipientService;
|
||||
|
||||
@PostMapping
|
||||
@LoginRequired
|
||||
public Boolean saveNotifyRecipient(@RequestBody @Validated NotifyRecipientRequestVO requestVO) {
|
||||
return notifyRecipientService.saveNotifyRecipient(requestVO);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@LoginRequired
|
||||
public Boolean updateNotifyRecipient(@RequestBody @Validated NotifyRecipientRequestVO requestVO) {
|
||||
return notifyRecipientService.updateNotifyRecipient(requestVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page/list")
|
||||
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) {
|
||||
return notifyRecipientService.getNotifyRecipientList(queryVO);
|
||||
@LoginRequired
|
||||
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientPageList(NotifyRecipientQueryVO queryVO) {
|
||||
return notifyRecipientService.getNotifyRecipientPageList(queryVO);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@LoginRequired
|
||||
public List<CommonLabelValueResponseVO> getNotifyRecipientList() {
|
||||
return notifyRecipientService.getNotifyRecipientList();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.aizuda.snailjob.server.web.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: opensnail
|
||||
* @date : 2024-04-20
|
||||
* @since : sj_1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class CommonLabelValueResponseVO {
|
||||
|
||||
private String label;
|
||||
|
||||
private Long value;
|
||||
|
||||
}
|
@ -14,16 +14,6 @@ public class NotifyRecipientResponseVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private String namespaceId;
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 接收人名称
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@ package com.aizuda.snailjob.server.web.service;
|
||||
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.NotifyRecipientRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.CommonLabelValueResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -14,10 +15,12 @@ import java.util.List;
|
||||
*/
|
||||
public interface NotifyRecipientService {
|
||||
|
||||
PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO);
|
||||
PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientPageList(NotifyRecipientQueryVO queryVO);
|
||||
|
||||
Boolean saveNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||
|
||||
Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||
|
||||
List<CommonLabelValueResponseVO> getNotifyRecipientList();
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
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.CommonLabelValueResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@ -21,4 +24,12 @@ public interface NotifyRecipientConverter {
|
||||
List<NotifyRecipientResponseVO> toNotifyRecipientResponseVOs(List<NotifyRecipient> notifyRecipients);
|
||||
|
||||
NotifyRecipient toNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||
|
||||
List<CommonLabelValueResponseVO> toCommonLabelValueResponseVOs(List<NotifyRecipient> notifyRecipients);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "label", source = "recipientName"),
|
||||
@Mapping(target = "value", source = "id")
|
||||
})
|
||||
CommonLabelValueResponseVO toCommonLabelValueResponseVO(NotifyRecipient notifyRecipient);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
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.NotifyRecipientRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.CommonLabelValueResponseVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||
import com.aizuda.snailjob.server.web.service.convert.NotifyRecipientConverter;
|
||||
@ -28,7 +29,7 @@ public class NotifyRecipientServiceImpl implements NotifyRecipientService {
|
||||
private final NotifyRecipientMapper notifyRecipientMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) {
|
||||
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientPageList(NotifyRecipientQueryVO queryVO) {
|
||||
PageDTO<NotifyRecipient> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
LambdaQueryWrapper<NotifyRecipient> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(queryVO.getRecipientName())) {
|
||||
@ -54,4 +55,13 @@ public class NotifyRecipientServiceImpl implements NotifyRecipientService {
|
||||
public Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
||||
return 1 == notifyRecipientMapper.updateById(NotifyRecipientConverter.INSTANCE.toNotifyRecipient(requestVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonLabelValueResponseVO> getNotifyRecipientList() {
|
||||
|
||||
LambdaQueryWrapper<NotifyRecipient> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(NotifyRecipient::getRecipientName, NotifyRecipient::getId);
|
||||
List<NotifyRecipient> notifyRecipients = notifyRecipientMapper.selectList(queryWrapper);
|
||||
return NotifyRecipientConverter.INSTANCE.toCommonLabelValueResponseVOs(notifyRecipients);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user