码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis分页和主键生成

时间:2017-05-16 23:34:16      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:mybatis分页和主键生成

oracle 使用 mybatis的时候,主键自动生成: 


<insert id="createBigOrder" parameterType="BigOrder" useGeneratedKeys="true" keyProperty="id">

        <selectKey resultType="int" order="BEFORE" keyProperty="id"> 

            SELECT SEQ_BIG_ORDER_ID.NEXTVAL FROM dual 

        </selectKey>  


    insert into 

    BIG_ORDER

    ( ID,

    BIGORDER_CODE,

MEMBER_ID,

SHOPGUIDE_ID,

CHANNEL_ID,

PAY_PRICE,

PAY_WAY,

GOODS_TOTAL_COUNT,

GSC_PICMIAN_ID,

PIC_URL,

PROVINCE,

CITY,

DETAIL_ADDRESS,

CONSIGNEE,

CONTACT_TEL,

BIND_SKU,

BIND_COUNT,

BIND_REASON,

BRAND_CODE,

REAL_SELL_PRICE,

CREATE_TIME,

UPDATE_TIME,

AREA,

EMAIL,

SALE_SHOP,

ORIGINAL_TOTAL_PRICE,

CRM_ID,

rule_Id,

promotion_type_name,

P_TYPE_CODE,

P_PRICE_RULE,

P_MARKUP_PRICE,

P_QUANTITY_RULE,

P_START_TIME,

P_END_TIME,

P_DESCRIPTION)

    values 

    (

    #{id},

    #{bigorderCode},

    #{memberId,jdbcType=BIGINT},

    #{shopguideId,jdbcType=VARCHAR},

    #{channelId},

    #{payPrice},

    #{payWay,jdbcType=VARCHAR},

    #{goodsTotalCount},

    #{gscPicmianId,jdbcType=BIGINT},

    #{picUrl},

    #{province},

    #{city},

    #{detailAddress},

    #{consignee},

    #{contactTel},

    #{bindSku,jdbcType=VARCHAR},

    #{bindCount,jdbcType=BIGINT},

    #{bindReason,jdbcType=VARCHAR},

    #{brandCode},

    #{realSellPrice},

    #{createTime,jdbcType=TIMESTAMP},

    #{updateTime,jdbcType=TIMESTAMP},

    #{area},

    #{email,jdbcType=VARCHAR},

    #{saleShop,jdbcType=VARCHAR},

    #{originalTotalPrice},

    #{crmId,jdbcType=VARCHAR},

    #{ruleId,jdbcType=BIGINT},

    #{promotionTypeName,jdbcType=VARCHAR},

    #{pTypeCode,jdbcType=VARCHAR},

    #{pPriceRule,jdbcType=DOUBLE},

    #{pMarkupPrice,jdbcType=DOUBLE},

    #{pQuantityRule,jdbcType=BIGINT},

    #{pStartTime,jdbcType=TIMESTAMP},

    #{pEndTime,jdbcType=TIMESTAMP},

    #{pDescription,jdbcType=VARCHAR})

    </insert>

    

使用mybatis分页配置:

<configuration>

    

    

    <typeAliases>

        <typeAlias type="com.zyhao.demo.rest.entities.Demo" alias="Demo"/>

        <typeAlias type="org.zywx.lzsz.entity.order.BigOrder" alias="BigOrder"/>

        <typeAlias type="org.zywx.lzsz.entity.cart.ShoppingCart" alias="ShoppingCart" />

    </typeAliases>

    <!-- 添加mybatis分页插件 :指定oracle方言-->

    <plugins>

        <plugin interceptor="com.github.miemiedev.mybatis.paginator.OffsetLimitInterceptor">

            <property name="dialectClass" value="com.github.miemiedev.mybatis.paginator.dialect.OracleDialect"/>

        </plugin>

    </plugins>

    

    <mappers>

        <mapper resource="mappers/demo.xml" />

        <mapper resource="mappers/order/bigorder.xml" />

        <mapper resource="mappers/cart/shoppingCart.xml"/>

    </mappers>

     

</configuration>


mybatis分页和主键生成

标签:mybatis分页和主键生成

原文地址:http://17099933344.blog.51cto.com/12891875/1926314

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!