嗨森逛服务
hai-server/hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl....

54 lines
1.9 KiB

package com.hai.service.impl;
import com.hai.dao.HighGasOilPriceMapper;
import com.hai.entity.HighGasOilPrice;
import com.hai.entity.HighGasOilPriceExample;
import com.hai.enum_type.GasOilPriceStatusEnum;
import com.hai.service.HighGasOilPriceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("highGasOilPriceService")
public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
@Resource
private HighGasOilPriceMapper highGasOilPriceMapper;
@Override
public void editGasOilPrice(HighGasOilPrice highGasOilPrice) {
if (highGasOilPrice.getId() != null) {
highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice);
} else {
highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus());
highGasOilPriceMapper.insert(highGasOilPrice);
}
}
@Override
public HighGasOilPrice getGasOilPriceByStoreAndOilNo(Long storeId, Integer oilNo) {
HighGasOilPriceExample example = new HighGasOilPriceExample();
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andOilNoEqualTo(oilNo);
List<HighGasOilPrice> list = highGasOilPriceMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighGasOilPrice> getGasOilPriceByStore(Long storeId) {
HighGasOilPriceExample example = new HighGasOilPriceExample();
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andStatusNotEqualTo(0);
return highGasOilPriceMapper.selectByExample(example);
}
@Override
public List<Map<String,Object>> getStoreListByOilNo(String storeName,Long regionId, String oilNoName) {
return highGasOilPriceMapper.selectStoreListByOilNo(storeName,regionId,oilNoName);
}
}