Merge remote-tracking branch 'origin/main'

new
commit f359d6b3c5

@ -0,0 +1,303 @@
/*
Navicat MySQL Data Transfer
Source Server : mysql5.7
Source Server Type : MySQL
Source Server Version : 50724
Source Host : localhost:3307
Source Schema : lyr-one
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
Date: 10/10/2023 09:43:15
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for electronic_consultation
-- ----------------------------
DROP TABLE IF EXISTS `electronic_consultation`;
CREATE TABLE `electronic_consultation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '\r\n',
`create_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '\r\n',
`company_id` bigint(20) NULL DEFAULT NULL COMMENT 'id\r\n',
`company` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '\r\n',
`system_dept_id` bigint(20) NULL DEFAULT NULL COMMENT 'id\r\n',
`system_dept` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultation_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultation_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultation_title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultation_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultor_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultor_phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultor_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`consultation_time` datetime(0) NULL DEFAULT NULL COMMENT '\r\n',
`handler` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`handle_time` datetime(0) NULL DEFAULT NULL COMMENT '\r\n',
`handle_result` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`borrow_status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`record_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '\r\n',
`cherks` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '\r\n',
`record_id` bigint(20) NULL DEFAULT NULL COMMENT 'id\r\n',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
`updater` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`file_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for electronic_customer_complaint
-- ----------------------------
DROP TABLE IF EXISTS `electronic_customer_complaint`;
CREATE TABLE `electronic_customer_complaint` (
`id` bigint(255) NOT NULL AUTO_INCREMENT COMMENT '',
`create_by` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' ',
`creator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`company_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`company` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`dept_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`dept_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`complaint_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`customer_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`customer_phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`customer_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`complaint_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`complaint_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`complaint_content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`handler` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`handle_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`handle_result` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`borrow_status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`record_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`position` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`cherks` int(10) NULL DEFAULT NULL COMMENT '',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
`updater` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`record_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`file_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for electronic_other
-- ----------------------------
DROP TABLE IF EXISTS `electronic_other`;
CREATE TABLE `electronic_other` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '',
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`flow_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'OA/ERP\r\n',
`source` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`year` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`period` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`business_type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`updater` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`create_by` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`creator` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`company_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`company` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`del_status` varbinary(2) NULL DEFAULT NULL COMMENT '',
`suffix` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`file_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`file_ap` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`flow_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`note` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`dept_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`dept_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`record_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT 'id',
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
`archive_state` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'', '', 2, 0, 2382,
'electronic-other', '', 'ea/electronicOther/index', 0, 'ElectronicOther'
);
-- ID
-- MySQL OraclePostgreSQLSQLServer @parentId
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-other:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-other:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-other:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-other:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-other:export', 3, 5, @parentId,
'', '', '', 0
);
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'', '', 2, 0, 2382,
'electronic-customer-complaint', '', 'ea/electronicCustomerComplaint/index', 0, 'ElectronicCustomerComplaint'
);
-- ID
-- MySQL OraclePostgreSQLSQLServer @parentId
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-customer-complaint:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-customer-complaint:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-customer-complaint:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-customer-complaint:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-customer-complaint:export', 3, 5, @parentId,
'', '', '', 0
);
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'', '', 2, 0, 2382,
'electronic-consultation', '', 'ea/electronicConsultation/index', 0, 'ElectronicConsultation'
);
-- ID
-- MySQL OraclePostgreSQLSQLServer @parentId
SELECT @parentId := LAST_INSERT_ID();
-- SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-consultation:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-consultation:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-consultation:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-consultation:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'', 'ea:electronic-consultation:export', 3, 5, @parentId,
'', '', '', 0
);
SET FOREIGN_KEY_CHECKS = 1;

@ -1,263 +0,0 @@
package cn.iocoder.yudao.module.accounting.service.attachment;
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.accounting.controller.admin.attachment.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.attachment.AttachmentDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.attachment.AttachmentMapper;
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.accounting.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 AttachmentServiceImpl}
*
* @author
*/
@Import(AttachmentServiceImpl.class)
public class AttachmentServiceImplTest extends BaseDbUnitTest {
@Resource
private AttachmentServiceImpl attachmentService;
@Resource
private AttachmentMapper attachmentMapper;
@Test
public void testCreateAttachment_success() {
// 准备参数
AttachmentCreateReqVO reqVO = randomPojo(AttachmentCreateReqVO.class);
// 调用
Long attachmentId = attachmentService.createAttachment(reqVO);
// 断言
assertNotNull(attachmentId);
// 校验记录的属性是否正确
AttachmentDO attachment = attachmentMapper.selectById(attachmentId);
assertPojoEquals(reqVO, attachment);
}
@Test
public void testUpdateAttachment_success() {
// mock 数据
AttachmentDO dbAttachment = randomPojo(AttachmentDO.class);
attachmentMapper.insert(dbAttachment);// @Sql: 先插入出一条存在的数据
// 准备参数
AttachmentUpdateReqVO reqVO = randomPojo(AttachmentUpdateReqVO.class, o -> {
o.setId(dbAttachment.getId()); // 设置更新的 ID
});
// 调用
attachmentService.updateAttachment(reqVO);
// 校验是否更新正确
AttachmentDO attachment = attachmentMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, attachment);
}
@Test
public void testUpdateAttachment_notExists() {
// 准备参数
AttachmentUpdateReqVO reqVO = randomPojo(AttachmentUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> attachmentService.updateAttachment(reqVO), ATTACHMENT_NOT_EXISTS);
}
@Test
public void testDeleteAttachment_success() {
// mock 数据
AttachmentDO dbAttachment = randomPojo(AttachmentDO.class);
attachmentMapper.insert(dbAttachment);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbAttachment.getId();
// 调用
attachmentService.deleteAttachment(id);
// 校验数据不存在了
assertNull(attachmentMapper.selectById(id));
}
@Test
public void testDeleteAttachment_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> attachmentService.deleteAttachment(id), ATTACHMENT_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetAttachmentPage() {
// mock 数据
AttachmentDO dbAttachment = randomPojo(AttachmentDO.class, o -> { // 等会查询到
o.setVoucherId(null);
o.setVoucherNum(null);
o.setCreateTime(null);
o.setCreateBy(null);
o.setCompanyId(null);
o.setCompany(null);
o.setSuffix(null);
o.setFileUrl(null);
o.setFileAp(null);
o.setFlowId(null);
o.setUserId(null);
o.setRemark(null);
o.setFlowCode(null);
o.setFileName(null);
o.setFileSize(null);
});
attachmentMapper.insert(dbAttachment);
// 测试 voucherId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherId(null)));
// 测试 voucherNum 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherNum(null)));
// 测试 createTime 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateBy(null)));
// 测试 companyId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompanyId(null)));
// 测试 company 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompany(null)));
// 测试 suffix 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setSuffix(null)));
// 测试 fileUrl 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileUrl(null)));
// 测试 fileAp 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileAp(null)));
// 测试 flowId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowId(null)));
// 测试 userId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setUserId(null)));
// 测试 remark 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setRemark(null)));
// 测试 flowCode 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowCode(null)));
// 测试 fileName 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileName(null)));
// 测试 fileSize 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileSize(null)));
// 准备参数
AttachmentPageReqVO reqVO = new AttachmentPageReqVO();
reqVO.setVoucherId(null);
reqVO.setVoucherNum(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setSuffix(null);
reqVO.setFileUrl(null);
reqVO.setFileAp(null);
reqVO.setFlowId(null);
reqVO.setUserId(null);
reqVO.setRemark(null);
reqVO.setFlowCode(null);
reqVO.setFileName(null);
reqVO.setFileSize(null);
// 调用
PageResult<AttachmentDO> pageResult = attachmentService.getAttachmentPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbAttachment, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetAttachmentList() {
// mock 数据
AttachmentDO dbAttachment = randomPojo(AttachmentDO.class, o -> { // 等会查询到
o.setVoucherId(null);
o.setVoucherNum(null);
o.setCreateTime(null);
o.setCreateBy(null);
o.setCompanyId(null);
o.setCompany(null);
o.setSuffix(null);
o.setFileUrl(null);
o.setFileAp(null);
o.setFlowId(null);
o.setUserId(null);
o.setRemark(null);
o.setFlowCode(null);
o.setFileName(null);
o.setFileSize(null);
});
attachmentMapper.insert(dbAttachment);
// 测试 voucherId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherId(null)));
// 测试 voucherNum 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setVoucherNum(null)));
// 测试 createTime 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCreateBy(null)));
// 测试 companyId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompanyId(null)));
// 测试 company 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setCompany(null)));
// 测试 suffix 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setSuffix(null)));
// 测试 fileUrl 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileUrl(null)));
// 测试 fileAp 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileAp(null)));
// 测试 flowId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowId(null)));
// 测试 userId 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setUserId(null)));
// 测试 remark 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setRemark(null)));
// 测试 flowCode 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFlowCode(null)));
// 测试 fileName 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileName(null)));
// 测试 fileSize 不匹配
attachmentMapper.insert(cloneIgnoreId(dbAttachment, o -> o.setFileSize(null)));
// 准备参数
AttachmentExportReqVO reqVO = new AttachmentExportReqVO();
reqVO.setVoucherId(null);
reqVO.setVoucherNum(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setSuffix(null);
reqVO.setFileUrl(null);
reqVO.setFileAp(null);
reqVO.setFlowId(null);
reqVO.setUserId(null);
reqVO.setRemark(null);
reqVO.setFlowCode(null);
reqVO.setFileName(null);
reqVO.setFileSize(null);
// 调用
List<AttachmentDO> list = attachmentService.getAttachmentList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbAttachment, list.get(0));
}
}

@ -1,311 +0,0 @@
package cn.iocoder.yudao.module.accounting.service.other;
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.accounting.controller.admin.other.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper;
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.accounting.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 OtherServiceImpl}
*
* @author
*/
@Import(OtherServiceImpl.class)
public class OtherServiceImplTest extends BaseDbUnitTest {
@Resource
private OtherServiceImpl otherService;
@Resource
private OtherMapper otherMapper;
@Test
public void testCreateOther_success() {
// 准备参数
OtherCreateReqVO reqVO = randomPojo(OtherCreateReqVO.class);
// 调用
Long otherId = otherService.createOther(reqVO);
// 断言
assertNotNull(otherId);
// 校验记录的属性是否正确
OtherDO other = otherMapper.selectById(otherId);
assertPojoEquals(reqVO, other);
}
@Test
public void testUpdateOther_success() {
// mock 数据
OtherDO dbOther = randomPojo(OtherDO.class);
otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据
// 准备参数
OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class, o -> {
o.setId(dbOther.getId()); // 设置更新的 ID
});
// 调用
otherService.updateOther(reqVO);
// 校验是否更新正确
OtherDO other = otherMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, other);
}
@Test
public void testUpdateOther_notExists() {
// 准备参数
OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> otherService.updateOther(reqVO), OTHER_NOT_EXISTS);
}
@Test
public void testDeleteOther_success() {
// mock 数据
OtherDO dbOther = randomPojo(OtherDO.class);
otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbOther.getId();
// 调用
otherService.deleteOther(id);
// 校验数据不存在了
assertNull(otherMapper.selectById(id));
}
@Test
public void testDeleteOther_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> otherService.deleteOther(id), OTHER_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetOtherPage() {
// mock 数据
OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到
o.setName(null);
o.setFlowCode(null);
o.setSource(null);
o.setYear(null);
o.setPeriod(null);
o.setBusinessType(null);
o.setCreateTime(null);
o.setCreateBy(null);
o.setCompanyId(null);
o.setCompany(null);
o.setSuffix(null);
o.setFileUrl(null);
o.setFileAp(null);
o.setFlowId(null);
o.setNote(null);
o.setDeptId(null);
o.setDeptName(null);
o.setRecordId(null);
o.setUserId(null);
o.setArchiveState(null);
o.setRemark(null);
});
otherMapper.insert(dbOther);
// 测试 name 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null)));
// 测试 flowCode 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null)));
// 测试 source 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null)));
// 测试 year 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null)));
// 测试 period 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null)));
// 测试 businessType 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null)));
// 测试 createTime 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null)));
// 测试 companyId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null)));
// 测试 company 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null)));
// 测试 suffix 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null)));
// 测试 fileUrl 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null)));
// 测试 fileAp 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null)));
// 测试 flowId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null)));
// 测试 note 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null)));
// 测试 deptId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null)));
// 测试 deptName 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null)));
// 测试 recordId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null)));
// 测试 userId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null)));
// 测试 archiveState 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null)));
// 测试 remark 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null)));
// 准备参数
OtherPageReqVO reqVO = new OtherPageReqVO();
reqVO.setName(null);
reqVO.setFlowCode(null);
reqVO.setSource(null);
reqVO.setYear(null);
reqVO.setPeriod(null);
reqVO.setBusinessType(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setSuffix(null);
reqVO.setFileUrl(null);
reqVO.setFileAp(null);
reqVO.setFlowId(null);
reqVO.setNote(null);
reqVO.setDeptId(null);
reqVO.setDeptName(null);
reqVO.setRecordId(null);
reqVO.setUserId(null);
reqVO.setArchiveState(null);
reqVO.setRemark(null);
// 调用
PageResult<OtherDO> pageResult = otherService.getOtherPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbOther, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetOtherList() {
// mock 数据
OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到
o.setName(null);
o.setFlowCode(null);
o.setSource(null);
o.setYear(null);
o.setPeriod(null);
o.setBusinessType(null);
o.setCreateTime(null);
o.setCreateBy(null);
o.setCompanyId(null);
o.setCompany(null);
o.setSuffix(null);
o.setFileUrl(null);
o.setFileAp(null);
o.setFlowId(null);
o.setNote(null);
o.setDeptId(null);
o.setDeptName(null);
o.setRecordId(null);
o.setUserId(null);
o.setArchiveState(null);
o.setRemark(null);
});
otherMapper.insert(dbOther);
// 测试 name 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null)));
// 测试 flowCode 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null)));
// 测试 source 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null)));
// 测试 year 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null)));
// 测试 period 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null)));
// 测试 businessType 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null)));
// 测试 createTime 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null)));
// 测试 companyId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null)));
// 测试 company 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null)));
// 测试 suffix 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null)));
// 测试 fileUrl 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null)));
// 测试 fileAp 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null)));
// 测试 flowId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null)));
// 测试 note 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null)));
// 测试 deptId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null)));
// 测试 deptName 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null)));
// 测试 recordId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null)));
// 测试 userId 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null)));
// 测试 archiveState 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null)));
// 测试 remark 不匹配
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null)));
// 准备参数
OtherExportReqVO reqVO = new OtherExportReqVO();
reqVO.setName(null);
reqVO.setFlowCode(null);
reqVO.setSource(null);
reqVO.setYear(null);
reqVO.setPeriod(null);
reqVO.setBusinessType(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
reqVO.setCompanyId(null);
reqVO.setCompany(null);
reqVO.setSuffix(null);
reqVO.setFileUrl(null);
reqVO.setFileAp(null);
reqVO.setFlowId(null);
reqVO.setNote(null);
reqVO.setDeptId(null);
reqVO.setDeptName(null);
reqVO.setRecordId(null);
reqVO.setUserId(null);
reqVO.setArchiveState(null);
reqVO.setRemark(null);
// 调用
List<OtherDO> list = otherService.getOtherList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbOther, list.get(0));
}
}

@ -11,4 +11,5 @@ public interface ErrorCodeConstants {
ErrorCode ELECTRONIC_EMPLOYEE_NOT_EXISTS = new ErrorCode(300012, "员工档案不存在"); ErrorCode ELECTRONIC_EMPLOYEE_NOT_EXISTS = new ErrorCode(300012, "员工档案不存在");
ErrorCode ELECTRONIC_CONSULTATION_NOT_EXISTS = new ErrorCode(300013, "咨询档案不存在"); ErrorCode ELECTRONIC_CONSULTATION_NOT_EXISTS = new ErrorCode(300013, "咨询档案不存在");
ErrorCode ELECTRONIC_CUSTOMER_COMPLAINT_NOT_EXISTS = new ErrorCode(300014, "客诉档案不存在"); ErrorCode ELECTRONIC_CUSTOMER_COMPLAINT_NOT_EXISTS = new ErrorCode(300014, "客诉档案不存在");
ErrorCode ELECTRONIC_OTHER_NOT_EXISTS = new ErrorCode(300015, "其他档案不存在");
} }

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother;
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.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO;
import cn.iocoder.yudao.module.ea.convert.electronicother.ElectronicOtherConvert;
import cn.iocoder.yudao.module.ea.service.electronicother.ElectronicOtherService;
@Tag(name = "管理后台 - 其他档案")
@RestController
@RequestMapping("/ea/electronic-other")
@Validated
public class ElectronicOtherController {
@Resource
private ElectronicOtherService electronicOtherService;
@PostMapping("/create")
@Operation(summary = "创建其他档案")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:create')")
public CommonResult<Long> createElectronicOther(@Valid @RequestBody ElectronicOtherCreateReqVO createReqVO) {
return success(electronicOtherService.createElectronicOther(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新其他档案")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:update')")
public CommonResult<Boolean> updateElectronicOther(@Valid @RequestBody ElectronicOtherUpdateReqVO updateReqVO) {
electronicOtherService.updateElectronicOther(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除其他档案")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('ea:electronic-other:delete')")
public CommonResult<Boolean> deleteElectronicOther(@RequestParam("id") Long id) {
electronicOtherService.deleteElectronicOther(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得其他档案")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:query')")
public CommonResult<ElectronicOtherRespVO> getElectronicOther(@RequestParam("id") Long id) {
ElectronicOtherDO electronicOther = electronicOtherService.getElectronicOther(id);
return success(ElectronicOtherConvert.INSTANCE.convert(electronicOther));
}
@GetMapping("/list")
@Operation(summary = "获得其他档案列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:query')")
public CommonResult<List<ElectronicOtherRespVO>> getElectronicOtherList(@RequestParam("ids") Collection<Long> ids) {
List<ElectronicOtherDO> list = electronicOtherService.getElectronicOtherList(ids);
return success(ElectronicOtherConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得其他档案分页")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:query')")
public CommonResult<PageResult<ElectronicOtherRespVO>> getElectronicOtherPage(@Valid ElectronicOtherPageReqVO pageVO) {
PageResult<ElectronicOtherDO> pageResult = electronicOtherService.getElectronicOtherPage(pageVO);
return success(ElectronicOtherConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出其他档案 Excel")
@PreAuthorize("@ss.hasPermission('ea:electronic-other:export')")
@OperateLog(type = EXPORT)
public void exportElectronicOtherExcel(@Valid ElectronicOtherExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<ElectronicOtherDO> list = electronicOtherService.getElectronicOtherList(exportReqVO);
// 导出 Excel
List<ElectronicOtherExcelVO> datas = ElectronicOtherConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "其他档案.xls", "数据", ElectronicOtherExcelVO.class, datas);
}
}

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class ElectronicOtherBaseVO {
@Schema(description = "表名", example = "李四")
private String name;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "业务实体")
private String company;
@Schema(description = "删除状态", example = "2")
private byte[] delStatus;
@Schema(description = "文件后缀")
private String suffix;
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
private String fileUrl;
@Schema(description = "绝对路径")
private String fileAp;
@Schema(description = "摘要")
private String note;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "归档状态")
private String archiveState;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 其他档案创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ElectronicOtherCreateReqVO extends ElectronicOtherBaseVO {
}

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class ElectronicOtherExcelVO {
@ExcelProperty("主键")
private Long id;
@ExcelProperty("表名")
private String name;
@ExcelProperty("文件来源")
private String source;
@ExcelProperty("年度")
private String year;
@ExcelProperty("月份")
private String period;
@ExcelProperty("业务类型")
private String businessType;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("制单人")
private String createBy;
@ExcelProperty("业务实体")
private String company;
@ExcelProperty("删除状态")
private byte[] delStatus;
@ExcelProperty("文件后缀")
private String suffix;
@ExcelProperty("文件地址")
private String fileUrl;
@ExcelProperty("绝对路径")
private String fileAp;
@ExcelProperty("摘要")
private String note;
@ExcelProperty("所属部门")
private String deptName;
@ExcelProperty("归档状态")
private String archiveState;
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 其他档案 Excel 导出 Request VO参数和 ElectronicOtherPageReqVO 是一致的")
@Data
public class ElectronicOtherExportReqVO {
@Schema(description = "表名", example = "李四")
private String name;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "业务实体")
private String company;
@Schema(description = "删除状态", example = "2")
private byte[] delStatus;
@Schema(description = "文件后缀")
private String suffix;
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
private String fileUrl;
@Schema(description = "绝对路径")
private String fileAp;
@Schema(description = "摘要")
private String note;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "归档状态")
private String archiveState;
}

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.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 ElectronicOtherPageReqVO extends PageParam {
@Schema(description = "表名", example = "李四")
private String name;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
@Schema(description = "业务实体")
private String company;
@Schema(description = "删除状态", example = "2")
private byte[] delStatus;
@Schema(description = "文件后缀")
private String suffix;
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
private String fileUrl;
@Schema(description = "绝对路径")
private String fileAp;
@Schema(description = "摘要")
private String note;
@Schema(description = "所属部门", example = "张三")
private String deptName;
@Schema(description = "归档状态")
private String archiveState;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 其他档案 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ElectronicOtherRespVO extends ElectronicOtherBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29291")
private Long id;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 其他档案更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ElectronicOtherUpdateReqVO extends ElectronicOtherBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29291")
@NotNull(message = "主键不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.ea.convert.electronicother;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface ElectronicOtherConvert {
ElectronicOtherConvert INSTANCE = Mappers.getMapper(ElectronicOtherConvert.class);
ElectronicOtherDO convert(ElectronicOtherCreateReqVO bean);
ElectronicOtherDO convert(ElectronicOtherUpdateReqVO bean);
ElectronicOtherRespVO convert(ElectronicOtherDO bean);
List<ElectronicOtherRespVO> convertList(List<ElectronicOtherDO> list);
PageResult<ElectronicOtherRespVO> convertPage(PageResult<ElectronicOtherDO> page);
List<ElectronicOtherExcelVO> convertList02(List<ElectronicOtherDO> list);
}

@ -0,0 +1,111 @@
package cn.iocoder.yudao.module.ea.dal.dataobject.electronicother;
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("electronic_other")
@KeySequence("electronic_other_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ElectronicOtherDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String name;
/**
* OA/ERP
*/
private String flowCode;
/**
*
*/
private String source;
/**
*
*/
private String year;
/**
*
*/
private String period;
/**
*
*/
private String businessType;
/**
*
*/
private String createBy;
/**
* id
*/
private Long companyId;
/**
*
*/
private String company;
/**
*
*/
private byte[] delStatus;
/**
*
*/
private String suffix;
/**
*
*/
private String fileUrl;
/**
*
*/
private String fileAp;
/**
*
*/
private String flowId;
/**
*
*/
private String note;
/**
* id
*/
private Long deptId;
/**
*
*/
private String deptName;
/**
* id
*/
private Long recordId;
/**
* id
*/
private Long userId;
/**
*
*/
private String archiveState;
}

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.ea.dal.mysql.electronicother;
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.ea.dal.dataobject.electronicother.ElectronicOtherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface ElectronicOtherMapper extends BaseMapperX<ElectronicOtherDO> {
default PageResult<ElectronicOtherDO> selectPage(ElectronicOtherPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicOtherDO>()
.likeIfPresent(ElectronicOtherDO::getName, reqVO.getName())
.eqIfPresent(ElectronicOtherDO::getSource, reqVO.getSource())
.eqIfPresent(ElectronicOtherDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicOtherDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicOtherDO::getBusinessType, reqVO.getBusinessType())
.betweenIfPresent(ElectronicOtherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicOtherDO::getCreateBy, reqVO.getCreateBy())
.eqIfPresent(ElectronicOtherDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicOtherDO::getDelStatus, reqVO.getDelStatus())
.eqIfPresent(ElectronicOtherDO::getSuffix, reqVO.getSuffix())
.eqIfPresent(ElectronicOtherDO::getFileUrl, reqVO.getFileUrl())
.eqIfPresent(ElectronicOtherDO::getFileAp, reqVO.getFileAp())
.eqIfPresent(ElectronicOtherDO::getNote, reqVO.getNote())
.likeIfPresent(ElectronicOtherDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicOtherDO::getArchiveState, reqVO.getArchiveState())
.orderByDesc(ElectronicOtherDO::getId));
}
default List<ElectronicOtherDO> selectList(ElectronicOtherExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ElectronicOtherDO>()
.likeIfPresent(ElectronicOtherDO::getName, reqVO.getName())
.eqIfPresent(ElectronicOtherDO::getSource, reqVO.getSource())
.eqIfPresent(ElectronicOtherDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicOtherDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicOtherDO::getBusinessType, reqVO.getBusinessType())
.betweenIfPresent(ElectronicOtherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicOtherDO::getCreateBy, reqVO.getCreateBy())
.eqIfPresent(ElectronicOtherDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicOtherDO::getDelStatus, reqVO.getDelStatus())
.eqIfPresent(ElectronicOtherDO::getSuffix, reqVO.getSuffix())
.eqIfPresent(ElectronicOtherDO::getFileUrl, reqVO.getFileUrl())
.eqIfPresent(ElectronicOtherDO::getFileAp, reqVO.getFileAp())
.eqIfPresent(ElectronicOtherDO::getNote, reqVO.getNote())
.likeIfPresent(ElectronicOtherDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicOtherDO::getArchiveState, reqVO.getArchiveState())
.orderByDesc(ElectronicOtherDO::getId));
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.ea.service.electronicother;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface ElectronicOtherService {
/**
*
*
* @param createReqVO
* @return
*/
Long createElectronicOther(@Valid ElectronicOtherCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateElectronicOther(@Valid ElectronicOtherUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteElectronicOther(Long id);
/**
*
*
* @param id
* @return
*/
ElectronicOtherDO getElectronicOther(Long id);
/**
*
*
* @param ids
* @return
*/
List<ElectronicOtherDO> getElectronicOtherList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ElectronicOtherDO> getElectronicOtherPage(ElectronicOtherPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<ElectronicOtherDO> getElectronicOtherList(ElectronicOtherExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.ea.service.electronicother;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicother.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicother.ElectronicOtherDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ea.convert.electronicother.ElectronicOtherConvert;
import cn.iocoder.yudao.module.ea.dal.mysql.electronicother.ElectronicOtherMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.ea.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class ElectronicOtherServiceImpl implements ElectronicOtherService {
@Resource
private ElectronicOtherMapper electronicOtherMapper;
@Override
public Long createElectronicOther(ElectronicOtherCreateReqVO createReqVO) {
// 插入
ElectronicOtherDO electronicOther = ElectronicOtherConvert.INSTANCE.convert(createReqVO);
electronicOtherMapper.insert(electronicOther);
// 返回
return electronicOther.getId();
}
@Override
public void updateElectronicOther(ElectronicOtherUpdateReqVO updateReqVO) {
// 校验存在
validateElectronicOtherExists(updateReqVO.getId());
// 更新
ElectronicOtherDO updateObj = ElectronicOtherConvert.INSTANCE.convert(updateReqVO);
electronicOtherMapper.updateById(updateObj);
}
@Override
public void deleteElectronicOther(Long id) {
// 校验存在
validateElectronicOtherExists(id);
// 删除
electronicOtherMapper.deleteById(id);
}
private void validateElectronicOtherExists(Long id) {
if (electronicOtherMapper.selectById(id) == null) {
throw exception(ELECTRONIC_OTHER_NOT_EXISTS);
}
}
@Override
public ElectronicOtherDO getElectronicOther(Long id) {
return electronicOtherMapper.selectById(id);
}
@Override
public List<ElectronicOtherDO> getElectronicOtherList(Collection<Long> ids) {
return electronicOtherMapper.selectBatchIds(ids);
}
@Override
public PageResult<ElectronicOtherDO> getElectronicOtherPage(ElectronicOtherPageReqVO pageReqVO) {
return electronicOtherMapper.selectPage(pageReqVO);
}
@Override
public List<ElectronicOtherDO> getElectronicOtherList(ElectronicOtherExportReqVO exportReqVO) {
return electronicOtherMapper.selectList(exportReqVO);
}
}

@ -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.ea.dal.mysql.electroniccustomercomplaint.ElectronicCustomerComplaintMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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.ea.dal.mysql.electronicother.ElectronicOtherMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -1,231 +0,0 @@
package cn.iocoder.yudao.module.setting.service.detection;
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.setting.controller.admin.detection.vo.*;
import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO;
import cn.iocoder.yudao.module.setting.dal.mysql.detection.DetectionMapper;
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.setting.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 DetectionServiceImpl}
*
* @author devin1
*/
@Import(DetectionServiceImpl.class)
public class DetectionServiceImplTest extends BaseDbUnitTest {
@Resource
private DetectionServiceImpl detectionService;
@Resource
private DetectionMapper detectionMapper;
@Test
public void testCreateDetection_success() {
// 准备参数
DetectionCreateReqVO reqVO = randomPojo(DetectionCreateReqVO.class);
// 调用
Long detectionId = detectionService.createDetection(reqVO);
// 断言
assertNotNull(detectionId);
// 校验记录的属性是否正确
DetectionDO detection = detectionMapper.selectById(detectionId);
assertPojoEquals(reqVO, detection);
}
@Test
public void testUpdateDetection_success() {
// mock 数据
DetectionDO dbDetection = randomPojo(DetectionDO.class);
detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据
// 准备参数
DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class, o -> {
o.setId(dbDetection.getId()); // 设置更新的 ID
});
// 调用
detectionService.updateDetection(reqVO);
// 校验是否更新正确
DetectionDO detection = detectionMapper.selectById(reqVO.getId()); // 获取最新的
assertPojoEquals(reqVO, detection);
}
@Test
public void testUpdateDetection_notExists() {
// 准备参数
DetectionUpdateReqVO reqVO = randomPojo(DetectionUpdateReqVO.class);
// 调用, 并断言异常
assertServiceException(() -> detectionService.updateDetection(reqVO), DETECTION_NOT_EXISTS);
}
@Test
public void testDeleteDetection_success() {
// mock 数据
DetectionDO dbDetection = randomPojo(DetectionDO.class);
detectionMapper.insert(dbDetection);// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = dbDetection.getId();
// 调用
detectionService.deleteDetection(id);
// 校验数据不存在了
assertNull(detectionMapper.selectById(id));
}
@Test
public void testDeleteDetection_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> detectionService.deleteDetection(id), DETECTION_NOT_EXISTS);
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetDetectionPage() {
// mock 数据
DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到
o.setOneType(null);
o.setTwoType(null);
o.setCode(null);
o.setName(null);
o.setPurpose(null);
o.setObjects(null);
o.setMethods(null);
o.setEnableFlag(null);
o.setRemark(null);
o.setCreateTime(null);
o.setCreateBy(null);
});
detectionMapper.insert(dbDetection);
// 测试 oneType 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null)));
// 测试 twoType 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null)));
// 测试 code 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null)));
// 测试 name 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null)));
// 测试 purpose 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null)));
// 测试 objects 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null)));
// 测试 methods 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null)));
// 测试 enableFlag 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null)));
// 测试 remark 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null)));
// 测试 createTime 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null)));
// 准备参数
DetectionPageReqVO reqVO = new DetectionPageReqVO();
reqVO.setOneType(null);
reqVO.setTwoType(null);
reqVO.setCode(null);
reqVO.setName(null);
reqVO.setPurpose(null);
reqVO.setObjects(null);
reqVO.setMethods(null);
reqVO.setEnableFlag(null);
reqVO.setRemark(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
// 调用
PageResult<DetectionDO> pageResult = detectionService.getDetectionPage(reqVO);
// 断言
assertEquals(1, pageResult.getTotal());
assertEquals(1, pageResult.getList().size());
assertPojoEquals(dbDetection, pageResult.getList().get(0));
}
@Test
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
public void testGetDetectionList() {
// mock 数据
DetectionDO dbDetection = randomPojo(DetectionDO.class, o -> { // 等会查询到
o.setOneType(null);
o.setTwoType(null);
o.setCode(null);
o.setName(null);
o.setPurpose(null);
o.setObjects(null);
o.setMethods(null);
o.setEnableFlag(null);
o.setRemark(null);
o.setCreateTime(null);
o.setCreateBy(null);
});
detectionMapper.insert(dbDetection);
// 测试 oneType 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setOneType(null)));
// 测试 twoType 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setTwoType(null)));
// 测试 code 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCode(null)));
// 测试 name 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setName(null)));
// 测试 purpose 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setPurpose(null)));
// 测试 objects 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setObjects(null)));
// 测试 methods 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setMethods(null)));
// 测试 enableFlag 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setEnableFlag(null)));
// 测试 remark 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setRemark(null)));
// 测试 createTime 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateTime(null)));
// 测试 createBy 不匹配
detectionMapper.insert(cloneIgnoreId(dbDetection, o -> o.setCreateBy(null)));
// 准备参数
DetectionExportReqVO reqVO = new DetectionExportReqVO();
reqVO.setOneType(null);
reqVO.setTwoType(null);
reqVO.setCode(null);
reqVO.setName(null);
reqVO.setPurpose(null);
reqVO.setObjects(null);
reqVO.setMethods(null);
reqVO.setEnableFlag(null);
reqVO.setRemark(null);
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
reqVO.setCreateBy(null);
// 调用
List<DetectionDO> list = detectionService.getDetectionList(reqVO);
// 断言
assertEquals(1, list.size());
assertPojoEquals(dbDetection, list.get(0));
}
}
Loading…
Cancel
Save