标签的用法:
六个参数:
collection:要循环的集合
index:循环索引(不知道啥用。。)
item:集合中的一个元素(item和collection,按foreach循环理解)
open:以什么开始
close:以什么结束
separator:循环内容之间以什么分隔
<update id="buildTableSQL" statementType="STATEMENT">
<if test="dbType !=null and dbType == 'mysql'">
create table net_${netGenDbTable.name} (
id int(11) not null auto_increment comment 'id',
url varchar(255) comment '采集来源url',
spider_jobid varchar(64) comment '爬虫工作id',
<foreach collection="netGenDbTable.columnList" item="cloumn">
${cloumn.name}
${cloumn.jdbcType}
<choose>
<when test="cloumn.dataLen != null and cloumn.dataLen !='' ">
(${cloumn.dataLen})
</when>
</choose>
<choose>
<when test="cloumn.canNull == '0'"> comment ${cloumn.comments} </when>
<when test="cloumn.canNull == '1'">
${cloumn.jdbcType} not null
<choose>
<when test="cloumn.defaultVal != null and cloumn.defaultVal != ''">
default ${cloumn.defaultVal} comment ${cloumn.comments}
</when>
<otherwise>
comment '-'
</otherwise>
</choose>
</when>
</choose>
,
</foreach>
remarks varchar(2000) comment '备注',
create_by varchar(32) comment '创建人',
create_date timestamp not null default current_timestamp comment '创建时间',
update_by varchar(32) comment '更新人',
update_date timestamp not null default '0000-00-00 00:00:00' comment '更新时间',
del_flag char(1) default '0' not null comment '逻辑删除标记(0:显示;1:隐藏)',
primary key (id),
unique index net_${netGenDbTable.name}_idx_001(url),
index net_${netGenDbTable.name}_idx_002(spider_jobid)
)
</if>
<!-- create index ix_${tableName}_m_010101 on ${tableName} (m_010101); -->
</update>