¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, DreamLu All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: DreamLu 墿¥æ¢¦ (596392912@qq.com) |
| | | */ |
| | | |
| | | package org.springblade.core.mp.service; |
| | | |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èªå®ä¹ç Service |
| | | * |
| | | * @author L.cm, chill |
| | | */ |
| | | public interface BladeService<T> extends BaseService<T> { |
| | | |
| | | /** |
| | | * æå
¥å¦æä¸å·²ç»åå¨ç¸åçè®°å½ï¼å忽ç¥å½åæ°æ°æ® |
| | | * |
| | | * @param entity entity |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean saveIgnore(T entity); |
| | | |
| | | /** |
| | | * 表示æå
¥æ¿æ¢æ°æ®ï¼éæ±è¡¨ä¸æPrimaryKeyï¼æè
uniqueç´¢å¼ï¼å¦ææ°æ®åºå·²ç»å卿°æ®ï¼åç¨æ°æ°æ®æ¿æ¢ï¼å¦ææ²¡ææ°æ®ææååinsert into䏿 ·ï¼ |
| | | * |
| | | * @param entity entity |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean saveReplace(T entity); |
| | | |
| | | /** |
| | | * æå
¥ï¼æ¹éï¼,æå
¥å¦æä¸å·²ç»åå¨ç¸åçè®°å½ï¼å忽ç¥å½åæ°æ°æ® |
| | | * |
| | | * @param entityList å®ä½å¯¹è±¡éå |
| | | * @param batchSize æ¹æ¬¡å¤§å° |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean saveIgnoreBatch(Collection<T> entityList, int batchSize); |
| | | |
| | | /** |
| | | * æå
¥ï¼æ¹éï¼,æå
¥å¦æä¸å·²ç»åå¨ç¸åçè®°å½ï¼å忽ç¥å½åæ°æ°æ® |
| | | * |
| | | * @param entityList å®ä½å¯¹è±¡éå |
| | | * @return æ¯å¦æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | default boolean saveIgnoreBatch(Collection<T> entityList) { |
| | | return saveIgnoreBatch(entityList, 1000); |
| | | } |
| | | |
| | | /** |
| | | * æå
¥ï¼æ¹éï¼,表示æå
¥æ¿æ¢æ°æ®ï¼éæ±è¡¨ä¸æPrimaryKeyï¼æè
uniqueç´¢å¼ï¼å¦ææ°æ®åºå·²ç»å卿°æ®ï¼åç¨æ°æ°æ®æ¿æ¢ï¼å¦ææ²¡ææ°æ®ææååinsert into䏿 ·ï¼ |
| | | * |
| | | * @param entityList å®ä½å¯¹è±¡éå |
| | | * @param batchSize æ¹æ¬¡å¤§å° |
| | | * @return æ¯å¦æå |
| | | */ |
| | | boolean saveReplaceBatch(Collection<T> entityList, int batchSize); |
| | | |
| | | /** |
| | | * æå
¥ï¼æ¹éï¼,表示æå
¥æ¿æ¢æ°æ®ï¼éæ±è¡¨ä¸æPrimaryKeyï¼æè
uniqueç´¢å¼ï¼å¦ææ°æ®åºå·²ç»å卿°æ®ï¼åç¨æ°æ°æ®æ¿æ¢ï¼å¦ææ²¡ææ°æ®ææååinsert into䏿 ·ï¼ |
| | | * |
| | | * @param entityList å®ä½å¯¹è±¡éå |
| | | * @return æ¯å¦æå |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | default boolean saveReplaceBatch(Collection<T> entityList) { |
| | | return saveReplaceBatch(entityList, 1000); |
| | | } |
| | | } |