/** * */ package jp.agentec.sinaburocast.service; import java.util.List; import jp.agentec.sinaburocast.entity.AdminUser; import jp.agentec.sinaburocast.entity.UploadError; import org.seasar.extension.jdbc.where.SimpleWhere; import org.seasar.framework.container.annotation.tiger.Component; import org.seasar.framework.container.annotation.tiger.InstanceType; /** * @author kim-hs * */ @Component(instance=InstanceType.SINGLETON) public class UploadErrorService extends AbstractService<UploadError> { // public UploadError findById(String type) { // return select().id(type).getSingleResult(); // } public UploadError findByType(String type) { return select().where(new SimpleWhere().eq("type", type)).getSingleResult(); } /** * typeに一致するレコード全部取得。基本的に1レコード。 * @param type * @return */ public List<UploadError> findListByType(String type) { return select().where(new SimpleWhere().eq("type", type)).getResultList(); } /** * typeに一致するレコード全部削除後に登録。 * @param type * @return */ public int deleteInsertByType(UploadError uploadError,AdminUser adminUserInfo) { jdbcManager.updateBySql("DELETE FROM t_uploaderror WHERE type=?", String.class).params(uploadError.type).execute(); super.insert(uploadError,adminUserInfo.loginId); return 0; } }