New file |
| | |
| | | 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); |
| | | } |
| | | } |