package com.guigu.liujie.controller;
import com.guigu.liujie.pojo.User; import com.guigu.liujie.service.UserService; import com.guigu.liujie.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * @ClassName UserController * @Description Todo * @Author Liujie * @Date 2021/6/15 16:19 * @Version 1.0 **/ @RestController @RequestMapping("user") public class UserController { @Autowired public UserService userService; /** * User new * @param user * @return */ @postMapping () public Object userAdd(@requestBody user user){Boolean isAdd = userService.userAdd(user); if(! IsAdd){return new Result(isAdd," new Result failed "); } return new Result (PerfectMoney download isAdd (https://www.gendan5.com/wallet/PerfectMoney.html), "new success"); } public Object UserDel (@PathVariable Integer id){/** * @Param id * @Return */ @DeleteMapping(value = "{id}") { boolean flag = userService.userDel(id); if(! Flag){return new Result(flag," Delete failed "); } return new Result(flag," delete successfully "); } /** */ To emerge violently from restraint * @Param user * @Return */ @PutMapping() public Object USBOUND (@RequestBody user user){Boolean flag = userService.userUpd(user); if(! Flag){return new Result(flag," Modify failed "); } return new Result(flag," Modify successfully "); Public Object findAll(){List<User> userList = UserServer.findAll ();}} /** ** @getMapping () public Object findAll(){List<User> userList = UserServer.findAll (); Return new Result(" all successful ",userList); } /** ** ** * @getMapping (value = "{id}") public Object findById(@PathVariable Integer id){ User user = userService.findById(id); if(user! =null){return new Result(" user ",user); } return new Result(" failed ",user); }}