| | |
| | | import com.boying.service.ParkService; |
| | | import com.boying.service.UserService; |
| | | import com.boying.util.LngLatUtil; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.data.jpa.domain.Specification; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | @RestController |
| | | @RequestMapping("/ffzf/user") |
| | | @RequiredArgsConstructor |
| | | @Tag(description = "ffzf/user" , name = "用户接口" ) |
| | | public class UserController{ |
| | | |
| | | private final UserService userService; |
| | | private final ParkService parkService; |
| | | |
| | | @PostMapping("/findPage") |
| | | @Operation(summary = "分页查询" , description = "分页查询" ) |
| | | public Object findPage(User user, Page page) { |
| | | QueryWrapper<User> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | } |
| | | |
| | | @PostMapping("/findAll") |
| | | @Operation(summary = "查询所有" , description = "查询所有" ) |
| | | public Object findAll() { |
| | | return R.ok(userService.list()); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "新增用户" , description = "新增用户" ) |
| | | public Object save(User user) { |
| | | if(user.getId()==null){ |
| | | user.setPassword(user.getLoginName()); |
| | | } |
| | | userService.saveOrUpdate(user); |
| | | return R.ok("保存成功"); |
| | | } |
| | | |
| | | @PostMapping("/delete") |
| | | @Operation(summary = "删除用户" , description = "删除用户" ) |
| | | public Object delete(Long id) { |
| | | userService.removeById(id); |
| | | return R.ok("删除成功"); |
| | | } |
| | | |
| | | @PostMapping("/login") |
| | | @Operation(summary = "登录" , description = "登录" ) |
| | | public Object login(String loginName,String password,String lng,String lat) { |
| | | if(StringUtils.isBlank(loginName)||StringUtils.isBlank(password)){ |
| | | return R.failed("用户名和密码必填"); |
| | |
| | | } |
| | | |
| | | @PostMapping("updatePassword") |
| | | @Operation(summary = "修改密码" , description = "修改密码" ) |
| | | public Object updatePassword(Long userId,String oldPassword,String newPassword) { |
| | | QueryWrapper<User> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |