admin
2019-03-13 69bee82b81626b82b7f39f0e459e4f56b1699b51
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareServiceImpl.java
@@ -10,14 +10,11 @@
import com.yeshi.fanli.dao.hongbao.HongBaoDao;
import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
import com.yeshi.fanli.dao.order.PidOrderDao;
import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.taobao.PidOrder;
import com.yeshi.fanli.entity.taobao.PidUser;
import com.yeshi.fanli.entity.taobao.ShareTaoPassword;
import com.yeshi.fanli.service.inter.goods.ShareService;
import com.yeshi.fanli.util.Constant;
import org.yeshi.utils.NumberUtil;
@Service
public class ShareServiceImpl implements ShareService {
@@ -27,9 +24,6 @@
   
   @Resource
   private HongBaoDao hongBaoDao;
   @Resource
   private PidOrderDao pidOrderDao;
   
   @Override
   public String getRandomPid() {
@@ -78,27 +72,6 @@
   public int getCount(long uid) {
      return shareMapper.getCount(uid);
   }
   @Override
   public int getCountByKey(String key) {
      if (NumberUtil.isNumeric(key)) {
         if (key.trim().length() < 18) {
            long lk = Long.parseLong(key);
            return (int) pidOrderDao.getCount(
                  "select count(*) from PidOrder po where po.userInfo.id = ?  ",
                  new Serializable[] {lk});
         } else {
            return (int) pidOrderDao.getCount("select count(*) from PidOrder po where po.orderId like ? ",
                  new Serializable[] { "%" + key + "%" });
         }
      } else {
         return (int) pidOrderDao.getCount("select count(*) from PidOrder po where po.userInfo.nickName like ?  ",
               new Serializable[] { "%" + key + "%" });
      }
   }
   @Override
   public List<HongBao> getShareList(int pageIndex, long uid) {
@@ -124,27 +97,4 @@
      return shareMapper.getShareMoneyCount();
   }
   
   @Override
   public List<PidOrder> getShareMoneyList(int pageIndex, String key) {
      if(NumberUtil.isNumeric(key)) {
         if(key.length() < 18 ) {
            long uid = Long.parseLong(key);
            List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.userInfo.id = ? order by po.orderCreateTime desc",
                  (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {uid});
            return shareMoneyList;
         } else {
            List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.orderId like ? order by po.orderCreateTime desc",
                  (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {"%" + key + "%"});
            return shareMoneyList;
         }
      }
         List<PidOrder> shareMoneyList = pidOrderDao.list("from PidOrder po where po.userInfo.nickName like ? order by po.orderCreateTime desc",
               (pageIndex - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] {"%" + key + "%"});
         return shareMoneyList;
   }
}