Java 类org.apache.ibatis.annotations.SelectKey 实例源码

项目:mybatis-plus-mini    文件:MybatisMapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
    String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
    Class<?> resultTypeClass = selectKeyAnnotation.resultType();
    StatementType statementType = selectKeyAnnotation.statementType();
    String keyProperty = selectKeyAnnotation.keyProperty();
    String keyColumn = selectKeyAnnotation.keyColumn();
    boolean executeBefore = selectKeyAnnotation.before();

    // defaults
    boolean useCache = false;
    KeyGenerator keyGenerator = NoKeyGenerator.INSTANCE;
    Integer fetchSize = null;
    Integer timeout = null;
    boolean flushCache = false;
    String parameterMap = null;
    String resultMap = null;
    ResultSetType resultSetTypeEnum = null;

    SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
    SqlCommandType sqlCommandType = SqlCommandType.SELECT;

    assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
            flushCache, useCache, false,
            keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

    id = assistant.applyCurrentNamespace(id, false);

    MappedStatement keyStatement = configuration.getMappedStatement(id, false);
    SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
    configuration.addKeyGenerator(id, answer);
    return answer;
}
项目:easymall    文件:SimpleMybatisMapper.java   
@InsertProvider(type = SimpleMybatisSqlProvider.class, method = "insert")
@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Long.class)
int insert(SimpleTable simpleTable);
项目:MybatisCode    文件:MapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
  String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
  Class<?> resultTypeClass = selectKeyAnnotation.resultType();
  StatementType statementType = selectKeyAnnotation.statementType();
  String keyProperty = selectKeyAnnotation.keyProperty();
  String keyColumn = selectKeyAnnotation.keyColumn();
  boolean executeBefore = selectKeyAnnotation.before();

  // defaults
  boolean useCache = false;
  KeyGenerator keyGenerator = new NoKeyGenerator();
  Integer fetchSize = null;
  Integer timeout = null;
  boolean flushCache = false;
  String parameterMap = null;
  String resultMap = null;
  ResultSetType resultSetTypeEnum = null;

  SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
  SqlCommandType sqlCommandType = SqlCommandType.SELECT;

  assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
      flushCache, useCache, false,
      keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

  id = assistant.applyCurrentNamespace(id, false);

  MappedStatement keyStatement = configuration.getMappedStatement(id, false);
  SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
  configuration.addKeyGenerator(id, answer);
  return answer;
}
项目:judge    文件:ProblemMapper.java   
@Insert("INSERT INTO problem (problem_id,title,description,input,output,sample_input,sample_output,"
        + "hint,source,in_date,time_limit,memory_limit,disabled) values ("
        + "#{id},COALESCE(#{title},''),COALESCE(#{description},''),COALESCE(#{input},''),COALESCE(#{output},''),COALESCE(#{sampleInput},''),COALESCE(#{sampleOutput},''),"
        + "COALESCE(#{hint},''),COALESCE(#{source},''),now(),#{timeLimit},#{memoryLimit},#{disabled})")
@SelectKey(statement = "select COALESCE(max(problem_id)+1,1000) maxp from problem",
        before = true, keyProperty = "id", resultType = long.class)
long save(Problem problem);
项目:mybatis    文件:MapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
  String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
  Class<?> resultTypeClass = selectKeyAnnotation.resultType();
  StatementType statementType = selectKeyAnnotation.statementType();
  String keyProperty = selectKeyAnnotation.keyProperty();
  String keyColumn = selectKeyAnnotation.keyColumn();
  boolean executeBefore = selectKeyAnnotation.before();

  // defaults
  boolean useCache = false;
  KeyGenerator keyGenerator = new NoKeyGenerator();
  Integer fetchSize = null;
  Integer timeout = null;
  boolean flushCache = false;
  String parameterMap = null;
  String resultMap = null;
  ResultSetType resultSetTypeEnum = null;

  SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
  SqlCommandType sqlCommandType = SqlCommandType.SELECT;

  assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
      flushCache, useCache, false,
      keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

  id = assistant.applyCurrentNamespace(id, false);

  MappedStatement keyStatement = configuration.getMappedStatement(id, false);
  SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
  configuration.addKeyGenerator(id, answer);
  return answer;
}
项目:mybatis-plus    文件:MybatisMapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
    String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
    Class<?> resultTypeClass = selectKeyAnnotation.resultType();
    StatementType statementType = selectKeyAnnotation.statementType();
    String keyProperty = selectKeyAnnotation.keyProperty();
    String keyColumn = selectKeyAnnotation.keyColumn();
    boolean executeBefore = selectKeyAnnotation.before();

    // defaults
    boolean useCache = false;
    KeyGenerator keyGenerator = NoKeyGenerator.INSTANCE;
    Integer fetchSize = null;
    Integer timeout = null;
    boolean flushCache = false;
    String parameterMap = null;
    String resultMap = null;
    ResultSetType resultSetTypeEnum = null;

    SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
    SqlCommandType sqlCommandType = SqlCommandType.SELECT;

    assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
            flushCache, useCache, false,
            keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

    id = assistant.applyCurrentNamespace(id, false);

    MappedStatement keyStatement = configuration.getMappedStatement(id, false);
    SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
    configuration.addKeyGenerator(id, answer);
    return answer;
}
项目:mybaties    文件:MapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
  String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
  Class<?> resultTypeClass = selectKeyAnnotation.resultType();
  StatementType statementType = selectKeyAnnotation.statementType();
  String keyProperty = selectKeyAnnotation.keyProperty();
  String keyColumn = selectKeyAnnotation.keyColumn();
  boolean executeBefore = selectKeyAnnotation.before();

  // defaults
  boolean useCache = false;
  KeyGenerator keyGenerator = new NoKeyGenerator();
  Integer fetchSize = null;
  Integer timeout = null;
  boolean flushCache = false;
  String parameterMap = null;
  String resultMap = null;
  ResultSetType resultSetTypeEnum = null;

  SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
  SqlCommandType sqlCommandType = SqlCommandType.SELECT;

  assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
      flushCache, useCache, false,
      keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

  id = assistant.applyCurrentNamespace(id, false);

  MappedStatement keyStatement = configuration.getMappedStatement(id, false);
  SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
  configuration.addKeyGenerator(id, answer);
  return answer;
}
项目:play    文件:MapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
  String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
  Class<?> resultTypeClass = selectKeyAnnotation.resultType();
  StatementType statementType = selectKeyAnnotation.statementType();
  String keyProperty = selectKeyAnnotation.keyProperty();
  String keyColumn = selectKeyAnnotation.keyColumn();
  boolean executeBefore = selectKeyAnnotation.before();

  // defaults
  boolean useCache = false;
  KeyGenerator keyGenerator = new NoKeyGenerator();
  Integer fetchSize = null;
  Integer timeout = null;
  boolean flushCache = false;
  String parameterMap = null;
  String resultMap = null;
  ResultSetType resultSetTypeEnum = null;

  SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
  SqlCommandType sqlCommandType = SqlCommandType.SELECT;

  assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
      flushCache, useCache, false,
      keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

  id = assistant.applyCurrentNamespace(id, false);

  MappedStatement keyStatement = configuration.getMappedStatement(id, false);
  SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
  configuration.addKeyGenerator(id, answer);
  return answer;
}
项目:mybatis-3    文件:MapperAnnotationBuilder.java   
private KeyGenerator handleSelectKeyAnnotation(SelectKey selectKeyAnnotation, String baseStatementId, Class<?> parameterTypeClass, LanguageDriver languageDriver) {
  String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
  Class<?> resultTypeClass = selectKeyAnnotation.resultType();
  StatementType statementType = selectKeyAnnotation.statementType();
  String keyProperty = selectKeyAnnotation.keyProperty();
  String keyColumn = selectKeyAnnotation.keyColumn();
  boolean executeBefore = selectKeyAnnotation.before();

  // defaults
  boolean useCache = false;
  KeyGenerator keyGenerator = NoKeyGenerator.INSTANCE;
  Integer fetchSize = null;
  Integer timeout = null;
  boolean flushCache = false;
  String parameterMap = null;
  String resultMap = null;
  ResultSetType resultSetTypeEnum = null;

  SqlSource sqlSource = buildSqlSourceFromStrings(selectKeyAnnotation.statement(), parameterTypeClass, languageDriver);
  SqlCommandType sqlCommandType = SqlCommandType.SELECT;

  assistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType, fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass, resultSetTypeEnum,
      flushCache, useCache, false,
      keyGenerator, keyProperty, keyColumn, null, languageDriver, null);

  id = assistant.applyCurrentNamespace(id, false);

  MappedStatement keyStatement = configuration.getMappedStatement(id, false);
  SelectKeyGenerator answer = new SelectKeyGenerator(keyStatement, executeBefore);
  configuration.addKeyGenerator(id, answer);
  return answer;
}
项目:easy-test    文件:SimpleMybatisMapper.java   
@InsertProvider(type = SimpleMybatisSqlProvider.class, method = "insert")
@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Long.class)
void insert(SimpleTable simpleTable);
项目:k-framework    文件:PaymentExceptionLogMapper.java   
@InsertProvider(type = PaymentExceptionLogSqlBuilder.class, method = "insert")
@SelectKey(statement = "select last_insert_id()", keyProperty = "id", before = false, resultType = Long.class)
int insert(PaymentExceptionLog record);
项目:k-framework    文件:WxAppSessionMapper.java   
@InsertProvider(type = WxAppSessionSqlBuilder.class, method = SqlBuilderConstant.INSERT)
@SelectKey(statement = "select last_insert_id()", keyProperty = "id", before = false, resultType = Long.class)
int insert(WxAppSession record);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)
int insertTable2(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id, name_fred from table2 where id = identity()", keyProperty="nameId,generatedName", keyColumn="ID,NAME_FRED", before=false, resultType=Map.class)
int insertTable2WithSelectKeyWithKeyMap(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id as nameId, name_fred as generatedName from table2 where id = identity()", keyProperty="nameId,generatedName", before=false, resultType=Name.class)
int insertTable2WithSelectKeyWithKeyObject(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Insert("insert into table3 (id, name) values(#{nameId}, #{name})")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@InsertProvider(type=SqlProvider.class,method="insertTable3_2")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3_2(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred from table2 where id = #{nameId}", keyProperty="generatedName", keyColumn="NAME_FRED", before=false, resultType=String.class)
int updateTable2WithSelectKeyWithKeyMap(Name name);
项目:MybatisCode    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred as generatedName from table2 where id = #{nameId}", keyProperty="generatedName", before=false, resultType=Name.class)
int updateTable2WithSelectKeyWithKeyObject(Name name);
项目:judge    文件:ContestMapper.java   
@Insert("INSERT INTO contest (contest_id,title,description,start_time,end_time)"
        + " VALUES (#{id},#{title},#{description},#{startTime},#{endTime})")
@SelectKey(statement = "select COALESCE(max(contest_id)+1,1000) maxp from contest",
        keyProperty = "id", before = true, resultType = long.class)
long save(Contest contest);
项目:judge    文件:SubmissionMapper.java   
@Insert("INSERT INTO solution (solution_id,problem_id,user_id,in_date,code_length,score,language,ip,contest_id) VALUES"
        + " (#{id},#{problem},#{user},#{inDate},#{sourceLength},#{score},#{language},#{ip},#{contest})")
@SelectKey(statement = "select COALESCE(max(solution_id)+1,1000) maxp from solution",
        before = true, keyProperty = "id", resultType = long.class)
long save(Submission submission);
项目:judge    文件:MailMapper.java   
@CacheEvict(value = Constants.Cache.MAIL, allEntries = true)
@Insert("insert into mail (mail_id,from_user,to_user,title,content,in_date) "
        + "values(#{id},#{from},#{to},#{title},#{content},now())")
@SelectKey(statement = "select COALESCE(max(mail_id)+1,1000) maxp from mail",
        keyProperty = "id", before = true, resultType = long.class)
long save(Mail mail);
项目:judge    文件:LanguageMapper.java   
@CacheEvict(value = Constants.Cache.LANGUAGE, allEntries = true)
@Insert("insert into language(id,name,source_extension,compile_command,execute_command,executable_extension,time_factor,ext_memory,description) values(#{id},#{name},#{sourceExtension},#{compileCommand},#{executeCommand},#{executableExtension},#{timeFactor},#{extMemory},#{description})")
@SelectKey(statement = "select COALESCE(max(id)+1,1) maxp from language",
        keyProperty = "id", before = true, resultType = int.class)
long save(Language language);
项目:mybatis    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)
int insertTable2(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id, name_fred from table2 where id = identity()", keyProperty="nameId,generatedName", keyColumn="ID,NAME_FRED", before=false, resultType=Map.class)
int insertTable2WithSelectKeyWithKeyMap(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id as nameId, name_fred as generatedName from table2 where id = identity()", keyProperty="nameId,generatedName", before=false, resultType=Name.class)
int insertTable2WithSelectKeyWithKeyObject(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@Insert("insert into table3 (id, name) values(#{nameId}, #{name})")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@InsertProvider(type=SqlProvider.class,method="insertTable3_2")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3_2(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred from table2 where id = #{nameId}", keyProperty="generatedName", keyColumn="NAME_FRED", before=false, resultType=String.class)
int updateTable2WithSelectKeyWithKeyMap(Name name);
项目:mybatis    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred as generatedName from table2 where id = #{nameId}", keyProperty="generatedName", before=false, resultType=Name.class)
int updateTable2WithSelectKeyWithKeyObject(Name name);
项目:spring-boot-mybatis    文件:DealMapper.java   
@Insert("INSERT into DEAL(id, name, startDate, version, creationTime) VALUES(#{id}, #{name}, #{startDate}, 0, CURRENT_TIMESTAMP)")
@SelectKey(statement="SELECT DEAL_SEQUENCE.NEXTVAL FROM DUAL", keyProperty="id", before=true, resultType=Long.class)
@Options(flushCache=FlushCachePolicy.DEFAULT)
Long insert(Deal deal);
项目:mybaties    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)
int insertTable2(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id, name_fred from table2 where id = identity()", keyProperty="nameId,generatedName", keyColumn="ID,NAME_FRED", before=false, resultType=Map.class)
int insertTable2WithSelectKeyWithKeyMap(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id as nameId, name_fred as generatedName from table2 where id = identity()", keyProperty="nameId,generatedName", before=false, resultType=Name.class)
int insertTable2WithSelectKeyWithKeyObject(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@Insert("insert into table3 (id, name) values(#{nameId}, #{name})")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@InsertProvider(type=SqlProvider.class,method="insertTable3_2")
@SelectKey(statement="call next value for TestSequence", keyProperty="nameId", before=true, resultType=int.class)
int insertTable3_2(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred from table2 where id = #{nameId}", keyProperty="generatedName", keyColumn="NAME_FRED", before=false, resultType=String.class)
int updateTable2WithSelectKeyWithKeyMap(Name name);
项目:mybaties    文件:AnnotatedMapper.java   
@Update("update table2 set name = #{name} where id = #{nameId}")
@SelectKey(statement="select name_fred as generatedName from table2 where id = #{nameId}", keyProperty="generatedName", before=false, resultType=Name.class)
int updateTable2WithSelectKeyWithKeyObject(Name name);
项目:play    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)
int insertTable2(Name name);
项目:play    文件:AnnotatedMapper.java   
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="select id, name_fred from table2 where id = identity()", keyProperty="nameId,generatedName", keyColumn="ID,NAME_FRED", before=false, resultType=Map.class)
int insertTable2WithSelectKeyWithKeyMap(Name name);