From c1d20b425b10e8ba59f102dd1ab413055883eed0 Mon Sep 17 00:00:00 2001 From: 彭雪彬 <1724387007@qq.com> Date: Mon, 14 Jul 2025 16:57:11 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/xin' into pxb --- oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java new file mode 100644 index 0000000..ac36637 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java @@ -0,0 +1,78 @@ +package com.oying.modules.system.service.impl; + +import com.oying.modules.system.domain.UserMerchant; +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.UserMerchantService; +import com.oying.modules.system.domain.dto.UserMerchantQueryCriteria; +import com.oying.modules.system.mapper.UserMerchantMapper; +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-06-16 +**/ +@Service +@RequiredArgsConstructor +public class UserMerchantServiceImpl extends ServiceImpl<UserMerchantMapper, UserMerchant> implements UserMerchantService { + + private final UserMerchantMapper userMerchantMapper; + + @Override + public PageResult<UserMerchant> queryAll(UserMerchantQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(userMerchantMapper.findAll(criteria, page)); + } + + @Override + public List<UserMerchant> queryAll(UserMerchantQueryCriteria criteria){ + return userMerchantMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(UserMerchant resources) { + userMerchantMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserMerchant resources) { + UserMerchant userMerchant = getById(resources.getUserId()); + userMerchant.copy(resources); + userMerchantMapper.updateById(userMerchant); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Long> ids) { + userMerchantMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<UserMerchant> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (UserMerchant userMerchant : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("角色类型", userMerchant.getRoleType()); + map.put("权限集(备用)", userMerchant.getPermissions()); + map.put("创建者", userMerchant.getCreateBy()); + map.put("创建时间", userMerchant.getCreateTime()); + map.put("更新者", userMerchant.getUpdateBy()); + map.put("更新时间", userMerchant.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} -- Gitblit v1.9.3