From 9f4747457755bbb147984b348d3ecf2790b04fe1 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Fri, 30 May 2025 17:27:52 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/feature-leomon' into xin --- oying-system/src/main/java/com/oying/modules/message/service/impl/MessageOrderLeaveServiceImpl.java | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/message/service/impl/MessageOrderLeaveServiceImpl.java b/oying-system/src/main/java/com/oying/modules/message/service/impl/MessageOrderLeaveServiceImpl.java new file mode 100644 index 0000000..9d28813 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/message/service/impl/MessageOrderLeaveServiceImpl.java @@ -0,0 +1,89 @@ +package com.oying.modules.message.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.oying.modules.message.domain.MessageOrderLeave; +import com.oying.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.oying.modules.message.service.MessageOrderLeaveService; +import com.oying.modules.message.domain.dto.MessageOrderLeaveQueryCriteria; +import com.oying.modules.message.mapper.MessageOrderLeaveMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.oying.utils.PageUtil; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import com.oying.utils.PageResult; + +/** +* @description 服务实现 +* @author 李萌 +* @date 2025-05-20 +**/ +@Service +@RequiredArgsConstructor +public class MessageOrderLeaveServiceImpl extends ServiceImpl<MessageOrderLeaveMapper, MessageOrderLeave> implements MessageOrderLeaveService { + + private final MessageOrderLeaveMapper messageOrderLeaveMapper; + + @Override + public PageResult<MessageOrderLeave> queryAll(MessageOrderLeaveQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(messageOrderLeaveMapper.findAll(criteria, page)); + } + + @Override + public List<MessageOrderLeave> queryAll(MessageOrderLeaveQueryCriteria criteria){ + return messageOrderLeaveMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(MessageOrderLeave resources) { + messageOrderLeaveMapper.insert(resources); + } + +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void update(MessageOrderLeave resources) { +// MessageOrderLeave messageOrderLeave = getById(resources.getId()); +// messageOrderLeave.copy(resources); +// messageOrderLeaveMapper.updateById(messageOrderLeave); +// } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Integer> ids) { + messageOrderLeaveMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<MessageOrderLeave> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (MessageOrderLeave messageOrderLeave : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("订单ID", messageOrderLeave.getOrderId()); + map.put("顾客评价内容", messageOrderLeave.getCustomerReview()); + map.put("商家回复内容", messageOrderLeave.getSellerReply()); + map.put("跳转链接", messageOrderLeave.getLink()); + map.put("创建时间", messageOrderLeave.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + /** + * 根据订单ID查找留言信息 + * @param orderId 订单ID + * @return 匹配的留言记录,若不存在则返回 null + */ + public MessageOrderLeave findByOrderId(Integer orderId) { + return baseMapper.selectOne(new QueryWrapper<MessageOrderLeave>() + .eq("order_id", orderId)); + } + +} -- Gitblit v1.9.3