package com.hai.service.impl; import com.hai.common.utils.DateUtil; import com.hai.dao.HighOrderPreMapper; import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPreExample; import com.hai.service.HighOrderPreService; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; @Service("highOrderPreService") public class HighOrderPreServiceImpl implements HighOrderPreService { @Resource private HighOrderPreMapper highOrderPreMapper; @Override public List getListOrderPre(Map map) { HighOrderPreExample example = new HighOrderPreExample(); HighOrderPreExample.Criteria criteria = example.createCriteria(); if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } if (MapUtils.getInteger(map, "companyId") != null) { criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); } if (MapUtils.getInteger(map, "merchantId") != null) { criteria.andMerchantIdEqualTo(MapUtils.getLong(map, "merchantId")); } if (MapUtils.getInteger(map, "merchantStoreId") != null) { criteria.andMerchantStoreIdEqualTo(MapUtils.getLong(map, "merchantStoreId")); } if (MapUtils.getString(map, "orderNo") != null) { criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); } if (MapUtils.getString(map, "goodsName") != null) { criteria.andGoodsNameLike("%" + MapUtils.getString(map, "goodsName") + "%"); } if (MapUtils.getString(map, "userPhone") != null) { criteria.andPreUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); } if (MapUtils.getString(map, "preOrderNo") != null) { criteria.andPreOrderNoLike("%" + MapUtils.getString(map, "preOrderNo") + "%"); } if (MapUtils.getString(map, "preUserName") != null) { criteria.andPreUserNameLike("%" + MapUtils.getString(map, "preUserName") + "%"); } if (MapUtils.getString(map , "createTimeS") !=null && MapUtils.getString(map , "createTimeE") != null) { criteria.andCreateTimeBetween( DateUtil.format(MapUtils.getString(map , "createTimeS") , "yyyy-MM-dd HH:mm:ss") , DateUtil.format(MapUtils.getString(map , "createTimeE") , "yyyy-MM-dd HH:mm:ss")); } return highOrderPreMapper.selectByExample(example); } @Override public HighOrderPre findByOrderId(Long orderId) { return highOrderPreMapper.selectByPrimaryKey(orderId); } @Override public HighOrderPre findByOrderNo(String orderNo) { return null; } @Override public void insertOrderPre(HighOrderPre highOrderPre) { highOrderPreMapper.insert(highOrderPre); } @Override public void updateOrderPre(HighOrderPre highOrderPre) { highOrderPreMapper.updateByPrimaryKey(highOrderPre); } }