add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
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
35
36
37
38
39
package com.iotechn.unimall.app.api.advert;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dobbinsoft.fw.core.exception.ServiceException;
import com.dobbinsoft.fw.support.annotation.AspectCommonCache;
import com.iotechn.unimall.data.constant.CacheConst;
import com.iotechn.unimall.data.domain.AdvertDO;
import com.iotechn.unimall.data.enums.StatusType;
import com.iotechn.unimall.data.mapper.AdvertMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: kbq
 * Date: 2019-07-08
 * Time: 下午8:36
 */
@Service
public class AdvertServiceImpl implements AdvertService {
 
    @Autowired
    private AdvertMapper advertMapper;
 
    @Override
    @AspectCommonCache(value = CacheConst.ADVERT_TYPE, argIndex = {0}, second = 100, arrayClass = AdvertDO.class)
    public List<AdvertDO> getActiveAd(Integer adType) throws ServiceException {
        QueryWrapper<AdvertDO> wrapper = new QueryWrapper<AdvertDO>()
                .eq("status", StatusType.ACTIVE.getCode());
        if (adType != null) {
            wrapper.eq("type", adType);
        }
        return advertMapper.selectList(wrapper);
    }
 
}