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
package com.yeshi.buwan.dao.system;
 
import com.yeshi.buwan.dao.base.BaseDao;
import org.springframework.stereotype.Repository;
 
import com.yeshi.buwan.domain.system.DetailSystemConfig;
 
import java.util.List;
 
@Repository
public class DetailSystemConfigDao extends BaseDao<DetailSystemConfig> {
 
    /**
     * 根据系统ID与版本号获取值
     *
     * @param systemId
     * @param maxVersion
     * @return
     */
    public List<DetailSystemConfig> listBySystemIdAndMaxVersion(Long systemId, int maxVersion) {
        List list = sqlListWithEntity("SELECT a.* FROM (SELECT * FROM `wk_video_config` vc WHERE vc.`systemId`=? AND vc.`minVersion`<=? ORDER BY vc.`minVersion` DESC) a GROUP BY a.`systemId`,a.`key`", DetailSystemConfig.class, systemId, maxVersion);
        return list;
    }
 
 
    public DetailSystemConfig selectByKey(String key, Long systemId, int maxVersion) {
        List list = sqlListWithEntity("SELECT a.* FROM (SELECT * FROM `wk_video_config` vc where vc.`key`=? and vc.`systemId`=? AND vc.`minVersion`<=? ORDER BY vc.`minVersion` DESC) a GROUP BY a.`systemId`,a.`key`", DetailSystemConfig.class, key, systemId, maxVersion);
        if (list != null && list.size() > 0)
            return (DetailSystemConfig) list.get(0);
        return null;
    }
 
}