<select id="login" resultType="com.lzs.haiyan.entity.User">
select * from hy_user where loginnum = #{loginnum} and password = #{password};
update hy_user set lastlogin_time = #{timestamp} where loginnum = #{loginnum} and password = #{password};
INSERT INTO hy_login (user_uuid, login_time) (SELECT uuid,lastlogin_time FROM hy_user where loginnum = #{loginnum} and password = #{password});
</select>
需要配置数据库允许多sql传入
allowMultiQueries=true
server:
port: 8888
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://42.192.89.31:3306/hy?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=UTC&allowMultiQueries=true
username: root
password: guojiao1127
#热部署生效
spring.devtools.restart.enabled: true
swagger:
enable: true
测试接口
其实我也不知道为啥就返回这个结果了—-
是因为select是标签所以返回的是select的结果吗 还是第一个语句的结果