add feedback
parent
ee6d81f1cf
commit
b08f32db4a
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.feedback;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.module.iot.service.feedback.FeedbackService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户反馈")
|
||||
@RestController
|
||||
@RequestMapping("/iot/feedback")
|
||||
@Validated
|
||||
public class FeedbackController {
|
||||
|
||||
@Resource
|
||||
private FeedbackService feedbackService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户反馈")
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:create')")
|
||||
public CommonResult<Long> createFeedback(@Valid @RequestBody FeedbackSaveReqVO createReqVO) {
|
||||
return success(feedbackService.createFeedback(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户反馈")
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:update')")
|
||||
public CommonResult<Boolean> updateFeedback(@Valid @RequestBody FeedbackSaveReqVO updateReqVO) {
|
||||
feedbackService.updateFeedback(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户反馈")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:delete')")
|
||||
public CommonResult<Boolean> deleteFeedback(@RequestParam("id") Long id) {
|
||||
feedbackService.deleteFeedback(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户反馈")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:query')")
|
||||
public CommonResult<FeedbackRespVO> getFeedback(@RequestParam("id") Long id) {
|
||||
FeedbackDO feedback = feedbackService.getFeedback(id);
|
||||
return success(BeanUtils.toBean(feedback, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户反馈分页")
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:query')")
|
||||
public CommonResult<PageResult<FeedbackRespVO>> getFeedbackPage(@Valid FeedbackPageReqVO pageReqVO) {
|
||||
PageResult<FeedbackDO> pageResult = feedbackService.getFeedbackPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户反馈 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('iot:feedback:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportFeedbackExcel(@Valid FeedbackPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FeedbackDO> list = feedbackService.getFeedbackPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用户反馈.xls", "数据", FeedbackRespVO.class,
|
||||
BeanUtils.toBean(list, FeedbackRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.feedback.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FeedbackPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tags;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.feedback.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FeedbackRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4919")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "内容")
|
||||
@ExcelProperty("内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "标签")
|
||||
@ExcelProperty("标签")
|
||||
private String tags;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
@ExcelProperty("创建者")
|
||||
private String creator;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.feedback.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户反馈新增/修改 Request VO")
|
||||
@Data
|
||||
public class FeedbackSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4919")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tags;
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.iot.dal.dataobject.feedback;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户反馈 DO
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@TableName("iot_feedback")
|
||||
@KeySequence("iot_feedback_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FeedbackDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.iot.dal.mysql.feedback;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.feedback.FeedbackDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.feedback.vo.*;
|
||||
|
||||
/**
|
||||
* 用户反馈 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface FeedbackMapper extends BaseMapperX<FeedbackDO> {
|
||||
|
||||
default PageResult<FeedbackDO> selectPage(FeedbackPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FeedbackDO>()
|
||||
.eqIfPresent(FeedbackDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(FeedbackDO::getContent, reqVO.getContent())
|
||||
.eqIfPresent(FeedbackDO::getTags, reqVO.getTags())
|
||||
.eqIfPresent(FeedbackDO::getCreator, reqVO.getCreator())
|
||||
.betweenIfPresent(FeedbackDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FeedbackDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.iot.service.feedback;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 用户反馈 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface FeedbackService {
|
||||
|
||||
/**
|
||||
* 创建用户反馈
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createFeedback(@Valid FeedbackSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户反馈
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFeedback(@Valid FeedbackSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户反馈
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFeedback(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户反馈
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户反馈
|
||||
*/
|
||||
FeedbackDO getFeedback(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户反馈分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户反馈分页
|
||||
*/
|
||||
PageResult<FeedbackDO> getFeedbackPage(FeedbackPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.iot.service.feedback;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.dal.mysql.feedback.FeedbackMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户反馈 Service 实现类
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FeedbackServiceImpl implements FeedbackService {
|
||||
|
||||
@Resource
|
||||
private FeedbackMapper feedbackMapper;
|
||||
|
||||
@Override
|
||||
public Long createFeedback(FeedbackSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FeedbackDO feedback = BeanUtils.toBean(createReqVO, FeedbackDO.class);
|
||||
feedbackMapper.insert(feedback);
|
||||
// 返回
|
||||
return feedback.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFeedback(FeedbackSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFeedbackExists(updateReqVO.getId());
|
||||
// 更新
|
||||
FeedbackDO updateObj = BeanUtils.toBean(updateReqVO, FeedbackDO.class);
|
||||
feedbackMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFeedback(Long id) {
|
||||
// 校验存在
|
||||
validateFeedbackExists(id);
|
||||
// 删除
|
||||
feedbackMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateFeedbackExists(Long id) {
|
||||
if (feedbackMapper.selectById(id) == null) {
|
||||
throw exception(FEEDBACK_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeedbackDO getFeedback(Long id) {
|
||||
return feedbackMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FeedbackDO> getFeedbackPage(FeedbackPageReqVO pageReqVO) {
|
||||
return feedbackMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
package cn.iocoder.yudao.module.iot.service.feedback;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.feedback.vo.*;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.feedback.FeedbackDO;
|
||||
import cn.iocoder.yudao.module.iot.dal.mysql.feedback.FeedbackMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link FeedbackServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Import(FeedbackServiceImpl.class)
|
||||
public class FeedbackServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private FeedbackServiceImpl feedbackService;
|
||||
|
||||
@Resource
|
||||
private FeedbackMapper feedbackMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateFeedback_success() {
|
||||
// 准备参数
|
||||
FeedbackSaveReqVO createReqVO = randomPojo(FeedbackSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long feedbackId = feedbackService.createFeedback(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(feedbackId);
|
||||
// 校验记录的属性是否正确
|
||||
FeedbackDO feedback = feedbackMapper.selectById(feedbackId);
|
||||
assertPojoEquals(createReqVO, feedback, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFeedback_success() {
|
||||
// mock 数据
|
||||
FeedbackDO dbFeedback = randomPojo(FeedbackDO.class);
|
||||
feedbackMapper.insert(dbFeedback);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
FeedbackSaveReqVO updateReqVO = randomPojo(FeedbackSaveReqVO.class, o -> {
|
||||
o.setId(dbFeedback.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
feedbackService.updateFeedback(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
FeedbackDO feedback = feedbackMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, feedback);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFeedback_notExists() {
|
||||
// 准备参数
|
||||
FeedbackSaveReqVO updateReqVO = randomPojo(FeedbackSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> feedbackService.updateFeedback(updateReqVO), FEEDBACK_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteFeedback_success() {
|
||||
// mock 数据
|
||||
FeedbackDO dbFeedback = randomPojo(FeedbackDO.class);
|
||||
feedbackMapper.insert(dbFeedback);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbFeedback.getId();
|
||||
|
||||
// 调用
|
||||
feedbackService.deleteFeedback(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(feedbackMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteFeedback_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> feedbackService.deleteFeedback(id), FEEDBACK_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetFeedbackPage() {
|
||||
// mock 数据
|
||||
FeedbackDO dbFeedback = randomPojo(FeedbackDO.class, o -> { // 等会查询到
|
||||
o.setTitle(null);
|
||||
o.setContent(null);
|
||||
o.setTags(null);
|
||||
o.setCreator(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
feedbackMapper.insert(dbFeedback);
|
||||
// 测试 title 不匹配
|
||||
feedbackMapper.insert(cloneIgnoreId(dbFeedback, o -> o.setTitle(null)));
|
||||
// 测试 content 不匹配
|
||||
feedbackMapper.insert(cloneIgnoreId(dbFeedback, o -> o.setContent(null)));
|
||||
// 测试 tags 不匹配
|
||||
feedbackMapper.insert(cloneIgnoreId(dbFeedback, o -> o.setTags(null)));
|
||||
// 测试 creator 不匹配
|
||||
feedbackMapper.insert(cloneIgnoreId(dbFeedback, o -> o.setCreator(null)));
|
||||
// 测试 createTime 不匹配
|
||||
feedbackMapper.insert(cloneIgnoreId(dbFeedback, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
FeedbackPageReqVO reqVO = new FeedbackPageReqVO();
|
||||
reqVO.setTitle(null);
|
||||
reqVO.setContent(null);
|
||||
reqVO.setTags(null);
|
||||
reqVO.setCreator(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<FeedbackDO> pageResult = feedbackService.getFeedbackPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbFeedback, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue