<select id="queryAllByTableName" resultType="com.sz.generator.pojo.po.GeneratorTableColumn">
SELECT
<include refid="Base_Column_List"></include>
FROM
generator_table_column gtc,
generator_table gt
WHERE
gtc.table_id = gt.table_id
AND gt.table_name IN
<foreach collection="tableNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
更改为
<select id="queryAllByTableName" resultType="com.sz.generator.pojo.po.GeneratorTableColumn">
SELECT
<include refid="Base_Column_List"></include>
FROM generator_table_column gtc
INNER JOIN generator_table gt ON gtc.table_id = gt.table_id
WHERE
AND gt.table_name IN
<foreach collection="tableNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
GeneratorTableMapper.xml
<delete id="cleanTableColumnByTableName">
DELETE
FROM generator_table_column gtc
WHERE EXISTS (SELECT 1
FROM generator_table gt
WHERE gtc.table_id = gt.table_id
AND gt.table_name in
<foreach collection="tableNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
);
</delete>
改为
<delete id="cleanTableColumnByTableName">
DELETE gtc
FROM generator_table_column gtc
INNER JOIN generator_table gt ON gtc.table_id = gt.table_id
WHERE gt.table_name IN
<foreach collection="tableNames" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</delete>
发现导入数据表功能后端的sql语句居然是89标准的写法。然后我导入SQL的时候就报错了。
解决方案:
GeneratorTableColumnMapper.xml
将
更改为
GeneratorTableMapper.xml
改为