package com.yeshi.buwan.service.imp.live;
|
|
import com.yeshi.buwan.dao.live.TVLiveChannelResourceMapDao;
|
import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap;
|
import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
|
@Service
|
public class TVLiveChannelResourceServiceImpl implements TVLiveChannelResourceService {
|
|
|
@Resource
|
private TVLiveChannelResourceMapDao tvLiveChannelResourceMapDao;
|
|
@Override
|
public List<TVLiveChannelResourceMap> listByChannelId(String channelId) {
|
TVLiveChannelResourceMapDao.DaoQuery daoQuery = new TVLiveChannelResourceMapDao.DaoQuery();
|
daoQuery.count = 100;
|
daoQuery.channelId = channelId;
|
return tvLiveChannelResourceMapDao.list(daoQuery);
|
}
|
|
@Override
|
public long countByChannelId(String channelId) {
|
TVLiveChannelResourceMapDao.DaoQuery daoQuery = new TVLiveChannelResourceMapDao.DaoQuery();
|
daoQuery.channelId = channelId;
|
return tvLiveChannelResourceMapDao.count(daoQuery);
|
}
|
|
@Override
|
public void update(TVLiveChannelResourceMap map) {
|
if (map == null)
|
return;
|
tvLiveChannelResourceMapDao.updateSelective(map);
|
}
|
|
@Override
|
public void add(TVLiveChannelResourceMap map) {
|
if (map == null)
|
return;
|
if (map.getId() == null) {
|
map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource()));
|
}
|
if (tvLiveChannelResourceMapDao.get(map.getId()) != null)
|
return;
|
|
if (map.getCreateTime() == null) {
|
map.setCreateTime(new Date());
|
}
|
tvLiveChannelResourceMapDao.save(map);
|
}
|
|
@Override
|
public void delete(String id) {
|
tvLiveChannelResourceMapDao.delete(id);
|
}
|
}
|