主键赋值错误,或者未赋值
Closed this issue · 2 comments
spring-datasource配置:
`
<bean:properties id="properties">
123
10
</bean:properties>
<sharding:key-generator id="orderKeyGenerator" type="SNOWFLAKE" column="id" props-ref="properties"/>
<sharding:key-generator id="itemKeyGenerator" type="SNOWFLAKE" column="id" props-ref="properties"/>
<sharding:data-source id="shardingDataSource">
<sharding:sharding-rule data-source-names="dataSource">
<sharding:table-rules>
<sharding:table-rule logic-table="ec_order"
actual-data-nodes="${sharding.jdbc.datasource.actual.data.nodes.order}"
table-strategy-ref="tableShardingStrategy"
key-generator-ref="orderKeyGenerator" />
<sharding:table-rule logic-table="ec_order_detail"
actual-data-nodes="${sharding.jdbc.datasource.actual.data.nodes.orderitem}"
table-strategy-ref="orderDetailShardingStrategy"
key-generator-ref="itemKeyGenerator" />
</sharding:table-rules>
</sharding:sharding-rule>
</sharding:data-source>`
Mybaits:
<insert id="insert" parameterType="com.dongao.phoenix.ec.shop.manage.po.OrderPo"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> SELECT LAST_INSERT_ID() </selectKey> insert into ec_order (order_no, member_id, member_name, source, order_type, order_total_price, actually_pay_price, goods_total_price, freight_price, activity_price, is_use_coupon, is_invoice, order_status, pay_status, is_split, user_remark, order_remark, is_admin_order, order_time, pay_time, return_type, payment, ip_address, is_logistic ) values (#{orderNo,jdbcType=VARCHAR}, #{memberId,jdbcType=BIGINT}, #{memberName,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{orderTotalPrice,jdbcType=DOUBLE}, #{actuallyPayPrice,jdbcType=DOUBLE}, #{goodsTotalPrice,jdbcType=DOUBLE}, #{freightPrice,jdbcType=DOUBLE}, #{activityPrice,jdbcType=DOUBLE}, #{isUseCoupon,jdbcType=INTEGER}, #{isInvoice,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, #{payStatus,jdbcType=INTEGER}, #{isSplit,jdbcType=INTEGER}, #{userRemark,jdbcType=VARCHAR}, #{orderRemark,jdbcType=VARCHAR}, #{isAdminOrder,jdbcType=INTEGER}, #{orderTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{returnType,jdbcType=INTEGER}, #{payment,jdbcType=INTEGER}, #{ipAddress,jdbcType=VARCHAR}, #{isLogistic,jdbcType=INTEGER} ) </insert>
没有自动追加ID,但是却把ID赋值到了别的字段:is_admin_order了
但是如果我把mybaits的insert SQL追加上ID,就不会赋值错误,但是ID也没有值,插入导数据库用的是mysql的自增值
这个问题该如何处理
upgrade 4.0.0.0-RC2
For English only