All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajaxjs.website.service.AdsService Maven / Gradle / Ivy

Go to download

AJAXJS aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

The newest version!
package com.ajaxjs.website.service;

import java.util.List;
import java.util.function.Function;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ajaxjs.config.GetConfig;
import com.ajaxjs.framework.BaseService;
import com.ajaxjs.sql.annotation.TableName;
import com.ajaxjs.sql.orm.IBaseDao;
import com.ajaxjs.sql.orm.PageResult;
import com.ajaxjs.sql.orm.Repository;
import com.ajaxjs.website.model.Ads;
import com.ajaxjs.website.section.TreeLikeService;

@Component
public class AdsService extends BaseService {
	@TableName(value = "cms_ads", beanClass = Ads.class)
	public interface AdsDao extends IBaseDao {
	}

	public static AdsDao DAO = new Repository().bind(AdsDao.class);

	{
		setUiName("广告");
		setShortName("ads");
		setDao(DAO);
	}

	@Autowired
	private GetConfig cfg;

	public int getDomainCatalogId() {
		return cfg.getInt("data.adsCatalog_Id");
	}

	/**
	 * 
	 * @param catalogId 分类 id
	 * @return
	 */
	public List findListByCatalogId(int catalogId) {
		return DAO.findList(TreeLikeService.byCatalogId(catalogId));
	}

	/**
	 * 
	 * @param catalogId 分类 id
	 * @param start
	 * @param limit
	 * @param status
	 * @return
	 */
	public PageResult findPagedList(int catalogId, int start, int limit, int status) {
		Function fn = setStatus(status).andThen(BaseService::searchQuery_NameOnly);

		if (catalogId != 0)
			fn = fn.andThen(TreeLikeService.setCatalog(catalogId));

		return DAO.findPagedList(start, limit, fn);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy