| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | | import org.springframework.cache.annotation.CacheEvict;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | |
| | | import com.yeshi.fanli.entity.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.xcx.XCXSettingConfig;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | | @Service
|
| | | public class ConfigServiceImpl implements ConfigService {
|
| | |
| | | return configDao.list("from Config");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Config> listObjects(String key, int page) {
|
| | | int start = (page-1) * Constant.PAGE_SIZE;
|
| | | StringBuffer hqlBuf=new StringBuffer("from Config pr where 1=1 ");
|
| | | |
| | | if(key !=null && !"".equals(key.trim())){
|
| | | hqlBuf.append(" and (pr.name like ? )");
|
| | | }
|
| | | |
| | | hqlBuf.append(" order by pr.id desc ");
|
| | | String hql = hqlBuf.toString();
|
| | | if(hql.contains("pr.name")){
|
| | | return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[]{"%"+key+"%"});
|
| | | } else {
|
| | | return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[]{});
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | @Override
|
| | | public int getCount(String key, int page) {
|
| | | |
| | | StringBuffer hqlBuf=new StringBuffer("select count(*) from Config pr where 1=1 ");
|
| | | |
| | | if(key !=null && !"".equals(key.trim())){
|
| | | hqlBuf.append(" and (pr.name like ? )");
|
| | | }
|
| | | |
| | | String hql = hqlBuf.toString();
|
| | | |
| | | if(hql.contains("pr.name")){
|
| | | return (int) configDao.getCount(hqlBuf.toString(),new Serializable[]{"%"+key+"%"});
|
| | | } else {
|
| | | return (int) configDao.getCount(hqlBuf.toString(), new Serializable[]{});
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @CacheEvict(value = "config", allEntries = true)
|
| | | @Transactional
|
| | | public void update(List<Config> list) {
|
| | |
| | | String value = get("home_weex_url");
|
| | | return value;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public Config getConfig(long id) {
|
| | | return configDao.find(Config.class, id);
|
| | | }
|
| | | |
| | | }
|