package com.taoke.autopay.service.impl.agent;
|
|
import com.taoke.autopay.dao.agent.ChannelAgentSettingsMapper;
|
import com.taoke.autopay.entity.agent.ChannelAgentSettings;
|
import com.taoke.autopay.service.agent.ChannelAgentSettingService;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
|
@Service
|
public class ChannelAgentSettingServiceImpl implements ChannelAgentSettingService {
|
|
@Resource
|
private ChannelAgentSettingsMapper channelAgentSettingsMapper;
|
|
|
@Override
|
public ChannelAgentSettings selectByAgentId(Long agentId) {
|
return channelAgentSettingsMapper.selectByPrimaryKey(agentId);
|
}
|
|
@Override
|
public void update(ChannelAgentSettings settings) {
|
if(settings.getUpdateTime()==null){
|
settings.setUpdateTime(new Date());
|
}
|
channelAgentSettingsMapper.updateByPrimaryKeySelective(settings);
|
}
|
|
@Override
|
public void add(ChannelAgentSettings settings) {
|
// 如果存在就修改
|
ChannelAgentSettings old= selectByAgentId(settings.getId());
|
if(old==null){
|
if(settings.getCreateTime()==null){
|
settings.setCreateTime(new Date());
|
|
}
|
channelAgentSettingsMapper.insertSelective(settings);
|
}else{
|
update(settings);
|
}
|
}
|
|
@Override
|
public List<ChannelAgentSettings> listByIds(List<Long> agentIds) {
|
return channelAgentSettingsMapper.listByIds(agentIds);
|
}
|
}
|