parent
60855bbdc4
commit
09b6e91215
@ -0,0 +1,62 @@
|
||||
package com.macro.mall.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.macro.mall.dao.SmsFlashPromotionProductRelationDao;
|
||||
import com.macro.mall.dto.SmsFlashPromotionProduct;
|
||||
import com.macro.mall.mapper.SmsFlashPromotionProductRelationMapper;
|
||||
import com.macro.mall.model.SmsFlashPromotionProductRelation;
|
||||
import com.macro.mall.model.SmsFlashPromotionProductRelationExample;
|
||||
import com.macro.mall.service.SmsFlashPromotionProductRelationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 限时购商品关联管理Service实现类
|
||||
*/
|
||||
@Service
|
||||
public class SmsFlashPromotionProductRelationServiceImpl implements SmsFlashPromotionProductRelationService {
|
||||
@Autowired
|
||||
private SmsFlashPromotionProductRelationMapper relationMapper;
|
||||
@Autowired
|
||||
private SmsFlashPromotionProductRelationDao relationDao;
|
||||
@Override
|
||||
public int create(List<SmsFlashPromotionProductRelation> relationList) {
|
||||
for (SmsFlashPromotionProductRelation relation : relationList) {
|
||||
relationMapper.insert(relation);
|
||||
}
|
||||
return relationList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Long id, SmsFlashPromotionProductRelation relation) {
|
||||
relation.setId(id);
|
||||
return relationMapper.updateByPrimaryKey(relation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return relationMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsFlashPromotionProductRelation getItem(Long id) {
|
||||
return relationMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SmsFlashPromotionProduct> list(Long flashPromotionId, Long flashPromotionSessionId, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
return relationDao.getList(flashPromotionId,flashPromotionSessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount(Long flashPromotionId, Long flashPromotionSessionId) {
|
||||
SmsFlashPromotionProductRelationExample example = new SmsFlashPromotionProductRelationExample();
|
||||
example.createCriteria()
|
||||
.andFlashPromotionIdEqualTo(flashPromotionId)
|
||||
.andFlashPromotionSessionIdEqualTo(flashPromotionSessionId);
|
||||
return relationMapper.countByExample(example);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.macro.mall.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.macro.mall.mapper.SmsFlashPromotionMapper;
|
||||
import com.macro.mall.model.SmsFlashPromotion;
|
||||
import com.macro.mall.model.SmsFlashPromotionExample;
|
||||
import com.macro.mall.service.SmsFlashPromotionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ÏÞʱ¹º»î¶¯¹ÜÀíServiceʵÏÖÀà
|
||||
*/
|
||||
@Service
|
||||
public class SmsFlashPromotionServiceImpl implements SmsFlashPromotionService {
|
||||
@Autowired
|
||||
private SmsFlashPromotionMapper flashPromotionMapper;
|
||||
|
||||
@Override
|
||||
public int create(SmsFlashPromotion flashPromotion) {
|
||||
flashPromotion.setCreateTime(new Date());
|
||||
return flashPromotionMapper.insert(flashPromotion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Long id, SmsFlashPromotion flashPromotion) {
|
||||
flashPromotion.setId(id);
|
||||
return flashPromotionMapper.updateByPrimaryKey(flashPromotion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return flashPromotionMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(Long id, Integer status) {
|
||||
SmsFlashPromotion flashPromotion = new SmsFlashPromotion();
|
||||
flashPromotion.setId(id);
|
||||
flashPromotion.setStatus(status);
|
||||
return flashPromotionMapper.updateByPrimaryKeySelective(flashPromotion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsFlashPromotion getItem(Long id) {
|
||||
return flashPromotionMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SmsFlashPromotion> list(String keyword, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
||||
if (!StringUtils.isEmpty(keyword)) {
|
||||
example.createCriteria().andTitleLike("%" + keyword + "%");
|
||||
}
|
||||
return flashPromotionMapper.selectByExample(example);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue