org.apache.ibatis.annotations.Insert Java Examples

The following examples show how to use org.apache.ibatis.annotations.Insert. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PointStrategyDao.java    From sds with Apache License 2.0 8 votes vote down vote up
/**
 * 批量新增降级点策略
 *
 * @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);
 
Example #2
Source File: CommonMapper.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@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);
 
Example #3
Source File: CommonMapper.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@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);
 
Example #4
Source File: CommonMapper.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@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);
 
Example #5
Source File: AuditMapper.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@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);
 
Example #6
Source File: PostgresDeviceLogMapper.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
@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);
 
Example #7
Source File: UserPrivilegeDao.java    From sds with Apache License 2.0 5 votes vote down vote up
/**
 * 给某个用户新增权限
 *
 * @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);
 
Example #8
Source File: PointStrategyDao.java    From sds with Apache License 2.0 5 votes vote down vote up
/**
 * 新增降级点策略
 *
 * @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);
 
Example #9
Source File: HeartbeatDao.java    From sds with Apache License 2.0 5 votes vote down vote up
/**
 * 新增心跳数据
 *
 * @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);
 
Example #10
Source File: UserMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert({"INSERT INTO users (login, email, name, password, customerId, userRoleId, allDevicesAvailable) " +
        "VALUES (#{login}, #{email}, #{name}, #{password}, #{customerId}, #{userRole.id}, #{allDevicesAvailable})"})
@SelectKey( statement = "SELECT currval('users_id_seq')", keyColumn = "id", keyProperty = "id", before = false, resultType = int.class )
void insert(User user);
 
Example #11
Source File: PacDao.java    From owlaser-paclist with MIT License 4 votes vote down vote up
@Insert("INSERT INTO security_vulnerabilities(name, ecosystem, severity, GHSA_id, GHSA_url, CVE_id, CVE_url, vulnerableVersionRange, firstPatchedVersion) " +
        "VALUE(#{name}, #{ecosystem}, #{severity}, #{GHSA_id}, #{GHSA_url}, #{CVE_id}, #{CVE_url}, #{vulnerableVersionRange}, #{firstPatchedVersion})")
public void insertSecurity(@Param("name")String name, @Param("ecosystem")String ecosystem, @Param("severity")String severity,
                           @Param("GHSA_id")String GHSA_id, @Param("GHSA_url")String GHSA_url, @Param("CVE_id")String CVE_id,
                           @Param("CVE_url")String CVE_url, @Param("vulnerableVersionRange")String vulnerableVersionRange,
                           @Param("firstPatchedVersion")String firstPatchedVersion);
 
Example #12
Source File: UserMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO userHints (userId, hintKey) VALUES (#{userId}, #{hintKey})")
int insertShownHint(@Param("userId") Integer userId, @Param("hintKey") String hintKey);
 
Example #13
Source File: NotificationMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO pushMessages (messageType, deviceId, payload) " +
        "VALUES (#{messageType}, #{deviceId}, #{payload})")
@SelectKey( statement = "SELECT currval('pushmessages_id_seq')", keyColumn = "id", keyProperty = "id", before = false, resultType = int.class )
void insertPushMessage(PushMessage message);
 
Example #14
Source File: PacDao.java    From owlaser-paclist with MIT License 4 votes vote down vote up
@Insert("INSERT INTO maven_childNodes(parent_groupid, parent_artifactid, child_groupid, child_artifactid, url) VALUES(#{parent_groupid}, #{parent_artifactid}, #{child_groupid}, #{child_artifactid}, #{url})")
public void insertChild(@Param("parent_groupid")String parent_groupid, @Param("parent_artifactid")String parent_artifactid, @Param("child_groupid")String child_groupid, @Param("child_artifactid")String child_artifactid, @Param("url")String url);
 
Example #15
Source File: PacDao.java    From owlaser-paclist with MIT License 4 votes vote down vote up
@Insert("INSERT INTO maven_dependency(group_id, artifact_id, popular_version, stable_version, license)  VALUES(#{group_id}, #{artifact_id}, #{popular_version}, #{stable_version}, #{license})")
public void insert(Dependency dependency);
 
Example #16
Source File: StockOrderMapper.java    From seconds-kill with MIT License 4 votes vote down vote up
@Insert("INSERT INTO stock_order (id, sid, name, create_time) VALUES " +
        "(#{id, jdbcType = INTEGER}, #{sid, jdbcType = INTEGER}, #{name, jdbcType = VARCHAR}, #{createTime, jdbcType = TIMESTAMP})")
int insertSelective(StockOrder order);
 
Example #17
Source File: AccountDao.java    From java_study with Apache License 2.0 4 votes vote down vote up
@Insert("insert into account (name, money) values (#{name}, #{money})")
public void savaAccount(Account account);
 
Example #18
Source File: NotificationMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO pendingPushes (messageId, status, createTime) " +
        "VALUES (#{messageId}, 0, EXTRACT(EPOCH FROM NOW()) * 1000)")
void insertPendingPush(int messageId);
 
Example #19
Source File: CustomerMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert({"INSERT INTO customers (name, description, filesDir, master, prefix, registrationTime) " +
        "VALUES (#{name}, #{description}, #{filesDir}, FALSE, #{prefix}, #{registrationTime})"})
@SelectKey( statement = "SELECT currval('customers_id_seq')", keyColumn = "id", keyProperty = "id", before = false, resultType = int.class )
void insert(Customer customer);
 
Example #20
Source File: MethodMapper.java    From opscenter with Apache License 2.0 4 votes vote down vote up
/**
 * 批量插入SQL内容
 */
@Insert({ "<script>", "insert ingrid_method_sql (methodId,line,content) values",
        "<foreach collection='methodSqlBeanList' item='item' index='index' separator=','>",
        "(#{methodSqlBeanList.methodId}, #{methodSqlBeanList.line}, #{methodSqlBeanList.content})", "</foreach>",
        "</script>" })
public void insertMethodSqlBeanList(@Param(value = "methodSqlBeanList") List<MethodSqlBean> methodSqlBeanList);
 
Example #21
Source File: ApplicationMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert({"INSERT INTO applications (name, pkg, showIcon, system, customerId, runAfterInstall, runAtBoot, type, iconText, iconId) " +
        "VALUES (#{name}, #{pkg}, #{showIcon}, #{system}, #{customerId}, #{runAfterInstall}, #{runAtBoot}, #{type}, #{iconText}, #{iconId})"})
@SelectKey( statement = "SELECT currval('applications_id_seq')", keyColumn = "id", keyProperty = "id", before = false, resultType = int.class )
void insertApplication(Application application);
 
Example #22
Source File: CustomerMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO plugin_licensing_settings (apiKey, customerId) VALUES (#{apiKey}, #{id}) " +
        "ON CONFLICT ON CONSTRAINT plugin_licensing_settings_customer_unique DO " +
        "UPDATE SET " +
        "apiKey = EXCLUDED.apiKey"
)
void saveApiKey(Customer customer);
 
Example #23
Source File: UserMapper.java    From Spring-Boot-Book with Apache License 2.0 4 votes vote down vote up
@Insert("insert into user(name,age) values(#{name},#{age})")
int addUser(@Param("name")String name,@Param("age")String age);
 
Example #24
Source File: OrderMapper.java    From simple-microservice with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO orders (order_number,order_product_name,order_price,COUNT,buy_date) VALUES  (#{orderNumber},#{orderProductName},#{orderPrice},#{count},#{buyDate})")
int submitOrder(@Param("orderNumber") String orderNumber,@Param("orderProductName") String orderProductName,@Param("orderPrice")  Double orderPrice,@Param("count") int count,@Param("buyDate") Date buyDate);
 
Example #25
Source File: SysUserRoleMapper.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
@Insert("insert into sys_role_user(user_id, role_id) values(#{userId}, #{roleId})")
int saveUserRoles(@Param("userId") Long userId, @Param("roleId") Long roleId);
 
Example #26
Source File: SysRoleMenuMapper.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
@Insert("insert into sys_role_menu(role_id, menu_id) values(#{roleId}, #{menuId})")
int save(@Param("roleId") Long roleId, @Param("menuId") Long menuId);
 
Example #27
Source File: BaseDemoMapper.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
@Insert("insert into t_demo(kid, demo_field, group_id, create_time,app_name) values(#{kid}, #{demoField}, #{groupId}, #{createTime},#{appName})")
void save(Demo demo);
 
Example #28
Source File: WechatDao.java    From cloud-service with MIT License 4 votes vote down vote up
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into t_wechat(openid, unionid, userId, app, nickname, sex, province, city, country, headimgurl, createTime, updateTime) " +
        "values(#{openid}, #{unionid}, #{userId}, #{app}, #{nickname}, #{sex}, #{province}, #{city}, #{country}, #{headimgurl}, #{createTime}, #{updateTime})")
int save(WechatUserInfo info);
 
Example #29
Source File: SysRoleDao.java    From cloud-service with MIT License 4 votes vote down vote up
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into sys_role(code, name, createTime, updateTime) values(#{code}, #{name}, #{createTime}, #{createTime})")
int save(SysRole sysRole);
 
Example #30
Source File: IconMapper.java    From hmdm-server with Apache License 2.0 4 votes vote down vote up
@Insert("INSERT INTO icons (customerId, name, fileId) VALUES (#{customerId}, #{name}, #{fileId})")
@SelectKey(statement = "SELECT currval('icons_id_seq')", keyColumn = "id", keyProperty = "id", before = false, resultType = int.class)
int insertIcon(Icon icon);