From 3ac30b4c17cf071ce9c66a59c069ab83efae6d2d Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 14 十月 2019 17:44:13 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeHongBaoOrderMapServiceImpl.java | 63 +++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeHongBaoOrderMapServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeHongBaoOrderMapServiceImpl.java new file mode 100644 index 0000000..9e8b50d --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/elme/ElmeHongBaoOrderMapServiceImpl.java @@ -0,0 +1,63 @@ +package com.yeshi.fanli.service.impl.elme; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.dao.mybatis.elme.ElmeHongBaoOrderMapMapper; +import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap; +import com.yeshi.fanli.exception.elme.ElmeHongBaoOrderMapException; +import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService; + +/** + * 楗夸簡涔堢孩鍖呰鍗曟槧灏� + * + * @author Administrator + * + */ +@Service +public class ElmeHongBaoOrderMapServiceImpl implements ElmeHongBaoOrderMapService { + + @Resource + private ElmeHongBaoOrderMapMapper elmeHongBaoOrderMapMapper; + + @Transactional + @Override + public void addHongBaoOrderMap(ElmeHongBaoOrderMap map) throws ElmeHongBaoOrderMapException { + if (map.getElmeOrder() == null || map.getElmeOrder().getId() == null || map.getHongBao() == null + || map.getHongBao().getId() == null) + throw new ElmeHongBaoOrderMapException(1, "淇℃伅涓嶅畬鏁�"); + ElmeHongBaoOrderMap oldMap = elmeHongBaoOrderMapMapper.selectByOrderId(map.getElmeOrder().getId()); + if (oldMap != null) + throw new ElmeHongBaoOrderMapException(2, "璁㈠崟ID宸茬粡娣诲姞杩囨槧灏�"); + oldMap = elmeHongBaoOrderMapMapper.selectByHongBaoId(map.getHongBao().getId()); + if (oldMap != null) + throw new ElmeHongBaoOrderMapException(3, "绾㈠寘ID宸茬粡娣诲姞杩囨槧灏�"); + elmeHongBaoOrderMapMapper.insertSelective(map); + } + + @Override + public ElmeHongBaoOrderMap selectByOrderId(Long orderId) { + + return elmeHongBaoOrderMapMapper.selectByOrderId(orderId); + } + + @Override + public ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId) { + return elmeHongBaoOrderMapMapper.selectByHongBaoId(hongBaoId); + } + + @Override + public List<ElmeHongBaoOrderMap> listByHongBaoUid(Long uid, int page, int pageSize) { + return elmeHongBaoOrderMapMapper.listByHongBaoUid(uid, (page - 1) * pageSize, pageSize); + } + + @Override + public long countByHongBaoUid(Long uid) { + return elmeHongBaoOrderMapMapper.countByHongBaoUid(uid); + } + +} -- Gitblit v1.8.0