| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.User; |
| | | import com.whyc.service.LoginService; |
| | | import com.whyc.service.UserService; |
| | | import io.swagger.annotations.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加") |
| | | public boolean add(@RequestBody User user){ |
| | | user.setCreateTime(new Date()); |
| | | public Response add(@RequestBody User user){ |
| | | return userService.add(user); |
| | | } |
| | | |
| | | @PostMapping("/batch") |
| | | @ApiOperation(value = "添加批量") |
| | | public boolean addBatch(@RequestBody List<User> users){ |
| | | for (User temp:users){ |
| | | temp.setCreateTime(new Date()); |
| | | } |
| | | return userService.addBatch(users); |
| | | } |
| | | |
| | | @GetMapping |
| | |
| | | @ApiOperation(value = "删除") |
| | | public boolean delete(@RequestParam int id){ |
| | | return userService.delete(id); |
| | | } |
| | | |
| | | @PostMapping("login") |
| | | @ApiOperation(value = "登录",position = 1) |
| | | public boolean login(@RequestParam String username, @RequestParam String password, HttpServletRequest request){ |
| | | return userService.login(username,password,request); |
| | | } |
| | | |
| | | /** |