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 bb85ba3 commit ebb23ee
Show file tree
Hide file tree
Showing 15 changed files with 432 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package cn.zm.trip.restful;

import cn.zm.common.base.ResResult;
import cn.zm.mybatis.base.BaseController;
import cn.zm.trip.entity.dto.RelaScenicSpotCommentsDTO;
import cn.zm.trip.entity.vo.RelaScenicSpotCommentsVO;
import cn.zm.trip.service.IRelaScenicSpotCommentsService;
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;

/**
* 关联景区评论关联表
* @author 十渊
* @since 2022-07-12
*/
@RequestMapping("relaScenicSpotComments")
@RestController
@Api(tags = "关联景区评论关联表")
public class RelaScenicSpotCommentsController extends BaseController {

@Resource
private IRelaScenicSpotCommentsService relaScenicSpotCommentsService;

@GetMapping
@ApiOperation("关联景区评论关联表page查询")
public ResResult<IPage<RelaScenicSpotCommentsVO>> getByPage(@Validated RelaScenicSpotCommentsDTO relaScenicSpotComments) {
// TODO 分页查询
IPage<RelaScenicSpotCommentsVO> page = relaScenicSpotCommentsService.selectByPage(getPage(), relaScenicSpotComments);
return ResResult.succ(page);
}

// @PostMapping("list")
// @ApiOperation("关联景区评论关联表list查询")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "orderByColumn", value = "排序字段"),
// @ApiImplicitParam(name = "isDesc", value = "是否降序")
// })
// public ResResult<List<RelaScenicSpotCommentsVO>> list(@Validated @RequestBody RelaScenicSpotCommentsDTO relaScenicSpotComments) {
// // TODO 分页查询
// IPage<RelaScenicSpotCommentsVO> page = relaScenicSpotCommentsService.list(getPage(), relaScenicSpotComments);
// return ResResult.succ(page);
// }

@GetMapping("{id}")
@ApiOperation("关联景区评论关联表查询(id)")
public ResResult<RelaScenicSpotCommentsVO> get(@PathVariable String id) {
// TODO 查询
boolean aNull = Objects.isNull(relaScenicSpotCommentsService.getById(id));
return ResResult.succ(aNull ? null : relaScenicSpotCommentsService.getById(id).convert());
}

@PostMapping
@ApiOperation("关联景区评论关联表新增")
public ResResult add(@RequestBody @Validated RelaScenicSpotCommentsDTO relaScenicSpotComments) {
// TODO 新增
relaScenicSpotCommentsService.save(relaScenicSpotComments.convert());
return ResResult.succ("新增成功");
}

@DeleteMapping("{id}")
@ApiOperation("关联景区评论关联表删除")
public ResResult del(@PathVariable String id) {
// TODO 删除
relaScenicSpotCommentsService.removeById(id);
return ResResult.succ("删除成功");
}

@PutMapping
@ApiOperation("关联景区评论关联表修改")
public ResResult update(@RequestBody @Validated RelaScenicSpotCommentsDTO relaScenicSpotComments) {
// TODO 修改
relaScenicSpotCommentsService.updateById(relaScenicSpotComments.convert());
return ResResult.succ("修改成功");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package cn.zm.trip.restful;

import cn.zm.common.base.ResResult;
import cn.zm.mybatis.base.BaseController;
import cn.zm.trip.entity.dto.RelaUserCommentsDTO;
import cn.zm.trip.entity.vo.RelaUserCommentsVO;
import cn.zm.trip.service.IRelaUserCommentsService;
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;

/**
* 关联用户评论表
* @author 十渊
* @since 2022-07-12
*/
@RequestMapping("relaUserComments")
@RestController
@Api(tags = "关联用户评论表")
public class RelaUserCommentsController extends BaseController {

@Resource
private IRelaUserCommentsService relaUserCommentsService;

@GetMapping
@ApiOperation("关联用户评论表page查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页数", defaultValue = "1"),
@ApiImplicitParam(name = "size", value = "每页个数", defaultValue = "10"),
@ApiImplicitParam(name = "orderByColumn", value = "排序字段"),
@ApiImplicitParam(name = "isDesc", value = "是否降序")
})
public ResResult<IPage<RelaUserCommentsVO>> getByPage(@Validated RelaUserCommentsDTO relaUserComments) {
// TODO 分页查询
IPage<RelaUserCommentsVO> page = relaUserCommentsService.selectByPage(getPage(), relaUserComments);
return ResResult.succ(page);
}

// @PostMapping("list")
// @ApiOperation("关联用户评论表list查询")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "orderByColumn", value = "排序字段"),
// @ApiImplicitParam(name = "isDesc", value = "是否降序")
// })
// public ResResult<List<RelaUserCommentsVO>> list(@Validated @RequestBody RelaUserCommentsDTO relaUserComments) {
// // TODO 分页查询
// IPage<RelaUserCommentsVO> page = relaUserCommentsService.list(getPage(), relaUserComments);
// return ResResult.succ(page);
// }

@GetMapping("{id}")
@ApiOperation("关联用户评论表查询(id)")
public ResResult<RelaUserCommentsVO> get(@PathVariable String id) {
// TODO 查询
boolean aNull = Objects.isNull(relaUserCommentsService.getById(id));
return ResResult.succ(aNull ? null : relaUserCommentsService.getById(id).convert());
}

@PostMapping
@ApiOperation("关联用户评论表新增")
public ResResult add(@RequestBody @Validated RelaUserCommentsDTO relaUserComments) {
// TODO 新增
relaUserCommentsService.save(relaUserComments.convert());
return ResResult.succ("新增成功");
}

@DeleteMapping("{id}")
@ApiOperation("关联用户评论表删除")
public ResResult del(@PathVariable String id) {
// TODO 删除
relaUserCommentsService.removeById(id);
return ResResult.succ("删除成功");
}

@PutMapping
@ApiOperation("关联用户评论表修改")
public ResResult update(@RequestBody @Validated RelaUserCommentsDTO relaUserComments) {
// TODO 修改
relaUserCommentsService.updateById(relaUserComments.convert());
return ResResult.succ("修改成功");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
@RequestMapping("viewUserAccount")
@RestController
@Api(tags = "VIEW用户及账户信息")
@Api(tags = "视图-用户及账户信息")
public class ViewUserAccountController extends BaseController {

@Resource
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cn.zm.trip.entity;

import cn.zm.trip.entity.vo.RelaScenicSpotCommentsVO;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_scenic_spot_comments")
@ApiModel(value="RelaScenicSpotComments对象", description="关联景区评论关联表")
public class RelaScenicSpotComments extends ObjectConvert<RelaScenicSpotCommentsVO>{
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "景点id")
private Long scenicSpotId;
@ApiModelProperty(value = "评论id")
private Long commentsId;
}

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

import cn.zm.trip.entity.vo.RelaUserCommentsVO;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_user_comments")
@ApiModel(value="RelaUserComments对象", description="关联用户评论表")
public class RelaUserComments extends ObjectConvert<RelaUserCommentsVO>{
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "评论id")
private String commentsId;
}

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

import cn.zm.trip.entity.RelaScenicSpotComments;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_scenic_spot_comments")
@ApiModel(value="RelaScenicSpotCommentsDTO对象", description="关联景区评论关联表")
public class RelaScenicSpotCommentsDTO extends ObjectConvert<RelaScenicSpotComments>{
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "景点id")
private Long scenicSpotId;
@ApiModelProperty(value = "评论id")
private Long commentsId;
}

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

import cn.zm.trip.entity.RelaUserComments;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_user_comments")
@ApiModel(value="RelaUserCommentsDTO对象", description="关联用户评论表")
public class RelaUserCommentsDTO extends ObjectConvert<RelaUserComments>{
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "评论id")
private String commentsId;
}

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

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_scenic_spot_comments")
@ApiModel(value="RelaScenicSpotCommentsVO对象", description="关联景区评论关联表")
public class RelaScenicSpotCommentsVO {
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "景点id")
private Long scenicSpotId;
@ApiModelProperty(value = "评论id")
private Long commentsId;
}

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

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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("rela_user_comments")
@ApiModel(value="RelaUserCommentsVO对象", description="关联用户评论表")
public class RelaUserCommentsVO {
@ApiModelProperty(value = "ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "评论id")
private String commentsId;
}

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

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

@Mapper
public interface RelaScenicSpotCommentsMapper extends BaseMapper<RelaScenicSpotComments> {

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

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

@Mapper
public interface RelaUserCommentsMapper extends BaseMapper<RelaUserComments> {

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

import cn.zm.trip.entity.RelaScenicSpotComments;
import cn.zm.trip.entity.dto.RelaScenicSpotCommentsDTO;
import cn.zm.trip.entity.vo.RelaScenicSpotCommentsVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

public interface IRelaScenicSpotCommentsService extends IService<RelaScenicSpotComments> {
/**
* 分页查询
*
* @param page 分页信息
* @param RelaScenicSpotComments 关联景区评论关联表入参
* @return 分页结果
*/
IPage<RelaScenicSpotCommentsVO> selectByPage(IPage<RelaScenicSpotComments> page, RelaScenicSpotCommentsDTO RelaScenicSpotComments);
}
Loading

0 comments on commit ebb23ee

Please sign in to comment.