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 { /** * 根据系统ID与版本号获取值 * * @param systemId * @param maxVersion * @return */ public List 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 list(Long systemId, String searchKey) { return list("from DetailSystemConfig c where c.systemId=? and c.beizhu like ?", new BigInteger( systemId+""), "%" + searchKey + "%"); } public List listByValue(Long systemId, String searchKey) { return list("from DetailSystemConfig c where c.systemId=? and c.value like ?", new BigInteger( systemId+""), "%" + searchKey + "%"); } }