格式:
代码语言:javascript复制INSERT 系统代码表 (字段1, 字段2, 字段3, 字段4, 字段5 )
SELECT '值1', '值2', '值3', '值4', '值5'
WHERE NOT EXISTS (SELECT * FROM 系统代码表 WHERE 字段1 = '值1' AND 字段2 = '值2')
举例:
代码语言:javascript复制insert into tb_user (username, password)
select #{user.username}, #{user.password}
where not exists (select username from tb_user where username = #{user.username});