实例
SELECT
(@i :=@i + 1) AS seq,
a.id AS id,
a.name AS name,
b.name AS deptName
FROM
sys_user a
LEFT JOIN sys_dept b ON b.id = a.dept_id
,(select @i:=0) as t
要在mybatis的xml中写mysql语句中的变量 如set @i=1,
需要在数据库相关的配置文件中设置允许多个sql执行 mysql的连接url + allowMultiQueries=true,
jdbc:mysql://localhost:3306/test?allowMultiQueries=true