From 51df6e262c2d625e700a8194cbe0ec1e40b80843 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Tue, 03 Jun 2025 19:23:31 +0800 Subject: [PATCH] 存储桶 --- oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java new file mode 100644 index 0000000..abf98cf --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java @@ -0,0 +1,86 @@ +package com.oying.modules.system.service.impl; + +import com.oying.modules.system.domain.Merchant; +import com.oying.modules.system.mapper.MerchantMapper; +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.system.service.MerchantService; +import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; +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 lixin +* @date 2025-05-29 +**/ +@Service +@RequiredArgsConstructor +public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService { + + private final MerchantMapper merchantMapper; + + @Override + public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(merchantMapper.findAll(criteria, page)); + } + + @Override + public List<Merchant> queryAll(MerchantsQueryCriteria criteria){ + return merchantMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Merchant resources) { + merchantMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Merchant resources) { + Merchant merchant = getById(resources.getMerchantId()); + merchant.copy(resources); + merchantMapper.updateById(merchant); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Long> ids) { + merchantMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<Merchant> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (Merchant merchant : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("名称", merchant.getMerchantName()); + map.put("商户编码", merchant.getMerchantCode()); + map.put("营业执照号", merchant.getBusinessLicense()); + map.put("营业执照号路径", merchant.getBusinessLicensePath()); + map.put("联系手机", merchant.getContactMobile()); + map.put("排序", merchant.getMerchantSort()); + map.put("状态", merchant.getEnabled()); + map.put("审核人", merchant.getAuditUser()); + map.put("审核时间", merchant.getAuditTime()); + map.put("审核信息", merchant.getAuditMessage()); + map.put("创建者", merchant.getCreateBy()); + map.put("更新者", merchant.getUpdateBy()); + map.put("创建日期", merchant.getCreateTime()); + map.put("更新时间", merchant.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} -- Gitblit v1.9.3