/** * 保存一个实体,null的属性不会保存,会使用数据库默认值 * * @param record * @return */ @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL") int insertSelective(T record);
} else if (method.isAnnotationPresent(InsertProvider.class)) { InsertProvider provider = method.getAnnotation(InsertProvider.class); tempClass = provider.type(); methodSet.add(method.getName()); } else if (method.isAnnotationPresent(DeleteProvider.class)) {
/** * 保存一个实体,null的属性也会保存,不会使用数据库默认值 * * @param record * @return */ @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL") int insert(T record);
} else if (method.isAnnotationPresent(InsertProvider.class)) { InsertProvider provider = method.getAnnotation(InsertProvider.class); tempClass = provider.type(); methodSet.add(method.getName()); } else if (method.isAnnotationPresent(DeleteProvider.class)) {
/** * 保存一个实体,null的属性也会保存,不会使用数据库默认值 * * @param record * @return */ @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL") int insert(T record);
/** * 保存一个实体,null的属性不会保存,会使用数据库默认值 * * @param record * @return */ @InsertProvider(type = BaseInsertProvider.class, method = "dynamicSQL") int insertSelective(T record);
/** * <p>生成如下批量SQL: * <p>INSERT ALL * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>SELECT 1 FROM DUAL * * @param recordList * @return */ @InsertProvider(type = OracleProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList);
/** * 批量插入,支持批量插入的数据库可以使用,例如MySQL,H2等 * <p> * 不支持主键策略,插入前需要设置好主键的值 * <p> * 特别注意:2018-04-22 后,该方法支持 @KeySql 注解的 genId 方式 * * @param recordList * @return */ @InsertProvider(type = InsertListProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList); }
/** * <p>生成如下批量SQL: * <p>INSERT ALL * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>INTO demo_country ( country_id,country_name,country_code ) VALUES ( ?,?,? ) * <p>SELECT 1 FROM DUAL * * @param recordList * @return */ @InsertProvider(type = OracleProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList);
/** * 批量插入,支持批量插入的数据库可以使用,例如MySQL,H2等 * <p> * 不支持主键策略,插入前需要设置好主键的值 * <p> * 特别注意:2018-04-22 后,该方法支持 @KeySql 注解的 genId 方式 * * @param recordList * @return */ @InsertProvider(type = InsertListProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList); }
/** * 批量插入List * insertAllTaobao是RestProvider中的一个方法,这里相当于反射 * Param("list")中的list必须与insertAllTaobao中的list名字一致 */ @InsertProvider(type = RestProvider.class, method = "insertAllTaobao") void insertAll(@Param("list") List<TaobaoModel> users);
/** * 批量插入List * insertAllTaobao是RestProvider中的一个方法,这里相当于反射 * Param("list")中的list必须与insertAllTaobao中的list名字一致 */ @InsertProvider(type = RestProvider.class, method = "insertAllTaobao") void insertAll(@Param("list") List<TaobaoModel> users);
/** * 插入数据库,`null`值也会插入,不会使用列的默认值 * * @param record * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SqlServerProvider.class, method = "dynamicSQL") int insert(T record);
/** * 插入数据,限制为实体包含`id`属性并且必须为自增列,实体配置的主键策略无效 * * @param record * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL") int insertUseGeneratedKeys(T record);
/** * 插入数据库,`null`值也会插入,不会使用列的默认值 * * @param record * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SqlServerProvider.class, method = "dynamicSQL") int insert(T record);
/** * 批量插入,支持批量插入的数据库可以使用,例如MySQL,H2等,另外该接口限制实体包含`id`属性并且必须为自增列 * * @param recordList * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList);
/** * 批量插入,支持批量插入的数据库可以使用,例如MySQL,H2等,另外该接口限制实体包含`id`属性并且必须为自增列 * * @param recordList * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL") int insertList(List<? extends T> recordList);
/** * 插入数据,限制为实体包含`id`属性并且必须为自增列,实体配置的主键策略无效 * * @param record * @return */ @Options(useGeneratedKeys = true) @InsertProvider(type = SpecialProvider.class, method = "dynamicSQL") int insertUseGeneratedKeys(T record);
@Options(useGeneratedKeys = true) @InsertProvider(type = SqlServerProvider.class, method = "dynamicSQL") int insertSelective(T record);
@Options(useGeneratedKeys = true) @InsertProvider(type = SqlServerProvider.class, method = "dynamicSQL") int insertSelective(T record);