admin
2021-05-08 56481656c7de11cdca69c1a7dd69db176ffd9ecd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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);
    }
}