GiftExchangeInfoService.java 1.28 KB
Newer Older
Kim Gyeongeun committed
1 2
package jp.agentec.sinaburocast.service;

3
import java.util.List;
Kim Gyeongeun committed
4 5 6 7 8

import org.seasar.extension.jdbc.where.SimpleWhere;
import org.seasar.framework.container.annotation.tiger.Component;
import org.seasar.framework.container.annotation.tiger.InstanceType;

9 10 11
import jp.agentec.sinaburocast.entity.AdminUser;
import jp.agentec.sinaburocast.entity.GiftExchangeInfo;

Kim Gyeongeun committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
@Component(instance=InstanceType.SINGLETON)
public class GiftExchangeInfoService extends AbstractService<GiftExchangeInfo> {

	private static final String ID_SEQ_NAME = "gift_exchange_info_id_seq";
	/**
	 * IDを発行して、登録する。
	 *
	 */
	public int insertGiftExchangeInfo(GiftExchangeInfo giftExchangeInfo, AdminUser adminUserInfo) {
		giftExchangeInfo.giftExchangeInfoId = getSeqNextVal(Integer.class, ID_SEQ_NAME);
		return super.insert(giftExchangeInfo, adminUserInfo.loginId);
	}

	public GiftExchangeInfo findGiftExchangeInfo() {
		return select().getSingleResult();
	}
28 29 30
	
	// 全検索
	public List<GiftExchangeInfo> findGiftExchangeInfoList() {
Kazuki Nakamura committed
31
		return select().orderBy("giftExchangeInfoId desc").getResultList();
32
	}
Kim Gyeongeun committed
33

34 35 36 37 38
	// IDで検索
	public GiftExchangeInfo findGiftExchangeInfoById(Integer giftExchangeInfoId) {
		return select().where(new SimpleWhere().eq("giftExchangeInfoId",giftExchangeInfoId )).getSingleResult();
	}
	
Kim Gyeongeun committed
39
}