From d93356927d8a0a5a91963c28d461d9107562d759 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Fri, 30 May 2025 17:38:26 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/xin' --- oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java new file mode 100644 index 0000000..ca6c22c --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantsServiceImpl.java @@ -0,0 +1,86 @@ +package com.oying.modules.system.service.impl; + +import com.oying.modules.system.domain.Merchants; +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.MerchantsService; +import com.oying.modules.system.domain.dto.MerchantsQueryCriteria; +import com.oying.modules.system.mapper.MerchantsMapper; +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 MerchantsServiceImpl extends ServiceImpl<MerchantsMapper, Merchants> implements MerchantsService { + + private final MerchantsMapper merchantsMapper; + + @Override + public PageResult<Merchants> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(merchantsMapper.findAll(criteria, page)); + } + + @Override + public List<Merchants> queryAll(MerchantsQueryCriteria criteria){ + return merchantsMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Merchants resources) { + merchantsMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Merchants resources) { + Merchants merchants = getById(resources.getMerchantsId()); + merchants.copy(resources); + merchantsMapper.updateById(merchants); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Long> ids) { + merchantsMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<Merchants> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (Merchants merchants : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("名称", merchants.getMerchantName()); + map.put("商户编码", merchants.getMerchantCode()); + map.put("营业执照号", merchants.getBusinessLicense()); + map.put("营业执照号路径", merchants.getBusinessLicensePath()); + map.put("联系手机", merchants.getContactMobile()); + map.put("排序", merchants.getMerchantsSort()); + map.put("状态", merchants.getEnabled()); + map.put("审核人", merchants.getAuthUser()); + map.put("审核时间", merchants.getAuthTime()); + map.put("审核信息", merchants.getAuthMessage()); + map.put("创建者", merchants.getCreateBy()); + map.put("更新者", merchants.getUpdateBy()); + map.put("创建日期", merchants.getCreateTime()); + map.put("更新时间", merchants.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} -- Gitblit v1.9.3