HouseInfoController.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.ruoyi.web.controller.system;
  2. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  3. import com.ruoyi.common.core.domain.AjaxResult;
  4. import com.ruoyi.web.domain.dto.house.HouseInfoQueryRequest;
  5. import com.ruoyi.web.domain.entity.HouseInfo;
  6. import com.ruoyi.web.domain.vo.HouseInfoVO;
  7. import com.ruoyi.web.service.HouseInfoService;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.web.bind.annotation.*;
  12. import java.util.List;
  13. import static com.ruoyi.common.core.domain.AjaxResult.error;
  14. import static com.ruoyi.common.core.domain.AjaxResult.success;
  15. @Api("房屋信息管理")
  16. @RestController
  17. @RequestMapping("/system/houseinfo")
  18. public class HouseInfoController {
  19. @Autowired
  20. private HouseInfoService houseInfoService;
  21. /**
  22. * 根据 id 查询房屋信息
  23. *
  24. * @param id
  25. * @return
  26. */
  27. @ApiOperation("根据 id 查询房屋信息")
  28. @GetMapping("/get")
  29. public AjaxResult getHouseById(Long id) {
  30. System.out.println(1);
  31. if (id <= 0) {
  32. return error("请求参数异常");
  33. }
  34. HouseInfo houseInfo = houseInfoService.getById(id);
  35. if (houseInfo == null) {
  36. return success("未查到数据");
  37. }
  38. return success(houseInfo);
  39. }
  40. /**
  41. * 查询房屋信息列表
  42. *
  43. * @param houseInfoQueryRequest
  44. * @return
  45. */
  46. @ApiOperation("查询房屋信息列表")
  47. @PostMapping("/list")
  48. public AjaxResult listHouseInfo(@RequestBody HouseInfoQueryRequest houseInfoQueryRequest) {
  49. List<HouseInfoVO> houseInfoVOList = houseInfoService.getHouseInfo(houseInfoQueryRequest);
  50. return success(houseInfoVOList);
  51. }
  52. /**
  53. * 分页获取房屋列表 mybatis-plus
  54. *
  55. * @param houseInfoQueryRequest
  56. * @return
  57. */
  58. @ApiOperation("分页获取房屋列表")
  59. @PostMapping("/list/page")
  60. public AjaxResult listHouseInfoByPage(@RequestBody HouseInfoQueryRequest houseInfoQueryRequest) {
  61. if (houseInfoQueryRequest == null) {
  62. return error("请求参数为空");
  63. }
  64. Page<HouseInfoVO> listHouseInfoByPage = houseInfoService.getListHouseInfoByPage(houseInfoQueryRequest);
  65. return success(listHouseInfoByPage);
  66. }
  67. // /**
  68. // * 分页获取房屋列表(封装类)
  69. // */
  70. // public AjaxResult listHouseInfoVOByPage(HouseInfoQueryRequest houseInfoQueryRequest,
  71. // HttpServletRequest request) {
  72. // long current = pictureQueryRequest.getCurrent();
  73. // long size = pictureQueryRequest.getPageSize();
  74. // // 限制爬虫
  75. // ThrowUtils.throwIf(size > 20, ErrorCode.PARAMS_ERROR);
  76. //
  77. // // 空间权限校验
  78. // Long spaceId = pictureQueryRequest.getSpaceId();
  79. // if(spaceId == null){
  80. // // 公共图库
  81. // // 普通用户默认只能看到审核通过的数据
  82. // pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
  83. // pictureQueryRequest.setNullSpaceId(true);
  84. // }else{
  85. // boolean hasPermission = StpKit.SPACE.hasPermission(SpaceUserPermissionConstant.PICTURE_VIEW);
  86. // ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR);
  87. // // 已经改为注解鉴权
  88. // // 私有图库
  89. // // 普通用户默认只能看到审核通过的数据
  90. //// User loginUser = userClient.getLoginUser(request);
  91. //// Space space = spaceService.getById(spaceId);
  92. //// ThrowUtils.throwIf(space == null , ErrorCode.NOT_FOUND_ERROR,"空间不存在");
  93. //// if(!loginUser.getId().equals(space.getUserId())){
  94. //// throw new BusinessException(ErrorCode.NO_AUTH_ERROR,"没有空间权限");
  95. //// }
  96. // pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
  97. // pictureQueryRequest.setNullSpaceId(false);
  98. // }
  99. // // 查询数据库
  100. // Page<Picture> picturePage = pictureService.page(new Page<>(current, size),
  101. // pictureService.getQueryWrapper(pictureQueryRequest));
  102. // // 获取封装类
  103. // return ResultUtils.success(pictureService.getPictureVOPage(picturePage, request));
  104. // }
  105. }