下面列出了怎么用org.apache.ibatis.annotations.Insert的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* 批量新增降级点策略
*
* @param strategyDOList
* @return
*/
@Insert("<script> insert into point_strategy (app_group_name, app_name, point, sds_scheme_name, "
+ "visit_threshold, " +
"concurrent_threshold, exception_threshold, exception_rate_threshold, exception_rate_start, "
+ "timeout_threshold, " +
"timeout_count_threshold, token_bucket_generated_tokens_in_second, token_bucket_size, delay_time, "
+ "retry_interval, downgrade_rate, pressure_test_downgrade, status, operator_name, operator_email, "
+ "creator_name, creator_email) " +
"values " +
"<foreach collection=\"strategyDOList\" item=\"strategyDO\" separator=\",\" open=\"(\" close=\")\" >" +
"#{strategyDO.appGroupName}, #{strategyDO.appName}, #{strategyDO.point}, #{strategyDO.sdsSchemeName},"
+ " #{strategyDO.visitThreshold}, #{strategyDO.concurrentThreshold}, " +
"#{strategyDO.exceptionThreshold}, #{strategyDO.exceptionRateThreshold}, #{strategyDO"
+ ".exceptionRateStart}, #{strategyDO.timeoutThreshold}, #{strategyDO.timeoutCountThreshold}, " +
"#{strategyDO.tokenBucketGeneratedTokensInSecond}, #{strategyDO.tokenBucketSize}, #{strategyDO"
+ ".delayTime}, #{strategyDO.retryInterval}, #{strategyDO.downgradeRate}, #{strategyDO"
+ ".pressureTestDowngrade}, #{strategyDO.status}, " +
"#{strategyDO.operatorName}, #{strategyDO.operatorEmail}, #{strategyDO.creatorName}, #{strategyDO"
+ ".creatorEmail}" +
" </foreach>" +
" </script>")
int addPointStrategyBatch(List<PointStrategyDO> strategyDOList);
@Insert({
"INSERT INTO settings (" +
"backgroundColor, " +
"textColor, " +
"backgroundImageUrl, " +
"iconSize, " +
"desktopHeader, " +
"customerId" +
") VALUES (" +
"#{backgroundColor}, " +
"#{textColor}, " +
"#{backgroundImageUrl}, " +
"#{iconSize}, " +
"#{desktopHeader}, " +
"#{customerId}" +
") " +
"ON CONFLICT ON CONSTRAINT settings_customer_unique DO " +
"UPDATE SET " +
"backgroundColor = EXCLUDED.backgroundColor, " +
"textColor = EXCLUDED.textColor, " +
"backgroundImageUrl = EXCLUDED.backgroundImageUrl, " +
"iconSize = EXCLUDED.iconSize, " +
"desktopHeader = EXCLUDED.desktopHeader"
})
void saveDefaultDesignSettings(Settings settings);
@Insert({
"INSERT INTO settings (" +
"useDefaultLanguage, " +
"language, " +
"customerId" +
") VALUES (" +
"#{useDefaultLanguage}, " +
"#{language}, " +
"#{customerId}" +
") " +
"ON CONFLICT ON CONSTRAINT settings_customer_unique DO " +
"UPDATE SET " +
"useDefaultLanguage = EXCLUDED.useDefaultLanguage, " +
"language = EXCLUDED.language"
})
void saveLanguageSettings(Settings settings);
@Insert({
"INSERT INTO settings (" +
"createNewDevices, " +
"newDeviceGroupId, " +
"newDeviceConfigurationId, " +
"phoneNumberFormat, " +
"customerId" +
") VALUES (" +
"#{createNewDevices}, " +
"#{newDeviceGroupId}, " +
"#{newDeviceConfigurationId}, " +
"#{phoneNumberFormat}, " +
"#{customerId}" +
") " +
"ON CONFLICT ON CONSTRAINT settings_customer_unique DO " +
"UPDATE SET " +
"createNewDevices = EXCLUDED.createNewDevices, " +
"newDeviceGroupId = EXCLUDED.newDeviceGroupId, " +
"newDeviceConfigurationId = EXCLUDED.newDeviceConfigurationId, " +
"phoneNumberFormat = EXCLUDED.phoneNumberFormat"
})
void saveMiscSettings(Settings settings);
@Insert({"INSERT INTO plugin_audit_log (" +
" createTime," +
" customerId," +
" userId," +
" login," +
" action," +
" payload," +
" ipAddress," +
" errorCode" +
") " +
"VALUES (" +
" #{createTime}," +
" #{customerId}," +
" #{userId}," +
" #{login}," +
" #{action}," +
" #{payload}," +
" #{ipAddress}," +
" #{errorCode}" +
")"})
int insertAuditLogRecord(AuditLogRecord logRecord);
@Insert("INSERT INTO plugin_devicelog_settings_rules (" +
" settingId, " +
" name, " +
" active, " +
" applicationId, " +
" severity, " +
" filter, " +
" groupId, " +
" configurationId " +
") " +
"VALUES (" +
" #{settingId}, " +
" #{name}, " +
" #{active}, " +
" #{applicationId}, " +
" #{severity}, " +
" #{filter}, " +
" #{groupId}, " +
" #{configurationId} " +
")")
@SelectKey( statement = "SELECT currval('plugin_devicelog_settings_rules_id_seq')",
keyColumn = "id", keyProperty = "id", before = false, resultType = int.class )
void insertPluginSettingsRule(PostgresDeviceLogRule rule);
/**
* 新增心跳数据
*
* @param heartbeatDOList
* @return
*/
@Insert("<script> insert into heartbeat(app_group_name, app_name, point, downgrade_num, visit_num, exception_num,"
+ " timeout_num, max_concurrent_num, app_ip, statistics_cycle_time)" +
" values" +
" <foreach collection=\"heartbeatDOList\" item=\"heartbeatDO\" separator=\",\">" +
"( #{heartbeatDO.appGroupName}, #{heartbeatDO.appName}, #{heartbeatDO.point}, #{heartbeatDO"
+ ".downgradeNum}, #{heartbeatDO.visitNum}, " +
"#{heartbeatDO.exceptionNum}, #{heartbeatDO.timeoutNum}, #{heartbeatDO.maxConcurrentNum}, #{heartbeatDO"
+ ".appIp}, #{heartbeatDO.statisticsCycleTime} )" +
"</foreach> </script>")
int addHeartbeat(@Param("heartbeatDOList") List<HeartbeatDO> heartbeatDOList);
/**
* 新增降级点策略
*
* @param strategyDO
* @return
*/
@Insert("<script> insert into point_strategy (app_group_name, app_name, point, sds_scheme_name, "
+ "downgrade_rate, status, operator_name, operator_email, creator_name, creator_email" +
"<if test='visitThreshold != null'> , visit_threshold </if> " +
"<if test='concurrentThreshold != null'> , concurrent_threshold </if> " +
"<if test='exceptionThreshold != null'> , exception_threshold </if> " +
"<if test='exceptionRateThreshold != null'> , exception_rate_threshold </if> " +
"<if test='exceptionRateStart != null'> , exception_rate_start </if> " +
"<if test='timeoutThreshold != null'> , timeout_threshold </if> " +
"<if test='timeoutCountThreshold != null'> , timeout_count_threshold </if> " +
"<if test='tokenBucketGeneratedTokensInSecond != null'> , token_bucket_generated_tokens_in_second </if> " +
"<if test='tokenBucketSize != null'> , token_bucket_size </if> " +
"<if test='delayTime != null'> , delay_time </if> " +
"<if test='pressureTestDowngrade != null'> , pressure_test_downgrade </if> " +
"<if test='retryInterval != null'> , retry_interval </if> ) " +
" values(#{appGroupName}, #{appName}, #{point}, #{sdsSchemeName}, #{downgradeRate}, #{status}, "
+ "#{operatorName}, #{operatorEmail}, #{creatorName}, #{creatorEmail}" +
"<if test='visitThreshold != null'> , #{visitThreshold} </if> " +
"<if test='concurrentThreshold != null'> , #{concurrentThreshold} </if> " +
"<if test='exceptionThreshold != null'> , #{exceptionThreshold} </if> " +
"<if test='exceptionRateThreshold != null'> , #{exceptionRateThreshold} </if> " +
"<if test='exceptionRateStart != null'> , #{exceptionRateStart} </if> " +
"<if test='timeoutThreshold != null'> , #{timeoutThreshold} </if> " +
"<if test='timeoutCountThreshold != null'> , #{timeoutCountThreshold} </if> " +
"<if test='tokenBucketGeneratedTokensInSecond != null'> , #{tokenBucketGeneratedTokensInSecond} </if> " +
"<if test='tokenBucketSize != null'> , #{tokenBucketSize} </if> " +
"<if test='delayTime != null'> , #{delayTime} </if> " +
"<if test='pressureTestDowngrade != null'> , #{pressureTestDowngrade} </if> " +
"<if test='retryInterval != null'> , #{retryInterval} </if> )" +
" </script>")
int addPointStrategy(PointStrategyDO strategyDO);
/**
* 给某个用户新增权限
*
* @param userName
* @param appGroupName
* @param appName
* @return
*/
@Insert("<script> insert into user_privilege(user_name, app_group_name, app_name) " +
"values" +
"<foreach collection=\"appNameList\" start=\"(\" end=\")\" item=\"appName\">" +
"#{userName}, #{appGroupName}, #{appName}" +
"</foreach>" +
" </script>")
int addUserPrivilege(@Param("userName") String userName,
@Param("userPrivilegeList") List<UserPrivilege> userPrivilegeList);
@Insert("insert into user(name,age) values(#{name},#{age})")
int addUser(@Param("name")String name,@Param("age")String age);
@Insert("insert into user(name,age) values(#{name},#{age})")
int addUser(@Param("name")String name,@Param("age")String age);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_sms(phone, signName, templateCode, params, day, createTime, updateTime) "
+ "values(#{phone}, #{signName}, #{templateCode}, #{params}, #{day}, #{createTime}, #{updateTime})")
int save(Sms sms);
@Insert("insert into file_info(id, name, isImg, contentType, size, path, url, source, createTime) "
+ "values(#{id}, #{name}, #{isImg}, #{contentType}, #{size}, #{path}, #{url}, #{source}, #{createTime})")
int save(FileInfo fileInfo);
@Insert("insert into sys_menu(parentId, name, url, path, css, sort, createTime, updateTime,isMenu,hidden) "
+ "values (#{parentId}, #{name}, #{url} , #{path} , #{css}, #{sort}, #{createTime}, #{updateTime},#{isMenu},#{hidden})")
int save(SysMenu menu);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_permission(permission, name, createTime, updateTime) values(#{permission}, #{name}, #{createTime}, #{createTime})")
int save(SysPermission sysPermission);
@Insert("insert into sys_role_menu(roleId, menuId) values(#{roleId}, #{menuId})")
int save(@Param("roleId") Long roleId, @Param("menuId") Long menuId);
@Insert("insert into sys_role_permission(roleId, permissionId) values(#{roleId}, #{permissionId})")
int saveRolePermission(@Param("roleId") Long roleId, @Param("permissionId") Long permissionId);
@Insert("insert into sys_test(username ) "
+ "values ('test' )")
int save(Map<String,String> params);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_user(username, password, nickname, headImgUrl, phone, sex, enabled, type, createTime, updateTime) "
+ "values(#{username}, #{password}, #{nickname}, #{headImgUrl}, #{phone}, #{sex}, #{enabled}, #{type}, #{createTime}, #{updateTime})")
int save(SysUser sysUser);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_role(code, name, createTime, updateTime) values(#{code}, #{name}, #{createTime}, #{createTime})")
int save(SysRole sysRole);
@Insert("insert into sys_test(username ) "
+ "values ('test' )")
int save(Map<String,String> params);
@Insert("insert into sys_role_user(userId, roleId) values(#{userId}, #{roleId})")
int saveUserRoles(@Param("userId") Long userId, @Param("roleId") Long roleId);
@Insert("insert into sys_log(username, module, params, remark, flag, createTime) values(#{username}, #{module}, #{params}, #{remark}, #{flag}, #{createTime})")
int save(SysLog log);
@Insert("insert into sys_client_service(clientId, serviceId) values(#{clientId}, #{serviceId})")
int save(@Param("clientId") Long clientId, @Param("serviceId") Long serviceId);
@Insert("insert into sys_role (role_name,role_code,role_desc,ds_type,ds_scope) values (#{roleName}, #{roleCode},#{roleDesc},#{dsType},#{dsScope})")
@Options(useGeneratedKeys=true, keyProperty="roleId", keyColumn="role_id")
Boolean insertRole(SysRole sysRole);
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into oauth_client_details(client_id, resource_ids, client_secret,client_secret_str, scope, authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, refresh_token_validity, additional_information, autoapprove) values(#{clientId}, #{resourceIds}, #{clientSecret},#{clientSecretStr}, #{scope}, #{authorizedGrantTypes}, #{webServerRedirectUri}, #{authorities}, #{accessTokenValidity}, #{refreshTokenValidity}, #{additionalInformation}, #{autoapprove})")
int save(Client client);
@Insert("INSERT INTO plugin1 VALUES (#{id}, #{name})")
void insert(@Param("id") String id, @Param("name") String name);
@Insert("INSERT INTO plugin1 VALUES (#{id}, #{name})")
void insert(@Param("id") String id, @Param("name") String name);
@Insert("INSERT INTO plugin2 VALUES (#{id}, #{name})")
void save(@Param("id") String id, @Param("name") String name);
@Insert("insert into student(name, age) values(#{name}, #{age})")
int add(Student student);