日程管理
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
XaoLi717 2024-11-18 10:04:01 +08:00
parent b6715705a4
commit fb9b38cc9f
13 changed files with 725 additions and 1 deletions

View File

@ -28,5 +28,6 @@ public interface ErrorCodeConstants {
ErrorCode HYGL_NOT_EXISTS = new ErrorCode(1_011_008_000, "会议管理不存在"); ErrorCode HYGL_NOT_EXISTS = new ErrorCode(1_011_008_000, "会议管理不存在");
// ========== 会议室管理 1_011_009_000 ========== // ========== 会议室管理 1_011_009_000 ==========
ErrorCode HYSGL_NOT_EXISTS = new ErrorCode(1_011_009_000, "会议室管理不存在"); ErrorCode HYSGL_NOT_EXISTS = new ErrorCode(1_011_009_000, "会议室管理不存在");
// ========== 领导日程安排 1_011_010_000, ==========
ErrorCode RCGL_NOT_EXISTS = new ErrorCode(1_011_010_000, "领导日程安排不存在");
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.home.controller.admin.rcgl;
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.home.controller.admin.rcgl.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.rcgl.RcglDO;
import cn.iocoder.yudao.module.home.service.rcgl.RcglService;
@Tag(name = "管理后台 - 领导日程安排")
@RestController
@RequestMapping("/home/rcgl")
@Validated
public class RcglController {
@Resource
private RcglService rcglService;
@PostMapping("/create")
@Operation(summary = "创建领导日程安排")
@PreAuthorize("@ss.hasPermission('home:rcgl:create')")
public CommonResult<Long> createRcgl(@Valid @RequestBody RcglSaveReqVO createReqVO) {
return success(rcglService.createRcgl(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新领导日程安排")
@PreAuthorize("@ss.hasPermission('home:rcgl:update')")
public CommonResult<Boolean> updateRcgl(@Valid @RequestBody RcglSaveReqVO updateReqVO) {
rcglService.updateRcgl(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除领导日程安排")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('home:rcgl:delete')")
public CommonResult<Boolean> deleteRcgl(@RequestParam("id") Long id) {
rcglService.deleteRcgl(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得领导日程安排")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('home:rcgl:query')")
public CommonResult<RcglRespVO> getRcgl(@RequestParam("id") Long id) {
RcglDO rcgl = rcglService.getRcgl(id);
return success(BeanUtils.toBean(rcgl, RcglRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得领导日程安排分页")
@PreAuthorize("@ss.hasPermission('home:rcgl:query')")
public CommonResult<PageResult<RcglRespVO>> getRcglPage(@Valid RcglPageReqVO pageReqVO) {
PageResult<RcglDO> pageResult = rcglService.getRcglPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, RcglRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出领导日程安排 Excel")
@PreAuthorize("@ss.hasPermission('home:rcgl:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportRcglExcel(@Valid RcglPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<RcglDO> list = rcglService.getRcglPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "领导日程安排.xls", "数据", RcglRespVO.class,
BeanUtils.toBean(list, RcglRespVO.class));
}
}

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.home.controller.admin.rcgl.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 RcglPageReqVO extends PageParam {
@Schema(description = "id", example = "1591")
private Long id;
@Schema(description = "日程标题")
private String title;
@Schema(description = "日程地点")
private String location;
@Schema(description = "日程相关链接")
private String videoLink;
@Schema(description = "日程内容")
private String content;
@Schema(description = "开始日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] date;
@Schema(description = "日程开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] startTime;
@Schema(description = "日程结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] endTime;
@Schema(description = "日程状态", example = "2")
private Integer status;
@Schema(description = "备注")
private String remarks;
@Schema(description = "是否公开展示")
private Integer ispublic;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.home.controller.admin.rcgl.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 领导日程安排 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RcglRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1591")
@ExcelProperty("id")
private Long id;
@Schema(description = "日程标题", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("日程标题")
private String title;
@Schema(description = "日程地点")
@ExcelProperty("日程地点")
private String location;
@Schema(description = "日程相关链接")
@ExcelProperty("日程相关链接")
private String videoLink;
@Schema(description = "日程内容")
@ExcelProperty("日程内容")
private String content;
@Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("开始日期")
private LocalDateTime date;
@Schema(description = "日程开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("日程开始时间")
private LocalDateTime startTime;
@Schema(description = "日程结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("日程结束时间")
private LocalDateTime endTime;
@Schema(description = "日程状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "日程状态", converter = DictConvert.class)
@DictFormat("rcgl_rc_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remarks;
@Schema(description = "是否公开展示")
@ExcelProperty(value = "是否公开展示", converter = DictConvert.class)
@DictFormat("rcgl_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer ispublic;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.home.controller.admin.rcgl.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 领导日程安排新增/修改 Request VO")
@Data
public class RcglSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1591")
private Long id;
@Schema(description = "日程标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "日程标题不能为空")
private String title;
@Schema(description = "日程地点")
private String location;
@Schema(description = "日程相关链接")
private String videoLink;
@Schema(description = "日程内容")
private String content;
@Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "开始日期不能为空")
private LocalDateTime date;
@Schema(description = "日程开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "日程开始时间不能为空")
private LocalDateTime startTime;
@Schema(description = "日程结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "日程结束时间不能为空")
private LocalDateTime endTime;
@Schema(description = "日程状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "日程状态不能为空")
private Integer status;
@Schema(description = "备注")
private String remarks;
@Schema(description = "是否公开展示")
private Integer ispublic;
}

View File

@ -0,0 +1,78 @@
package cn.iocoder.yudao.module.home.dal.dataobject.rcgl;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
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("oa_rcgl")
@KeySequence("oa_rcgl_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RcglDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 日程标题
*/
private String title;
/**
* 日程地点
*/
private String location;
/**
* 日程相关链接
*/
private String videoLink;
/**
* 日程内容
*/
private String content;
/**
* 开始日期
*/
private LocalDateTime date;
/**
* 日程开始时间
*/
private LocalDateTime startTime;
/**
* 日程结束时间
*/
private LocalDateTime endTime;
/**
* 日程状态
*
* 枚举 {@link TODO rcgl_rc_status 对应的类}
*/
private Integer status;
/**
* 备注
*/
private String remarks;
/**
* 是否公开展示
*
* 枚举 {@link TODO rcgl_status 对应的类}
*/
private Integer ispublic;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.home.dal.mysql.rcgl;
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.home.dal.dataobject.rcgl.RcglDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.home.controller.admin.rcgl.vo.*;
/**
* 领导日程安排 Mapper
*
* @author 君风
*/
@Mapper
public interface RcglMapper extends BaseMapperX<RcglDO> {
default PageResult<RcglDO> selectPage(RcglPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RcglDO>()
.eqIfPresent(RcglDO::getId, reqVO.getId())
.eqIfPresent(RcglDO::getTitle, reqVO.getTitle())
.eqIfPresent(RcglDO::getLocation, reqVO.getLocation())
.eqIfPresent(RcglDO::getVideoLink, reqVO.getVideoLink())
.eqIfPresent(RcglDO::getContent, reqVO.getContent())
.betweenIfPresent(RcglDO::getDate, reqVO.getDate())
.betweenIfPresent(RcglDO::getStartTime, reqVO.getStartTime())
.betweenIfPresent(RcglDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(RcglDO::getStatus, reqVO.getStatus())
.eqIfPresent(RcglDO::getRemarks, reqVO.getRemarks())
.eqIfPresent(RcglDO::getIspublic, reqVO.getIspublic())
.betweenIfPresent(RcglDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RcglDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.home.service.rcgl;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.home.controller.admin.rcgl.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.rcgl.RcglDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 领导日程安排 Service 接口
*
* @author 君风
*/
public interface RcglService {
/**
* 创建领导日程安排
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createRcgl(@Valid RcglSaveReqVO createReqVO);
/**
* 更新领导日程安排
*
* @param updateReqVO 更新信息
*/
void updateRcgl(@Valid RcglSaveReqVO updateReqVO);
/**
* 删除领导日程安排
*
* @param id 编号
*/
void deleteRcgl(Long id);
/**
* 获得领导日程安排
*
* @param id 编号
* @return 领导日程安排
*/
RcglDO getRcgl(Long id);
/**
* 获得领导日程安排分页
*
* @param pageReqVO 分页查询
* @return 领导日程安排分页
*/
PageResult<RcglDO> getRcglPage(RcglPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.home.service.rcgl;
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.home.controller.admin.rcgl.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.rcgl.RcglDO;
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.home.dal.mysql.rcgl.RcglMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
/**
* 领导日程安排 Service 实现类
*
* @author 君风
*/
@Service
@Validated
public class RcglServiceImpl implements RcglService {
@Resource
private RcglMapper rcglMapper;
@Override
public Long createRcgl(RcglSaveReqVO createReqVO) {
// 插入
RcglDO rcgl = BeanUtils.toBean(createReqVO, RcglDO.class);
rcglMapper.insert(rcgl);
// 返回
return rcgl.getId();
}
@Override
public void updateRcgl(RcglSaveReqVO updateReqVO) {
// 校验存在
validateRcglExists(updateReqVO.getId());
// 更新
RcglDO updateObj = BeanUtils.toBean(updateReqVO, RcglDO.class);
rcglMapper.updateById(updateObj);
}
@Override
public void deleteRcgl(Long id) {
// 校验存在
validateRcglExists(id);
// 删除
rcglMapper.deleteById(id);
}
private void validateRcglExists(Long id) {
if (rcglMapper.selectById(id) == null) {
throw exception(RCGL_NOT_EXISTS);
}
}
@Override
public RcglDO getRcgl(Long id) {
return rcglMapper.selectById(id);
}
@Override
public PageResult<RcglDO> getRcglPage(RcglPageReqVO pageReqVO) {
return rcglMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.home.dal.mysql.rcgl.RcglMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,174 @@
package cn.iocoder.yudao.module.home.service.rcgl;
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.home.controller.admin.rcgl.vo.*;
import cn.iocoder.yudao.module.home.dal.dataobject.rcgl.RcglDO;
import cn.iocoder.yudao.module.home.dal.mysql.rcgl.RcglMapper;
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.home.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 RcglServiceImpl} 的单元测试类
*
* @author 君风
*/
@Import(RcglServiceImpl.class)
public class RcglServiceImplTest extends BaseDbUnitTest {
@Resource
private RcglServiceImpl rcglService;
@Resource
private RcglMapper rcglMapper;
@Test
public void testCreateRcgl_success() {
// 准备参数
RcglSaveReqVO createReqVO = randomPojo(RcglSaveReqVO.class).setId(null);
// 调用
Long rcglId = rcglService.createRcgl(createReqVO);
// 断言
assertNotNull(rcglId);
// 校验记录的属性是否正确
RcglDO rcgl = rcglMapper.selectById(rcglId);
assertPojoEquals(createReqVO, rcgl, "id");
}
@Test
public void testUpdateRcgl_success() {
// mock 数据
RcglDO dbRcgl = randomPojo(RcglDO.class);
rcglMapper.insert(dbRcgl);// @Sql: 先插入出一条存在的数据
// 准备参数
RcglSaveReqVO updateReqVO = randomPojo(RcglSaveReqVO.class, o -> {
o.setId(dbRcgl.getId()); // 设置更新的 ID
});
// 调用
rcglService.updateRcgl(updateReqVO);
// 校验是否更新正确
RcglDO rcgl = rcglMapper.selectById(updateReqVO.getId()); // 获取最新的
assertPojoEquals(updateReqVO, rcgl);
}
@Test
public void testUpdateRcgl_notExists() {
// 准备参数
RcglSaveReqVO updateReqVO = randomPojo(RcglSaveReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> rcglService.updateRcgl(updateReqVO), RCGL_NOT_EXISTS);
}
@Test
public void testDeleteRcgl_success() {
// mock 数据
RcglDO dbRcgl = randomPojo(RcglDO.class);
rcglMapper.insert(dbRcgl);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbRcgl.getId();
// 调用
rcglService.deleteRcgl(id);
// 校验数据不存在了
assertNull(rcglMapper.selectById(id));
}
@Test
public void testDeleteRcgl_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> rcglService.deleteRcgl(id), RCGL_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值然后删除 @Disabled 注解
public void testGetRcglPage() {
// mock 数据
RcglDO dbRcgl = randomPojo(RcglDO.class, o -> { // 等会查询到
o.setId(null);
o.setTitle(null);
o.setLocation(null);
o.setVideoLink(null);
o.setContent(null);
o.setDate(null);
o.setStartTime(null);
o.setEndTime(null);
o.setStatus(null);
o.setRemarks(null);
o.setIspublic(null);
o.setCreateTime(null);
});
rcglMapper.insert(dbRcgl);
// 测试 id 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setId(null)));
// 测试 title 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setTitle(null)));
// 测试 location 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setLocation(null)));
// 测试 videoLink 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setVideoLink(null)));
// 测试 content 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setContent(null)));
// 测试 date 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setDate(null)));
// 测试 startTime 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setStartTime(null)));
// 测试 endTime 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setEndTime(null)));
// 测试 status 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setStatus(null)));
// 测试 remarks 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setRemarks(null)));
// 测试 ispublic 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setIspublic(null)));
// 测试 createTime 不匹配
rcglMapper.insert(cloneIgnoreId(dbRcgl, o -> o.setCreateTime(null)));
// 准备参数
RcglPageReqVO reqVO = new RcglPageReqVO();
reqVO.setId(null);
reqVO.setTitle(null);
reqVO.setLocation(null);
reqVO.setVideoLink(null);
reqVO.setContent(null);
reqVO.setDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setStartTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setEndTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setStatus(null);
reqVO.setRemarks(null);
reqVO.setIspublic(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
// 调用
PageResult<RcglDO> pageResult = rcglService.getRcglPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbRcgl, pageResult.getList().get(0));
}
}

View File

@ -6,3 +6,4 @@ DELETE FROM "oa-bgyp";
DELETE FROM "oa_jbgl"; DELETE FROM "oa_jbgl";
DELETE FROM "oa_hygl"; DELETE FROM "oa_hygl";
DELETE FROM "oa_hysgl"; DELETE FROM "oa_hysgl";
DELETE FROM "oa_rcgl";

View File

@ -186,3 +186,23 @@ CREATE TABLE IF NOT EXISTS "oa_hysgl" (
"tenant_id" bigint NOT NULL, "tenant_id" bigint NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")
) COMMENT '会议室管理表'; ) COMMENT '会议室管理表';
CREATE TABLE IF NOT EXISTS "oa_rcgl" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"title" varchar NOT NULL,
"location" varchar,
"video_link" varchar,
"content" varchar,
"date" varchar NOT NULL,
"start_time" varchar NOT NULL,
"end_time" varchar NOT NULL,
"status" int NOT NULL,
"remarks" varchar,
"ispublic" int,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '领导日程安排表';