admin
2022-01-28 cd7767932dddeaf6d9c73a83d4a9b38f0341b77f
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
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.math.BigInteger;
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;
    }
 
    public List<DetailSystemConfig> list(Long systemId, String searchKey) {
        return list("from DetailSystemConfig c where c.systemId=? and c.beizhu like ?", new BigInteger( systemId+""), "%" + searchKey + "%");
    }
 
 
 
    public List<DetailSystemConfig> listByValue(Long systemId, String searchKey) {
        return list("from DetailSystemConfig c where c.systemId=? and c.value like ?", new BigInteger( systemId+""), "%" + searchKey + "%");
    }
 
}