Export to GitHub

rapid-framework - issue #41

ibatis3 ${className}Mapper.xml 中 update sql 多了一个逗号问题及select by unique 的问题


Posted on Feb 26, 2010 by Helpful Kangaroo

1.update中:源程序如下: <#if !column.pk> ${column.sqlName} = <@mapperEl column.columnNameFirstLower+',jdbcType='+column.jdbcSqlTypeName/> <#if column_has_next>,</#if> </#if>

若 主键在最后面的话,会多出一个逗号。

2.select by unique column 中:源程序如下: <select id="getBy${column.columnName}" resultMap="${className}Result" parameterType="${column.javaType}"> select <include refid="${classNameFirstLower}Columns"/> <![CDATA[ from ${table.sqlName} where ${column.sqlName} =

${column.columnNameLower}

    ]]&gt;
&lt;/select&gt;

是不是应将#${column.columnNameLower}# --》<@mapperEl column.columnNameLower/>

因为:例如: from T_P_USER_LOGIN_SESSION where USERID = #userid# 而不是:from T_P_USER_LOGIN_SESSION where USERID = #{userid}

Comment #1

Posted on Feb 26, 2010 by Grumpy Elephant

感谢,已经修正上面的两个问题.

修改完的模板可以在这里查看: http://rapid-framework.googlecode.com/svn/trunk/rapid- framework/plugins/ibatis3/template/java_src/$%7Bbasepackage_dir%7D/model/mapper/$%7Bcla ssName%7DMapper.xml

Comment #2

Posted on Feb 26, 2010 by Grumpy Elephant

修改完成

Status: Fixed

Labels:
Type-Defect Priority-Medium