1. <select id="login" resultType="com.lzs.haiyan.entity.User">
    2. select * from hy_user where loginnum = #{loginnum} and password = #{password};
    3. update hy_user set lastlogin_time = #{timestamp} where loginnum = #{loginnum} and password = #{password};
    4. INSERT INTO hy_login (user_uuid, login_time) (SELECT uuid,lastlogin_time FROM hy_user where loginnum = #{loginnum} and password = #{password});
    5. </select>

    需要配置数据库允许多sql传入
    allowMultiQueries=true

    1. server:
    2. port: 8888
    3. spring:
    4. datasource:
    5. driver-class-name: com.mysql.cj.jdbc.Driver
    6. url: jdbc:mysql://42.192.89.31:3306/hy?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=UTC&allowMultiQueries=true
    7. username: root
    8. password: guojiao1127
    9. #热部署生效
    10. spring.devtools.restart.enabled: true
    11. swagger:
    12. enable: true

    测试接口
    image.png
    image.png
    其实我也不知道为啥就返回这个结果了—-
    是因为select是标签所以返回的是select的结果吗 还是第一个语句的结果