|
|
@@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import com.goafanti.common.dao.BannersMapper;
|
|
|
import com.goafanti.common.model.Banners;
|
|
|
@@ -18,7 +17,6 @@ import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
|
|
|
@Service
|
|
|
-@Transactional
|
|
|
public class BannersService extends BaseMybatisDao<BannersMapper> {
|
|
|
@Autowired
|
|
|
BannersMapper bannersMapper;
|
|
|
@@ -32,25 +30,29 @@ public class BannersService extends BaseMybatisDao<BannersMapper> {
|
|
|
public int updateBanner(Banners banners) {
|
|
|
return bannersMapper.updateByPrimaryKeySelective(banners);
|
|
|
}
|
|
|
+
|
|
|
+ public int deleteBanner(Long id) {
|
|
|
+ return bannersMapper.deleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
|
|
|
public List<Banners> findBannersList(String sign, Integer pageNo, Integer pageSize) {
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("sign", sign);
|
|
|
- params.put("pageSize", pageSize);
|
|
|
- params.put("pageNo", pageNo);
|
|
|
- return bannersMapper.findList(params);
|
|
|
+ return portalBanners(sign, pageNo, pageSize);
|
|
|
}
|
|
|
|
|
|
public List<Banners> previewPortalBanners(String key) {
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("key", key);
|
|
|
- return bannersMapper.findList(params);
|
|
|
+ return portalBanners(key, 0, 6);
|
|
|
}
|
|
|
|
|
|
@Cacheable(value = "BannersListCache", key = "'BannersList:Key:'+#key")
|
|
|
public List<Banners> findPortalBanners(String key) {
|
|
|
+ return portalBanners(key, 0, 6);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Banners> portalBanners(String sign, Integer pageNo, Integer pageSize) {
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("key", key);
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("pageSize", pageSize);
|
|
|
+ params.put("pageNo", pageNo);
|
|
|
return bannersMapper.findList(params);
|
|
|
}
|
|
|
|