Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse 将从ibatis迁移到mybatis_Eclipse_Mapping_Mybatis_Ibatis - Fatal编程技术网

Eclipse 将从ibatis迁移到mybatis

Eclipse 将从ibatis迁移到mybatis,eclipse,mapping,mybatis,ibatis,Eclipse,Mapping,Mybatis,Ibatis,当我使用ibatis2mybatis迁移这个sqlMap时 <procedure id="correctPcsInvoiceInCn" parameterClass="java.util.Map" > exec correctPcsInvoice <isNotNull property="insertingPersonId" >#insertingPersonId# </isNotN

当我使用ibatis2mybatis迁移这个sqlMap时

<procedure id="correctPcsInvoiceInCn"
    parameterClass="java.util.Map" >
    exec correctPcsInvoice 
        <isNotNull             property="insertingPersonId"       >#insertingPersonId#        </isNotNull>       <isNull             property="insertingPersonId"       > null </isNull>
        <isNotNull prepend="," property="contractServicePerfID"   >#contractServicePerfID#    </isNotNull>       <isNull prepend="," property="contractServicePerfID"   > null </isNull>
        <isNotNull prepend="," property="chemotherapyInvoiceID"   >#chemotherapyInvoiceID#    </isNotNull>       <isNull prepend="," property="chemotherapyInvoiceID"   > null </isNull>
        <isNotNull prepend="," property="tariff"                  >#tariff#                   </isNotNull>       <isNull prepend="," property="tariff"                  > null </isNull>

        <isNotNull prepend="," property="medicalProductDetailsID" >#medicalProductDetailsID#  </isNotNull>       <isNull prepend="," property="medicalProductDetailsID" > null </isNull>
        <isNotNull prepend="," property="drugPackageUnitsCount"   >#drugPackageUnitsCount#    </isNotNull>       <isNull prepend="," property="drugPackageUnitsCount"   > null </isNull>
        <isNotNull prepend="," property="drugPackagePrice"        >#drugPackagePrice#         </isNotNull>       <isNull prepend="," property="drugPackagePrice"        > null </isNull>
        <isNotNull prepend="," property="invoiceNumber"           >#invoiceNumber#            </isNotNull>       <isNull prepend="," property="invoiceNumber"           > null </isNull>

        <isNotNull prepend="," property="positionInInvoice"       >#positionInInvoice#        </isNotNull>       <isNull prepend="," property="positionInInvoice"       > null </isNull>
        <isNotNull prepend="," property="taxPayerID"              >#taxPayerID#               </isNotNull>       <isNull prepend="," property="taxPayerID"              > null </isNull>
</procedure>
我明白了

<update id="correctPcsInvoiceInCn" parameterType="java.util.Map" statementType="CALLABLE">

    exec correctPcsInvoice 
        <if test="insertingPersonId != null">#{insertingPersonId}        </if>       <if test="insertingPersonId == null"> null </if>
        <if test="contractServicePerfID != null">,#{contractServicePerfID}    </if>       <if test="contractServicePerfID == null">, null </if>
        <if test="chemotherapyInvoiceID != null">,#{chemotherapyInvoiceID}    </if>       <if test="chemotherapyInvoiceID == null">, null </if>

        <if test="tariff != null">,#{tariff}                   </if>       <if test="tariff == null">, null </if>
        <if test="medicalProductDetailsID != null">,#{medicalProductDetailsID}  </if>       <if test="medicalProductDetailsID == null">, null </if>
        <if test="drugPackageUnitsCount != null">,#{drugPackageUnitsCount}    </if>       <if test="drugPackageUnitsCount == null">, null </if>
        <if test="drugPackagePrice != null">,#{drugPackagePrice}         </if>       <if test="drugPackagePrice == null">, null </if>

        <if test="invoiceNumber != null">,#{invoiceNumber}            </if>       <if test="invoiceNumber == null">, null </if>
        <if test="positionInInvoice != null">,#{positionInInvoice}        </if>       <if test="positionInInvoice == null">, null </if>


        <if test="taxPayerID != null">,#{taxPayerID}               </if>       <if test="taxPayerID == null">, null </if>
</update>

ibatis2mybatis生成了这个,但我不知道它是好是坏?任何人都可以验证这部分代码吗?如果可能的话,换一个好的。

最好在myBatis中使用bean而不是map

public InvoiceBean {
  private Integer insertingPersonId;
...
  //getters, setters
}
然后像这样使用它:

<update id="correctPcsInvoiceInCn" parameterType="your.packadge.InvoiceBean" statementType="CALLABLE">

    exec correctPcsInvoice #{insertingPersonId, jdbcType=NUMERIC}, ...other parameters

</update>
将jdbcType添加到参数允许myBatis为其设置正确的空值