123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- package com.ruoyi.web.controller.system;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.web.domain.dto.house.HouseInfoQueryRequest;
- import com.ruoyi.web.domain.entity.HouseInfo;
- import com.ruoyi.web.domain.vo.HouseInfoVO;
- import com.ruoyi.web.service.HouseInfoService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import static com.ruoyi.common.core.domain.AjaxResult.error;
- import static com.ruoyi.common.core.domain.AjaxResult.success;
- @Api("房屋信息管理")
- @RestController
- @RequestMapping("/system/houseinfo")
- public class HouseInfoController {
- @Autowired
- private HouseInfoService houseInfoService;
- /**
- * 根据 id 查询房屋信息
- *
- * @param id
- * @return
- */
- @ApiOperation("根据 id 查询房屋信息")
- @GetMapping("/get")
- public AjaxResult getHouseById(Long id) {
- System.out.println(1);
- if (id <= 0) {
- return error("请求参数异常");
- }
- HouseInfo houseInfo = houseInfoService.getById(id);
- if (houseInfo == null) {
- return success("未查到数据");
- }
- return success(houseInfo);
- }
- /**
- * 查询房屋信息列表
- *
- * @param houseInfoQueryRequest
- * @return
- */
- @ApiOperation("查询房屋信息列表")
- @PostMapping("/list")
- public AjaxResult listHouseInfo(@RequestBody HouseInfoQueryRequest houseInfoQueryRequest) {
- List<HouseInfoVO> houseInfoVOList = houseInfoService.getHouseInfo(houseInfoQueryRequest);
- return success(houseInfoVOList);
- }
- /**
- * 分页获取房屋列表 mybatis-plus
- *
- * @param houseInfoQueryRequest
- * @return
- */
- @ApiOperation("分页获取房屋列表")
- @PostMapping("/list/page")
- public AjaxResult listHouseInfoByPage(@RequestBody HouseInfoQueryRequest houseInfoQueryRequest) {
- if (houseInfoQueryRequest == null) {
- return error("请求参数为空");
- }
- Page<HouseInfoVO> listHouseInfoByPage = houseInfoService.getListHouseInfoByPage(houseInfoQueryRequest);
- return success(listHouseInfoByPage);
- }
- // /**
- // * 分页获取房屋列表(封装类)
- // */
- // public AjaxResult listHouseInfoVOByPage(HouseInfoQueryRequest houseInfoQueryRequest,
- // HttpServletRequest request) {
- // long current = pictureQueryRequest.getCurrent();
- // long size = pictureQueryRequest.getPageSize();
- // // 限制爬虫
- // ThrowUtils.throwIf(size > 20, ErrorCode.PARAMS_ERROR);
- //
- // // 空间权限校验
- // Long spaceId = pictureQueryRequest.getSpaceId();
- // if(spaceId == null){
- // // 公共图库
- // // 普通用户默认只能看到审核通过的数据
- // pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
- // pictureQueryRequest.setNullSpaceId(true);
- // }else{
- // boolean hasPermission = StpKit.SPACE.hasPermission(SpaceUserPermissionConstant.PICTURE_VIEW);
- // ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR);
- // // 已经改为注解鉴权
- // // 私有图库
- // // 普通用户默认只能看到审核通过的数据
- //// User loginUser = userClient.getLoginUser(request);
- //// Space space = spaceService.getById(spaceId);
- //// ThrowUtils.throwIf(space == null , ErrorCode.NOT_FOUND_ERROR,"空间不存在");
- //// if(!loginUser.getId().equals(space.getUserId())){
- //// throw new BusinessException(ErrorCode.NO_AUTH_ERROR,"没有空间权限");
- //// }
- // pictureQueryRequest.setReviewStatus(PictureReviewStatusEnum.PASS.getValue());
- // pictureQueryRequest.setNullSpaceId(false);
- // }
- // // 查询数据库
- // Page<Picture> picturePage = pictureService.page(new Page<>(current, size),
- // pictureService.getQueryWrapper(pictureQueryRequest));
- // // 获取封装类
- // return ResultUtils.success(pictureService.getPictureVOPage(picturePage, request));
- // }
- }
|