package com.hai.service.impl; import com.hai.dao.HighTyAgentPriceMapper; import com.hai.entity.HighTyAgentPrice; import com.hai.entity.HighTyAgentPriceExample; import com.hai.service.HighTyAgentPriceService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; import java.util.List; @Service("highTyAgentPriceService") public class HighTyAgentPriceServiceImpl implements HighTyAgentPriceService { @Resource private HighTyAgentPriceMapper tyAgentPriceMapper; @Override public void editTyAgentPrice(HighTyAgentPrice tyAgentPrice) { if (tyAgentPrice.getId() == null) { tyAgentPrice.setCreateTime(new Date()); tyAgentPrice.setUpdateTime(new Date()); tyAgentPrice.setStatus(1); tyAgentPriceMapper.insert(tyAgentPrice); } else { tyAgentPrice.setUpdateTime(new Date()); tyAgentPriceMapper.updateByPrimaryKey(tyAgentPrice); } } @Override public HighTyAgentPrice getDetail(Integer belongType, Long oilStationId, String oilNo) { HighTyAgentPriceExample example = new HighTyAgentPriceExample(); example.createCriteria() .andBelongTypeEqualTo(belongType) .andStatusEqualTo(1) .andOilStationIdEqualTo(oilStationId) .andOilNoEqualTo(oilNo); List<HighTyAgentPrice> list = tyAgentPriceMapper.selectByExample(example); if (list.size() > 0) { return list.get(0); } return null; } @Override public List<HighTyAgentPrice> getPriceList(Integer belongType, Long oilStationId) { HighTyAgentPriceExample example = new HighTyAgentPriceExample(); example.createCriteria() .andBelongTypeEqualTo(belongType) .andOilStationIdEqualTo(oilStationId) .andStatusEqualTo(1); return tyAgentPriceMapper.selectByExample(example); } }