public MapperAnnotationBuilder(Configuration configuration, Class<?> type) { String resource = type.getName().replace('.', '/') + ".java (best guess)"; this.assistant = new MapperBuilderAssistant(configuration, resource); this.configuration = configuration; this.type = type; sqlAnnotationTypes.add(Select.class); sqlAnnotationTypes.add(Insert.class); sqlAnnotationTypes.add(Update.class); sqlAnnotationTypes.add(Delete.class); sqlProviderAnnotationTypes.add(SelectProvider.class); sqlProviderAnnotationTypes.add(InsertProvider.class); sqlProviderAnnotationTypes.add(UpdateProvider.class); sqlProviderAnnotationTypes.add(DeleteProvider.class); }
private SqlCommandType getSqlCommandType(Method method) { Class<? extends Annotation> type = getSqlAnnotationType(method); if (type == null) { type = getSqlProviderAnnotationType(method); if (type == null) { return SqlCommandType.UNKNOWN; } if (type == SelectProvider.class) { type = Select.class; } else if (type == InsertProvider.class) { type = Insert.class; } else if (type == UpdateProvider.class) { type = Update.class; } else if (type == DeleteProvider.class) { type = Delete.class; } } return SqlCommandType.valueOf(type.getSimpleName().toUpperCase(Locale.ENGLISH)); }
public MybatisMapperAnnotationBuilder(Configuration configuration, Class<?> type) { // 执行父类 super(configuration, type); String resource = type.getName().replace('.', '/') + ".java (best guess)"; this.assistant = new MapperBuilderAssistant(configuration, resource); this.configuration = configuration; this.type = type; sqlAnnotationTypes.add(Select.class); sqlAnnotationTypes.add(Insert.class); sqlAnnotationTypes.add(Update.class); sqlAnnotationTypes.add(Delete.class); sqlProviderAnnotationTypes.add(SelectProvider.class); sqlProviderAnnotationTypes.add(InsertProvider.class); sqlProviderAnnotationTypes.add(UpdateProvider.class); sqlProviderAnnotationTypes.add(DeleteProvider.class); }
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table MAIL_LOG * * @mbggenerated */ @Insert({ "insert into MAIL_LOG (LAUNCHED_BY, LAUNCHED_AT, ", "MAIL_STATUS, MESSAGE_NAME, ", "SCHEDULED_AT, SENT_AT, ", "FROM_ADDR, SUBJECT, ", "BODY, UPDATED_AT, ", "CREATED_AT, LOCK_VERSION, ", "DELETED_FLG)", "values (#{launchedBy,jdbcType=VARCHAR}, #{launchedAt,jdbcType=TIMESTAMP}, ", "#{mailStatus,jdbcType=INTEGER}, #{messageName,jdbcType=VARCHAR}, ", "#{scheduledAt,jdbcType=TIMESTAMP}, #{sentAt,jdbcType=TIMESTAMP}, ", "#{fromAddr,jdbcType=VARCHAR}, #{subject,jdbcType=VARCHAR}, ", "#{body,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, ", "#{createdAt,jdbcType=TIMESTAMP}, #{lockVersion,jdbcType=INTEGER}, ", "#{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(MailLog record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table SQLTOOL_CLAUSE * * @mbggenerated */ @Insert({ "insert into SQLTOOL_CLAUSE (DATABASE_NAME, SELECT_CLAUSE, ", "FROM_CLAUSE, WHERE_CLAUSE, ", "GROUP_BY_CLAUSE, HAVING_CLAUSE, ", "ORDER_BY_CLAUSE, PARAM_MAP, ", "UPDATED_AT, CREATED_AT, ", "LOCK_VERSION, DELETED_FLG)", "values (#{databaseName,jdbcType=VARCHAR}, #{selectClause,jdbcType=VARCHAR}, ", "#{fromClause,jdbcType=VARCHAR}, #{whereClause,jdbcType=VARCHAR}, ", "#{groupByClause,jdbcType=VARCHAR}, #{havingClause,jdbcType=VARCHAR}, ", "#{orderByClause,jdbcType=VARCHAR}, #{paramMap,jdbcType=VARCHAR}, ", "#{updatedAt,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, ", "#{lockVersion,jdbcType=INTEGER}, #{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(SqltoolClause record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table ASYNC_PROCESS * * @mbggenerated */ @Insert({ "insert into ASYNC_PROCESS (LAUNCHED_BY, DESCRIPTION, ", "ASYNC_TYPE, ASYNC_STATUS, ", "REGISTERED_AT, LAUNCHED_AT, ", "STARTED_AT, FINISHED_AT, ", "UPDATED_AT, CREATED_AT, ", "LOCK_VERSION, DELETED_FLG)", "values (#{launchedBy,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, ", "#{asyncType,jdbcType=VARCHAR}, #{asyncStatus,jdbcType=VARCHAR}, ", "#{registeredAt,jdbcType=TIMESTAMP}, #{launchedAt,jdbcType=TIMESTAMP}, ", "#{startedAt,jdbcType=TIMESTAMP}, #{finishedAt,jdbcType=TIMESTAMP}, ", "#{updatedAt,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, ", "#{lockVersion,jdbcType=INTEGER}, #{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(AsyncProcess record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table MAIL_RCPT * * @mbggenerated */ @Insert({ "insert into MAIL_RCPT (MAIL_ID, RCPT_TYPE, ", "RCPT_ADDR, UPDATED_AT, ", "CREATED_AT, LOCK_VERSION, ", "DELETED_FLG)", "values (#{mailId,jdbcType=BIGINT}, #{rcptType,jdbcType=VARCHAR}, ", "#{rcptAddr,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, ", "#{createdAt,jdbcType=TIMESTAMP}, #{lockVersion,jdbcType=INTEGER}, ", "#{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(MailRcpt record);
@Insert({ "INSERT INTO conversion_test (", "joda_date, joda_time, joda_datetime, sec_str, sec_int, sec_long, sec_bigint, sec_bigdec, flag_code, deleted_flg", ") VALUES (", // "#{jodaDate,jdbcType=DATE},", // "#{jodaTime,jdbcType=TIME},", // "#{jodaDatetime,jdbcType=TIMESTAMP},", // "#{secStr,jdbcType=VARCHAR},", // "#{secInt,jdbcType=VARCHAR},", // "#{secLong,jdbcType=VARCHAR},", // "#{secBigint,jdbcType=VARCHAR},", // "#{secBigdec,jdbcType=VARCHAR},", // "#{flagCode,jdbcType=INTEGER},", // "#{deletedFlg,jdbcType=INTEGER}", // ")" }) @Options(useGeneratedKeys = true, keyProperty = "id") int insert(ConversionTest record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table MAIL_LOG * * @mbggenerated */ @Insert({ "insert into MAIL_LOG (LAUNCHED_BY, LAUNCHED_AT, ", "MAIL_STATUS, MESSAGE_NAME, ", "SCHEDULED_AT, SENT_AT, ", "FROM_ADDR, REPLY_TO_ADDR, ", "SUBJECT, BODY, UPDATED_AT, ", "CREATED_AT, LOCK_VERSION, ", "DELETED_FLG)", "values (#{launchedBy,jdbcType=VARCHAR}, #{launchedAt,jdbcType=TIMESTAMP}, ", "#{mailStatus,jdbcType=INTEGER}, #{messageName,jdbcType=VARCHAR}, ", "#{scheduledAt,jdbcType=TIMESTAMP}, #{sentAt,jdbcType=TIMESTAMP}, ", "#{fromAddr,jdbcType=VARCHAR}, #{replyToAddr,jdbcType=VARCHAR}, ", "#{subject,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, ", "#{createdAt,jdbcType=TIMESTAMP}, #{lockVersion,jdbcType=INTEGER}, ", "#{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(MailLog record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table ZIPCD_MASTER * * @mbggenerated */ @Insert({ "insert into ZIPCD_MASTER (CITY_CD, ZIPCD, ", "PREF, CITY, ADDR, ", "PREF_KANA, CITY_KANA, ", "ADDR_KANA, UPDATED_AT, ", "CREATED_AT, LOCK_VERSION, ", "DELETED_FLG)", "values (#{cityCd,jdbcType=INTEGER}, #{zipcd,jdbcType=VARCHAR}, ", "#{pref,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{addr,jdbcType=VARCHAR}, ", "#{prefKana,jdbcType=VARCHAR}, #{cityKana,jdbcType=VARCHAR}, ", "#{addrKana,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, ", "#{createdAt,jdbcType=TIMESTAMP}, #{lockVersion,jdbcType=INTEGER}, ", "#{deletedFlg,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(ZipcdMaster record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_opportunity * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_opportunity (id, opportunityName, ", "currencyid, accountid, ", "amount, type, source, ", "expectedClosedDate, campaignid, ", "nextStep, probability, ", "createdTime, createdUser, ", "sAccountId, assignUser, ", "opportunityType, salesStage, ", "lastUpdatedTime, avatarId, ", "description)", "values (#{id,jdbcType=INTEGER}, #{opportunityname,jdbcType=VARCHAR}, ", "#{currencyid,jdbcType=VARCHAR}, #{accountid,jdbcType=INTEGER}, ", "#{amount,jdbcType=DOUBLE}, #{type,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, ", "#{expectedcloseddate,jdbcType=TIMESTAMP}, #{campaignid,jdbcType=INTEGER}, ", "#{nextstep,jdbcType=VARCHAR}, #{probability,jdbcType=INTEGER}, ", "#{createdtime,jdbcType=TIMESTAMP}, #{createduser,jdbcType=VARCHAR}, ", "#{saccountid,jdbcType=INTEGER}, #{assignuser,jdbcType=VARCHAR}, ", "#{opportunitytype,jdbcType=VARCHAR}, #{salesstage,jdbcType=VARCHAR}, ", "#{lastupdatedtime,jdbcType=TIMESTAMP}, #{avatarid,jdbcType=VARCHAR}, ", "#{description,jdbcType=LONGVARCHAR})" }) int insert(Opportunity record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_campaign * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_campaign (id, campaignName, ", "startDate, endDate, ", "currencyId, budget, ", "actualCost, expectedRevenue, ", "expectedCost, impression, ", "createdTime, createdUser, ", "sAccountId, status, ", "type, assignUser, ", "lastUpdatedTime, avatarId, ", "impressionnote, objective, ", "description)", "values (#{id,jdbcType=INTEGER}, #{campaignname,jdbcType=VARCHAR}, ", "#{startdate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP}, ", "#{currencyid,jdbcType=VARCHAR}, #{budget,jdbcType=DOUBLE}, ", "#{actualcost,jdbcType=DOUBLE}, #{expectedrevenue,jdbcType=DOUBLE}, ", "#{expectedcost,jdbcType=DOUBLE}, #{impression,jdbcType=INTEGER}, ", "#{createdtime,jdbcType=TIMESTAMP}, #{createduser,jdbcType=VARCHAR}, ", "#{saccountid,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, ", "#{type,jdbcType=VARCHAR}, #{assignuser,jdbcType=VARCHAR}, ", "#{lastupdatedtime,jdbcType=TIMESTAMP}, #{avatarid,jdbcType=VARCHAR}, ", "#{impressionnote,jdbcType=LONGVARCHAR}, #{objective,jdbcType=LONGVARCHAR}, ", "#{description,jdbcType=LONGVARCHAR})" }) int insert(CampaignWithBLOBs record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_customer * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_customer (id, firstname, ", "lastname, leadsource, ", "assignUser, department, ", "officePhone, mobile, ", "homePhone, assisstant, ", "assisstantPhone, birthday, ", "createdTime, createdUser, ", "sAccountId, lastUpdatedTime, ", "title)", "values (#{id,jdbcType=INTEGER}, #{firstname,jdbcType=VARCHAR}, ", "#{lastname,jdbcType=VARCHAR}, #{leadsource,jdbcType=INTEGER}, ", "#{assignuser,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, ", "#{officephone,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, ", "#{homephone,jdbcType=VARCHAR}, #{assisstant,jdbcType=VARCHAR}, ", "#{assisstantphone,jdbcType=VARCHAR}, #{birthday,jdbcType=DATE}, ", "#{createdtime,jdbcType=TIMESTAMP}, #{createduser,jdbcType=VARCHAR}, ", "#{saccountid,jdbcType=INTEGER}, #{lastupdatedtime,jdbcType=TIMESTAMP}, ", "#{title,jdbcType=VARCHAR})" }) int insert(Customer record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_call * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_call (id, subject, ", "startDate, durationInSeconds, ", "calltype, type, ", "typeid, lastUpdatedTime, ", "createdTime, createdUser, ", "assignUser, contactId, ", "sAccountId, status, ", "purpose, isClosed, description, ", "result)", "values (#{id,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, ", "#{startdate,jdbcType=TIMESTAMP}, #{durationinseconds,jdbcType=INTEGER}, ", "#{calltype,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, ", "#{typeid,jdbcType=INTEGER}, #{lastupdatedtime,jdbcType=TIMESTAMP}, ", "#{createdtime,jdbcType=TIMESTAMP}, #{createduser,jdbcType=VARCHAR}, ", "#{assignuser,jdbcType=VARCHAR}, #{contactid,jdbcType=INTEGER}, ", "#{saccountid,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, ", "#{purpose,jdbcType=VARCHAR}, #{isclosed,jdbcType=BIT}, #{description,jdbcType=LONGVARCHAR}, ", "#{result,jdbcType=LONGVARCHAR})" }) int insert(CallWithBLOBs record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_contract * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_contract (id, contractname, ", "status, code, accountid, ", "opportunityid, currencyid, ", "customersigneddate, companysigneddate, ", "type, description, ", "startdate, enddate, ", "contractvalue, createdTime, ", "createdUser, sAccountId, ", "assignUser, lastUpdatedTime)", "values (#{id,jdbcType=INTEGER}, #{contractname,jdbcType=VARCHAR}, ", "#{status,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{accountid,jdbcType=INTEGER}, ", "#{opportunityid,jdbcType=INTEGER}, #{currencyid,jdbcType=VARCHAR}, ", "#{customersigneddate,jdbcType=TIMESTAMP}, #{companysigneddate,jdbcType=TIMESTAMP}, ", "#{type,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, ", "#{startdate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP}, ", "#{contractvalue,jdbcType=DECIMAL}, #{createdtime,jdbcType=TIMESTAMP}, ", "#{createduser,jdbcType=VARCHAR}, #{saccountid,jdbcType=INTEGER}, ", "#{assignuser,jdbcType=VARCHAR}, #{lastupdatedtime,jdbcType=TIMESTAMP})" }) int insert(Contract record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_meeting * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_meeting (id, subject, ", "status, type, typeid, ", "startDate, endDate, ", "lastUpdatedTime, createdTime, ", "createdUser, sAccountId, ", "location, isRecurrence, ", "recurrenceType, recurrenceStartDate, ", "recurrenceEndDate, contactType, ", "contactTypeId, isClosed, ", "isNotified, isNotifiedPrior, ", "description, recurrenceInfo)", "values (#{id,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, ", "#{status,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{typeid,jdbcType=INTEGER}, ", "#{startdate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP}, ", "#{lastupdatedtime,jdbcType=TIMESTAMP}, #{createdtime,jdbcType=TIMESTAMP}, ", "#{createduser,jdbcType=VARCHAR}, #{saccountid,jdbcType=INTEGER}, ", "#{location,jdbcType=VARCHAR}, #{isrecurrence,jdbcType=BIT}, ", "#{recurrencetype,jdbcType=VARCHAR}, #{recurrencestartdate,jdbcType=TIMESTAMP}, ", "#{recurrenceenddate,jdbcType=TIMESTAMP}, #{contacttype,jdbcType=VARCHAR}, ", "#{contacttypeid,jdbcType=INTEGER}, #{isclosed,jdbcType=BIT}, ", "#{isnotified,jdbcType=BIT}, #{isnotifiedprior,jdbcType=INTEGER}, ", "#{description,jdbcType=LONGVARCHAR}, #{recurrenceinfo,jdbcType=LONGVARCHAR})" }) int insert(MeetingWithBLOBs record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_product_catalog * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_product_catalog (id, url, ", "taxclass, mft_partnumber, ", "vendor_partnumber, currencyid, ", "cost, listprice, discountprice, ", "pricing_formula, description, ", "date_available, availability, ", "quantity_in_stock, support_name, ", "support_contact, support_desc, ", "support_term, productname, ", "sAccountId, createdTime, ", "lastUpdatedTime)", "values (#{id,jdbcType=INTEGER}, #{url,jdbcType=VARCHAR}, ", "#{taxclass,jdbcType=VARCHAR}, #{mftPartnumber,jdbcType=VARCHAR}, ", "#{vendorPartnumber,jdbcType=VARCHAR}, #{currencyid,jdbcType=VARCHAR}, ", "#{cost,jdbcType=DOUBLE}, #{listprice,jdbcType=DOUBLE}, #{discountprice,jdbcType=DOUBLE}, ", "#{pricingFormula,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, ", "#{dateAvailable,jdbcType=TIMESTAMP}, #{availability,jdbcType=VARCHAR}, ", "#{quantityInStock,jdbcType=VARCHAR}, #{supportName,jdbcType=VARCHAR}, ", "#{supportContact,jdbcType=VARCHAR}, #{supportDesc,jdbcType=VARCHAR}, ", "#{supportTerm,jdbcType=VARCHAR}, #{productname,jdbcType=VARCHAR}, ", "#{saccountid,jdbcType=INTEGER}, #{createdtime,jdbcType=TIMESTAMP}, ", "#{lastupdatedtime,jdbcType=TIMESTAMP})" }) int insert(ProductCatalog record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_case * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_case (id, priority, ", "status, type, subject, ", "accountId, createdTime, ", "createdUser, sAccountId, ", "assignUser, lastUpdatedTime, ", "reason, origin, ", "email, phonenumber, ", "description, resolution)", "values (#{id,jdbcType=INTEGER}, #{priority,jdbcType=VARCHAR}, ", "#{status,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{subject,jdbcType=VARCHAR}, ", "#{accountid,jdbcType=INTEGER}, #{createdtime,jdbcType=TIMESTAMP}, ", "#{createduser,jdbcType=VARCHAR}, #{saccountid,jdbcType=INTEGER}, ", "#{assignuser,jdbcType=VARCHAR}, #{lastupdatedtime,jdbcType=TIMESTAMP}, ", "#{reason,jdbcType=VARCHAR}, #{origin,jdbcType=VARCHAR}, ", "#{email,jdbcType=VARCHAR}, #{phonenumber,jdbcType=VARCHAR}, ", "#{description,jdbcType=LONGVARCHAR}, #{resolution,jdbcType=LONGVARCHAR})" }) int insert(CaseWithBLOBs record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_crm_task * * @mbg.generated Sat Oct 21 18:03:12 ICT 2017 */ @Insert({ "insert into m_crm_task (id, subject, ", "startdate, duedate, ", "contactId, typeid, ", "createdTime, createdUser, ", "sAccountId, status, ", "assignUser, priority, ", "type, lastUpdatedTime, ", "isClosed, description)", "values (#{id,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, ", "#{startdate,jdbcType=TIMESTAMP}, #{duedate,jdbcType=TIMESTAMP}, ", "#{contactid,jdbcType=INTEGER}, #{typeid,jdbcType=INTEGER}, ", "#{createdtime,jdbcType=TIMESTAMP}, #{createduser,jdbcType=VARCHAR}, ", "#{saccountid,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, ", "#{assignuser,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, ", "#{type,jdbcType=VARCHAR}, #{lastupdatedtime,jdbcType=TIMESTAMP}, ", "#{isclosed,jdbcType=BIT}, #{description,jdbcType=LONGVARCHAR})" }) int insert(CrmTask record);
/** * 添加用户 * @param user */ @Insert("insert into t_user " + "(id,username,password,createAt,isDeleted,loginTimes,lastLogin)" + " values " + "(#{user.id}," + "#{user.username}," + "#{user.password}," + "#{user.createAt}," + "#{user.isDeleted}," + "#{user.loginTimes}," + "#{user.lastLogin})") public int addUser(@Param("user")User user);
public MybatisMapperAnnotationBuilder(Configuration configuration, Class<?> type) { // TODO 执行父类 super(configuration, type); String resource = type.getName().replace('.', '/') + ".java (best guess)"; this.assistant = new MapperBuilderAssistant(configuration, resource); this.configuration = configuration; this.type = type; sqlAnnotationTypes.add(Select.class); sqlAnnotationTypes.add(Insert.class); sqlAnnotationTypes.add(Update.class); sqlAnnotationTypes.add(Delete.class); sqlProviderAnnotationTypes.add(SelectProvider.class); sqlProviderAnnotationTypes.add(InsertProvider.class); sqlProviderAnnotationTypes.add(UpdateProvider.class); sqlProviderAnnotationTypes.add(DeleteProvider.class); }
@Insert({ "insert into user (id, username, ", "password, role)", "values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, ", "#{password,jdbcType=VARCHAR}, #{role,jdbcType=INTEGER})" }) int insert(User record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table SysCode * * @mbggenerated Wed Jul 12 20:57:03 CST 2017 */ @Insert({ "insert into SysCode (codeId, codeTypeId, ", "codeName, parentCodeId)", "values (#{codeId,jdbcType=INTEGER}, #{codeTypeId,jdbcType=INTEGER}, ", "#{codeName,jdbcType=VARCHAR}, #{parentCodeId,jdbcType=INTEGER})" }) int insert(SysCode record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table district * * @mbggenerated Wed Jul 12 20:27:10 CST 2017 */ @Insert({ "insert into district (id, name, ", "parent_id, initial, ", "initials, pinyin, ", "extra, suffix, code, ", "area_code, order)", "values (#{id,jdbcType=SMALLINT}, #{name,jdbcType=VARCHAR}, ", "#{parent_id,jdbcType=SMALLINT}, #{initial,jdbcType=CHAR}, ", "#{initials,jdbcType=VARCHAR}, #{pinyin,jdbcType=VARCHAR}, ", "#{extra,jdbcType=VARCHAR}, #{suffix,jdbcType=VARCHAR}, #{code,jdbcType=CHAR}, ", "#{area_code,jdbcType=VARCHAR}, #{order,jdbcType=TINYINT})" }) int insert(District record);
@Insert({ "insert into mbtest.test_identity", "(first_name, last_name)", "values(#{firstName,jdbcType=VARCHAR}, #{lastName,jdbcType=VARCHAR})" }) @Options(keyProperty="id", useGeneratedKeys=true, keyColumn="name_id") int insertNameAnnotated(Name name);
@Insert("<script>insert into contest_problem (contest_id,problem_id,title,num)" + "select #{contest_id} AS contest_id,origin,null title,num from " + "<foreach item='item' index='index' collection='problems' open='(' separator=' union ' close=')'>" + "select problem_id origin,${base}+#{index} as num from problem where problem_id=#{item}" + "</foreach> as t" + "</script>") long addProblems(@Param("contest_id") long contest_id, @Param("base") int base, @Nonnull @Param("problems") long[] problems);
@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);
@Insert("insert into message (thread_id,message_id,parent_id,orderNum,problem_id,depth,user_id,title,content,in_date) values(#{id},#{id},#{parentId},#{orderNum},#{problemId},#{depth},#{userId},#{title},#{content},now())") long save(@Param("id") long id, @Param("parentId") Long parentId, @Param("orderNum") long orderNum, @Param("problemId") Long problemId, @Param("depth") long depth, @Param("userId") String userId, @Param("title") String title, @Param("content") String content);
@Insert("<script>" + "insert into users(user_id,nick,password,school,email)values" + "<foreach item='item' collection='accounts' separator=','>" + "(#{item.id},#{item.nick},#{item.password},#{item.school},nullif(#{item.email},''))" + "</foreach>" + "</script>") void insert(@Param("accounts") List<Account> accounts);