| | |
| | | package com.oying.modules.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.oying.modules.system.domain.Merchant; |
| | | import com.oying.modules.system.domain.UserMerchant; |
| | | import com.oying.modules.system.mapper.MerchantMapper; |
| | | import com.oying.modules.system.service.UserMerchantService; |
| | | import com.oying.utils.FileUtil; |
| | | import com.oying.utils.enums.MerchantRole; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService { |
| | | |
| | | private final MerchantMapper merchantMapper; |
| | | private final UserMerchantService userMerchantService; |
| | | |
| | | @Override |
| | | public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){ |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Merchant resources) { |
| | | resources.setMerchantCode(IdUtil.getSnowflakeNextIdStr()); |
| | | merchantMapper.insert(resources); |
| | | UserMerchant userMerchant = new UserMerchant(); |
| | | userMerchant.setMerchantId(resources.getMerchantId()); |
| | | userMerchant.setUserId(resources.getUserId()); |
| | | userMerchant.setRoleType(MerchantRole.OWNER.getRole()); |
| | | userMerchantService.create(userMerchant); |
| | | } |
| | | |
| | | @Override |