Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#allSqlColumn()生成字段没有逗号间隔 #109

Open
hurrington opened this issue Jul 25, 2023 · 9 comments
Open

#allSqlColumn()生成字段没有逗号间隔 #109

hurrington opened this issue Jul 25, 2023 · 9 comments

Comments

@hurrington
Copy link

#allSqlColumn() 生成的字段没有间隔,没有逗号
image

@aimeizhewoye8
Copy link

在easycode的设置里找到Template下的mapper.xml.vm脚本和Global Config下的mybatisSupport.vm脚本,然后将这两个脚本里的 $velocityHasNext 替换成 $foreach.hasNext,然后保存设置。之后新生成的mapper.xml里就不会出现没有逗号间隔的问题了。
我也是2023.2版本出问题后瞎琢磨的,不过亲测有效。

@aimeizhewoye8
Copy link

#allSqlColumn() 生成的字段没有间隔,没有逗号 image

官方版本更新之前可以先试试我上面说的方法

@PerCheung
Copy link

#allSqlColumn() 生成的字段没有间隔,没有逗号图像

官方版本更新之前可以先尝试一下我上面说的方法

你是天下第一棒😀

@trickle-M
Copy link

foreach.hasNext

感谢,非常有帮助

@hurrington
Copy link
Author

1.2.8还没修复,foreach.hasNext亲测有效

@JiskZcz
Copy link

JiskZcz commented Oct 26, 2023

感谢,有用 。

@zxx17
Copy link

zxx17 commented Nov 29, 2023

感谢!

@lunasaw
Copy link

lunasaw commented Jan 27, 2024

##针对Mybatis 进行支持,主要用于生成xml文件
#foreach($column in $tableInfo.fullColumn)
##储存列类型
$tool.call($column.ext.put("sqlType", $tool.getField($column.obj.dataType, "typeName")))
#if($tool.newHashSet("java.lang.String").contains($column.type))
#set($jdbcType="VARCHAR")
#elseif($tool.newHashSet("java.lang.Boolean", "boolean").contains($column.type))
#set($jdbcType="BOOLEAN")
#elseif($tool.newHashSet("java.lang.Byte", "byte").contains($column.type))
#set($jdbcType="BYTE")
#elseif($tool.newHashSet("java.lang.Integer", "int", "java.lang.Short", "short").contains($column.type))
#set($jdbcType="INTEGER")
#elseif($tool.newHashSet("java.lang.Long", "long").contains($column.type))
#set($jdbcType="INTEGER")
#elseif($tool.newHashSet("java.lang.Float", "float", "java.lang.Double", "double").contains($column.type))
#set($jdbcType="NUMERIC")
#elseif($tool.newHashSet("java.util.Date", "java.sql.Timestamp", "java.time.Instant", "java.time.LocalDateTime", "java.time.OffsetDateTime", " java.time.ZonedDateTime").contains($column.type))
#set($jdbcType="TIMESTAMP")
#elseif($tool.newHashSet("java.sql.Date", "java.time.LocalDate").contains($column.type))
#set($jdbcType="TIMESTAMP")
#else
##其他类型
#set($jdbcType="OTHER")
#end
$tool.call($column.ext.put("jdbcType", $jdbcType))
#end

##定义宏,查询所有列
#macro(allSqlColumn)#foreach($column in $tableInfo.fullColumn)$column.obj.name#if($foreach.hasNext), #end#end#end

@LTisme
Copy link

LTisme commented Mar 21, 2024

thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants