SeataControlller.java 933 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
package com.kwan.springbootkwan.controller;

import com.kwan.springbootkwan.entity.User;
import com.kwan.springbootkwan.service.IUserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/seata")
public class SeataControlller {

    @Autowired
    private IUserService userService;

    @ApiOperation(value = "保存用户", notes = "保存用户")
    @RequestMapping(value = "/save", method = RequestMethod.GET)
    public User save() {
        //保存用户
        User user = new User();
        user.setName("秦梓淞");
        user.setSex("男");
        return userService.saveUser(user);
    }
}