|
|
@@ -0,0 +1,97 @@
|
|
|
+package com.wx.blink.backend.manager;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.wx.blink.backend.domain.dataobject.BlinkActivityAttachmentDO;
|
|
|
+import com.wx.blink.backend.domain.dto.BlinkActivityAttachmentDTO;
|
|
|
+import com.wx.blink.backend.domain.qry.BlinkActivityAttachmentQry;
|
|
|
+import com.wx.blink.backend.objectmapper.BlinkActivityAttachmentMapper;
|
|
|
+import com.wx.blink.backend.repository.BlinkActivityAttachmentRepository;
|
|
|
+import com.wx.blink.backend.service.IBlinkActivityAttachmentService;
|
|
|
+import com.wx.blink.base.common.domain.PageResult;
|
|
|
+import com.wx.blink.base.common.domain.ResponseDTO;
|
|
|
+import com.wx.blink.base.common.util.BlinkEntityUtil;
|
|
|
+import com.wx.blink.base.common.util.BlinkPageUtil;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class BlinkActivityAttachmentServiceImpl extends ServiceImpl<BlinkActivityAttachmentRepository, BlinkActivityAttachmentDO> implements IBlinkActivityAttachmentService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BlinkActivityAttachmentRepository repository;
|
|
|
+ @Resource
|
|
|
+ private BlinkActivityAttachmentMapper mapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增活动附件
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseDTO<String> supportsActivityAttachmentCreate(BlinkActivityAttachmentDTO dto) {
|
|
|
+ // 生成DO
|
|
|
+ BlinkActivityAttachmentDO activityAttachmentDO = new BlinkActivityAttachmentDO();
|
|
|
+ mapper.toBlinkActivityAttachmentDO(dto, activityAttachmentDO);
|
|
|
+ // 创建人赋值
|
|
|
+ BlinkEntityUtil.setCreateInfo(activityAttachmentDO);
|
|
|
+ // 执行新增
|
|
|
+ this.save(activityAttachmentDO);
|
|
|
+ return ResponseDTO.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询活动附件列表
|
|
|
+ *
|
|
|
+ * @param qry
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseDTO<PageResult<BlinkActivityAttachmentDTO>> supportsActivityAttachmentQueryPage(BlinkActivityAttachmentQry qry) {
|
|
|
+ Page<?> page = BlinkPageUtil.convert2PageQuery(qry);
|
|
|
+ List<BlinkActivityAttachmentDTO> activityAttachmentDTOS = repository.supportsActivityAttachmentQueryPage(page, qry);
|
|
|
+ PageResult<BlinkActivityAttachmentDTO> pageResult = BlinkPageUtil.convert2PageResult(page, activityAttachmentDTOS);
|
|
|
+ return ResponseDTO.ok(pageResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取活动附件信息
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseDTO<BlinkActivityAttachmentDTO> supportsActivityAttachmentQuery(Long id) {
|
|
|
+ BlinkActivityAttachmentDTO activityAttachmentDTO = repository.supportsActivityAttachmentQuery(id);
|
|
|
+ if (!Objects.nonNull(activityAttachmentDTO)) {
|
|
|
+ return ResponseDTO.dataErrorParam("活动附件不存在!请检查");
|
|
|
+ }
|
|
|
+ return ResponseDTO.ok(activityAttachmentDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除活动附件
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseDTO<String> supportsActivityAttachmentDeleteById(Long id) {
|
|
|
+ BlinkActivityAttachmentDO activityAttachmentDO = this.getById(id);
|
|
|
+ if (!Objects.nonNull(activityAttachmentDO)){
|
|
|
+ return ResponseDTO.dataErrorParam("活动附件不存在!请检查");
|
|
|
+ }
|
|
|
+ // 执行假删除
|
|
|
+ activityAttachmentDO.setDeletedFlag(1);
|
|
|
+ // 修改人赋值
|
|
|
+ BlinkEntityUtil.setUpdatedInfo(activityAttachmentDO);
|
|
|
+ this.updateById(activityAttachmentDO);
|
|
|
+ return ResponseDTO.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|