Skip to content

Commit

Permalink
视图-景点评论用户关联
Browse files Browse the repository at this point in the history
  • Loading branch information
niziming committed Jul 12, 2022
1 parent d70851f commit bb85ba3
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 140 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package cn.zm.trip.restful;

import cn.zm.common.base.ResResult;
import cn.zm.mybatis.base.BaseController;
import cn.zm.trip.entity.dto.ViewScenicSpotCommentsUserDTO;
import cn.zm.trip.entity.vo.ViewScenicSpotCommentsUserVO;
import cn.zm.trip.service.IViewScenicSpotCommentsUserService;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Objects;
import java.util.List;

/**
* VIEW
* @author 十渊
* @since 2022-07-12
*/
@RequestMapping("viewScenicSpotCommentsUser")
@RestController
@Api(tags = "视图-景点评论用户关联")
public class ViewScenicSpotCommentsUserController extends BaseController {

@Resource
private IViewScenicSpotCommentsUserService viewScenicSpotCommentsUserService;

@GetMapping
@ApiOperation("VIEWpage查询")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "page", value = "当前页数", defaultValue = "1"),
// @ApiImplicitParam(name = "size", value = "每页个数", defaultValue = "10"),
// @ApiImplicitParam(name = "orderByColumn", value = "排序字段"),
// @ApiImplicitParam(name = "isDesc", value = "是否降序")
// })
public ResResult<IPage<ViewScenicSpotCommentsUserVO>> getByPage(@Validated ViewScenicSpotCommentsUserDTO viewScenicSpotCommentsUser) {
// TODO 分页查询
IPage<ViewScenicSpotCommentsUserVO> page = viewScenicSpotCommentsUserService.selectByPage(getPage(), viewScenicSpotCommentsUser);
return ResResult.succ(page);
}


@GetMapping("{id}")
@ApiOperation("VIEW查询(id)")
public ResResult<ViewScenicSpotCommentsUserVO> get(@PathVariable String id) {
// TODO 查询
boolean aNull = Objects.isNull(viewScenicSpotCommentsUserService.getById(id));
return ResResult.succ(aNull ? null : viewScenicSpotCommentsUserService.getById(id).convert());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cn.zm.trip.entity;

import cn.zm.trip.entity.vo.ViewScenicSpotCommentsUserVO;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.zm.mybatis.utils.ObjectConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@TableName("view_scenic_spot_comments_user")
@ApiModel(value="ViewScenicSpotCommentsUser对象", description="VIEW")
public class ViewScenicSpotCommentsUser extends ObjectConvert<ViewScenicSpotCommentsUserVO>{
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "电话号码")
private String phone;
@ApiModelProperty(value = "简介")
private String intro;
@ApiModelProperty(value = "父评论id")
private Long parentId;
@ApiModelProperty(value = "内容")
private String content;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cn.zm.trip.entity.dto;

import cn.zm.trip.entity.ViewScenicSpotCommentsUser;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.zm.mybatis.utils.ObjectConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@TableName("view_scenic_spot_comments_user")
@ApiModel(value="ViewScenicSpotCommentsUserDTO对象", description="VIEW")
public class ViewScenicSpotCommentsUserDTO extends ObjectConvert<ViewScenicSpotCommentsUser>{
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "电话号码")
private String phone;
@ApiModelProperty(value = "简介")
private String intro;
@ApiModelProperty(value = "父评论id")
private Long parentId;
@ApiModelProperty(value = "内容")
private String content;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package cn.zm.trip.entity.vo;

import com.baomidou.mybatisplus.annotation.TableName;
import cn.zm.mybatis.utils.ObjectConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@TableName("view_scenic_spot_comments_user")
@ApiModel(value="ViewScenicSpotCommentsUserVO对象", description="VIEW")
public class ViewScenicSpotCommentsUserVO {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "头像")
private String avatar;
@ApiModelProperty(value = "电话号码")
private String phone;
@ApiModelProperty(value = "简介")
private String intro;
@ApiModelProperty(value = "父评论id")
private Long parentId;
@ApiModelProperty(value = "内容")
private String content;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cn.zm.trip.mapper;

import cn.zm.trip.entity.ViewScenicSpotCommentsUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ViewScenicSpotCommentsUserMapper extends BaseMapper<ViewScenicSpotCommentsUser> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cn.zm.trip.service;

import cn.zm.trip.entity.ViewScenicSpotCommentsUser;
import cn.zm.trip.entity.dto.ViewScenicSpotCommentsUserDTO;
import cn.zm.trip.entity.vo.ViewScenicSpotCommentsUserVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

public interface IViewScenicSpotCommentsUserService extends IService<ViewScenicSpotCommentsUser> {
/**
* 分页查询
*
* @param page 分页信息
* @param ViewScenicSpotCommentsUser VIEW入参
* @return 分页结果
*/
IPage<ViewScenicSpotCommentsUserVO> selectByPage(IPage<ViewScenicSpotCommentsUser> page, ViewScenicSpotCommentsUserDTO ViewScenicSpotCommentsUser);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cn.zm.trip.service.impl;

import cn.zm.mybatis.utils.ConvertUtil;
import cn.zm.trip.entity.ViewScenicSpotCommentsUser;
import cn.zm.trip.entity.dto.ViewScenicSpotCommentsUserDTO;
import cn.zm.trip.entity.vo.ViewScenicSpotCommentsUserVO;
import cn.zm.trip.mapper.ViewScenicSpotCommentsUserMapper;
import cn.zm.trip.service.IViewScenicSpotCommentsUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


@Service
@Transactional(rollbackFor = Exception.class)
public class ViewScenicSpotCommentsUserServiceImpl extends ServiceImpl<ViewScenicSpotCommentsUserMapper, ViewScenicSpotCommentsUser> implements IViewScenicSpotCommentsUserService {
@Override
public IPage<ViewScenicSpotCommentsUserVO> selectByPage(IPage<ViewScenicSpotCommentsUser> page, ViewScenicSpotCommentsUserDTO view_scenic_spot_comments_user) {
IPage<ViewScenicSpotCommentsUser> view_scenic_spot_comments_userPage = baseMapper.selectPage(page, new QueryWrapper<>(view_scenic_spot_comments_user.convert()));
return ConvertUtil.buildPage(view_scenic_spot_comments_userPage);
}
}

0 comments on commit bb85ba3

Please sign in to comment.