yanghb
2023-04-10 b2f678ad387ca24e05a11100ea4583f0f2f730f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.MerchantActivityMapper;
import com.stylefeng.guns.modular.system.model.Merchant;
import com.stylefeng.guns.modular.system.model.MerchantActivity;
import com.stylefeng.guns.modular.system.service.IMerchantActivityService;
import com.stylefeng.guns.modular.system.service.IMerchantService;
import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service
public class MerchantActivityServiceImpl extends ServiceImpl<MerchantActivityMapper, MerchantActivity> implements IMerchantActivityService {
 
    @Autowired
    private IMerchantService merchantService;
 
    @Override
    public List<MerchantCouponListWarpper> getMerchantCoupon(Integer uid, Integer type, Integer pageNum, Integer size) throws Exception {
        Merchant merchant = merchantService.selectOne(new EntityWrapper<Merchant>().eq("userType", 1).eq("userId", uid).eq("auditStatus", 2).eq("state", 1));
        List<MerchantCouponListWarpper> listWarppers = new ArrayList<>();
        if(null == merchant){
            return listWarppers;
        }
        pageNum = (pageNum - 1) * size;
        listWarppers = this.baseMapper.getMerchantCoupon(merchant.getId(), type, pageNum, size);
        return listWarppers;
    }
}