四性检测

new
JilingLee 1 year ago
parent 2761659f71
commit 209c441a3e

@ -0,0 +1,86 @@
-- ----------------------------
-- structure for setting_detection
-- ----------------------------
DROP TABLE IF EXISTS `setting_detection`;
CREATE TABLE `setting_detection` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`one_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`two_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`purpose` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`objects` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`methods` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`enable_flag` bit(1) NULL DEFAULT NULL COMMENT '0-1-',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1',
`attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '2',
`attr3` int(11) NULL DEFAULT NULL COMMENT '3',
`attr4` int(11) NULL DEFAULT NULL COMMENT '4',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`updater` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_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 utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`company_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 '0-1-',
`company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`tenant_id` bigint(20) NOT NULL COMMENT '/',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of setting_detection
-- ----------------------------
INSERT INTO `setting_detection` VALUES (1, '', '', 'GD-1-1', '', '', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (2, '', '', 'GD-1-10', '', '', '', '()', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (3, '', '', 'GD-1-11', '', '', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (4, '', '', 'GD-1-12', '', '', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (5, '', '', 'GD-1-13', '', '', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (6, '', '', 'GD-1-14', '', '', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (7, '', '', 'GD-1-2', '', '', '', 'DA/T 46-2009: a) ; b) ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (8, '', '', 'GD-1-3', '', '', '', 'DA/T 46-2009: a) ; b) ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (9, '', '', 'GD-1-4', '', '', '', 'DA/T 46-2009: a) ; b) ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (10, '', '', 'GD-1-5', ' ', ' ', '', 'DA/T 18-1999DA/T 46-2009 :\na) ;\nb) ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (11, '', '', 'GD-1-6', ' ', '', '', 'GB 18030-2005 :\na) ;\nb) ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (12, '', '', 'GD-1-7', '', ' / ', '/', 'DA/T 13-1994/ :\na) /;\nb) /', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (13, '', '', 'GD-1-8', ' ', ' ', ' ', '(:)\n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (14, '', '', 'GD-2-1', '', ' ', '', 'GB/T 18894-2016A.1 ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (15, '', '', 'GD-2-11', ' ', ' ', '', '\n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (16, '', '', 'GD-2-2', '', ' ', '', 'GB/T 18894-2016A.1 ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (17, '', '', 'GD-2-3', '', '', '', 'DA/T 46-2009 ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (18, '', '', 'GD-2-4', '', '', '', 'DA/T46-2009 ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (19, '', '', 'GD-2-5', '', '', '', ' ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (20, '', '', 'GD-2-6', '', ' ', ' ', 'DA/T 22-2015 () ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (21, '', '', 'GD-2-7', '', ' ', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (22, '', '', 'GD-2-8', '', ' ', ' ', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (23, '', '', 'GD-2-9', '', '', '', ' \n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (24, '', '', 'GD-3-1', ' ', '', '', 'XML \n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (25, '', '', 'GD-3-2', ' 访', ' 访', '', '访\n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (26, '', '', 'GD-3-3', '', ' ', '', ' \nGB/T 18894-2016GB/T 33190-2016 ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (27, '', '', 'GD-3-4', '', ' ', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (28, '', '', 'GD-3-6', ' ', ' ', ' ', '\n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-01 00:00:00', 'Create_by', 'Updater', '2022-01-01 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (29, '', '', 'GD-3-8', ' ', ' ', ' ', '\n ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-02 00:00:00', 'Create_by', 'Updater', '2022-01-02 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (30, '', '', 'GD-4-1', '', ' ', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-03 00:00:00', 'Create_by', 'Updater', '2022-01-03 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (31, '', '', 'GD-4-2', '', ' ', '', ' ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-04 00:00:00', 'Create_by', 'Updater', '2022-01-04 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (32, '', '', 'GD-4-3', ' ', ' ', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-05 00:00:00', 'Create_by', 'Updater', '2022-01-05 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (33, '', '', 'GD-4-4', ' ', ' ', '', ' ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-06 00:00:00', 'Create_by', 'Updater', '2022-01-06 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (34, '', '', 'GD-4-5', '', ' ', '', '', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-07 00:00:00', 'Create_by', 'Updater', '2022-01-07 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (35, '', '', 'GD-4-6', '', '', '', 'DA/T 38-2008PIEPOFBLER\n', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-08 00:00:00', 'Create_by', 'Updater', '2022-01-08 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
INSERT INTO `setting_detection` VALUES (36, '', '', 'GD-4-7', ' ', ' ', '', ' ', b'1', NULL, NULL, NULL, NULL, NULL, 'Creator', '2022-01-09 00:00:00', 'Create_by', 'Updater', '2022-01-09 00:00:00', NULL, NULL, NULL, NULL, b'0', NULL, 1);
SET FOREIGN_KEY_CHECKS = 1;
--
SELECT `id` INTO @menuId FROM system_menu WHERE name='';
INSERT INTO `lyr-one`.`system_menu`(`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('', '', 2, 0, @menuId, 'detection', '', 'setting/detection/index', 'Detection', 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');
SET @menuId2 = LAST_INSERT_ID();
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '', 'setting:detection:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '', 'setting:detection:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '', 'setting:detection:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '', 'setting:detection:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');
INSERT INTO `lyr-one`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, '', 'setting:detection:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 15:52:37', '', '2023-09-25 15:52:37', b'0');

@ -113,6 +113,13 @@ public class InvoicesController {
PageResult<InvoicesDO> pageResult = invoicesService.getInvoicesPage(pageVO);
return success(InvoicesConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/pageTime")
@Operation(summary = "获得发票分页")
@PreAuthorize("@ss.hasPermission('accounting:invoices:query')")
public CommonResult<PageResult<InvoicesRespVO>> getInvoicesPageTime(Long months) {
PageResult<InvoicesDO> pageResult = invoicesService.getInvoicesPageTime(months);
return success(InvoicesConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/downloadXml")
@Operation(summary = "获得发票分页Xml")
@ -229,7 +236,7 @@ public class InvoicesController {
ExcelUtils.write(response, "发票.xls", "数据", InvoicesExcelVO.class, new ArrayList<InvoicesExcelVO>());
}
@GetMapping("/inTemplate")
@PostMapping("/inTemplate")
@Operation(summary = "导入发票 Excel模板")
@PreAuthorize("@ss.hasPermission('accounting:invoices:export')")
@OperateLog(type = IMPORT)

@ -59,6 +59,14 @@ public interface InvoicesService {
*/
PageResult<InvoicesDO> getInvoicesPage(InvoicesPageReqVO pageReqVO);
/**
*
*
* @param months
* @return
*/
PageResult<InvoicesDO> getInvoicesPageTime(Long months);
/**
* , Excel
*

@ -1,9 +1,11 @@
package cn.iocoder.yudao.module.accounting.service.invoices;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*;
import cn.iocoder.yudao.module.accounting.controller.admin.invoices.vo.*;
import cn.iocoder.yudao.module.accounting.dal.dataobject.invoices.InvoicesDO;
@ -74,6 +76,18 @@ public class InvoicesServiceImpl implements InvoicesService {
return invoicesMapper.selectPage(pageReqVO);
}
@Override
public PageResult<InvoicesDO> getInvoicesPageTime(Long months) {
QueryWrapper<InvoicesDO> wrapper = new QueryWrapper<>();
wrapper.ge("invoice_date", LocalDateTime.now().minusMonths(months));
List<InvoicesDO> invoicesDOS = invoicesMapper.selectList(wrapper);
PageResult<InvoicesDO> pageResult = new PageResult<>();
pageResult.setList(invoicesDOS);
long size =(long) invoicesDOS.size();
pageResult.setTotal(size);
return pageResult;
}
@Override
public List<InvoicesDO> getInvoicesList(InvoicesExportReqVO exportReqVO) {
return invoicesMapper.selectList(exportReqVO);

@ -6,6 +6,7 @@ public interface ErrorCodeConstants {
ErrorCode DEPOT_CABINET_NOT_EXISTS = new ErrorCode(300100, "档案柜管理不存在");
ErrorCode DEPOT_NOT_EXISTS = new ErrorCode(400100, "库房管理不存在");
ErrorCode PASSWORDS_NOT_EXISTS = new ErrorCode(500100, "数据密码不存在");
ErrorCode DETECTION_NOT_EXISTS = new ErrorCode(600100, "四性检测维护不存在");
ErrorCode FILE_CATEGORY_NOT_EXISTS = new ErrorCode(400200, "档案分类不存在");

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection;
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.setting.controller.admin.detection.vo.*;
import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO;
import cn.iocoder.yudao.module.setting.convert.detection.DetectionConvert;
import cn.iocoder.yudao.module.setting.service.detection.DetectionService;
@Tag(name = "管理后台 - 四性检测维护")
@RestController
@RequestMapping("/setting/detection")
@Validated
public class DetectionController {
@Resource
private DetectionService detectionService;
@PostMapping("/create")
@Operation(summary = "创建四性检测维护")
@PreAuthorize("@ss.hasPermission('setting:detection:create')")
public CommonResult<Long> createDetection(@Valid @RequestBody DetectionCreateReqVO createReqVO) {
return success(detectionService.createDetection(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新四性检测维护")
@PreAuthorize("@ss.hasPermission('setting:detection:update')")
public CommonResult<Boolean> updateDetection(@Valid @RequestBody DetectionUpdateReqVO updateReqVO) {
detectionService.updateDetection(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除四性检测维护")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('setting:detection:delete')")
public CommonResult<Boolean> deleteDetection(@RequestParam("id") Long id) {
detectionService.deleteDetection(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得四性检测维护")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('setting:detection:query')")
public CommonResult<DetectionRespVO> getDetection(@RequestParam("id") Long id) {
DetectionDO detection = detectionService.getDetection(id);
return success(DetectionConvert.INSTANCE.convert(detection));
}
@GetMapping("/list")
@Operation(summary = "获得四性检测维护列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('setting:detection:query')")
public CommonResult<List<DetectionRespVO>> getDetectionList(@RequestParam("ids") Collection<Long> ids) {
List<DetectionDO> list = detectionService.getDetectionList(ids);
return success(DetectionConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得四性检测维护分页")
@PreAuthorize("@ss.hasPermission('setting:detection:query')")
public CommonResult<PageResult<DetectionRespVO>> getDetectionPage(@Valid DetectionPageReqVO pageVO) {
PageResult<DetectionDO> pageResult = detectionService.getDetectionPage(pageVO);
return success(DetectionConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出四性检测维护 Excel")
@PreAuthorize("@ss.hasPermission('setting:detection:export')")
@OperateLog(type = EXPORT)
public void exportDetectionExcel(@Valid DetectionExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<DetectionDO> list = detectionService.getDetectionList(exportReqVO);
// 导出 Excel
List<DetectionExcelVO> datas = DetectionConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "四性检测维护.xls", "数据", DetectionExcelVO.class, datas);
}
}

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 DetectionBaseVO {
@Schema(description = "一级分类", example = "1")
private String oneType;
@Schema(description = "二级分类", example = "2")
private String twoType;
@Schema(description = "检测编号")
private String code;
@Schema(description = "检测项目", example = "芋艿")
private String name;
@Schema(description = "检测目的")
private String purpose;
@Schema(description = "归档对象")
private String objects;
@Schema(description = "依据和方法")
private String methods;
@Schema(description = "是否启用0-禁用1-启用")
private Boolean enableFlag;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 DetectionCreateReqVO extends DetectionBaseVO {
}

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 devin1
*/
@Data
public class DetectionExcelVO {
@ExcelProperty("主键ID")
private Long id;
@ExcelProperty("一级分类")
private String oneType;
@ExcelProperty("二级分类")
private String twoType;
@ExcelProperty("检测编号")
private String code;
@ExcelProperty("检测项目")
private String name;
@ExcelProperty("检测目的")
private String purpose;
@ExcelProperty("归档对象")
private String objects;
@ExcelProperty("依据和方法")
private String methods;
@ExcelProperty("是否启用0-禁用1-启用")
private Boolean enableFlag;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("制单人")
private String createBy;
}

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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参数和 DetectionPageReqVO 是一致的")
@Data
public class DetectionExportReqVO {
@Schema(description = "一级分类", example = "1")
private String oneType;
@Schema(description = "二级分类", example = "2")
private String twoType;
@Schema(description = "检测编号")
private String code;
@Schema(description = "检测项目", example = "芋艿")
private String name;
@Schema(description = "检测目的")
private String purpose;
@Schema(description = "归档对象")
private String objects;
@Schema(description = "依据和方法")
private String methods;
@Schema(description = "是否启用0-禁用1-启用")
private Boolean enableFlag;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 DetectionPageReqVO extends PageParam {
@Schema(description = "一级分类", example = "1")
private String oneType;
@Schema(description = "二级分类", example = "2")
private String twoType;
@Schema(description = "检测编号")
private String code;
@Schema(description = "检测项目", example = "芋艿")
private String name;
@Schema(description = "检测目的")
private String purpose;
@Schema(description = "归档对象")
private String objects;
@Schema(description = "依据和方法")
private String methods;
@Schema(description = "是否启用0-禁用1-启用")
private Boolean enableFlag;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 DetectionRespVO extends DetectionBaseVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26127")
private Long id;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.setting.controller.admin.detection.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 DetectionUpdateReqVO extends DetectionBaseVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26127")
@NotNull(message = "主键ID不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.setting.convert.detection;
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.setting.controller.admin.detection.vo.*;
import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO;
/**
* Convert
*
* @author devin1
*/
@Mapper
public interface DetectionConvert {
DetectionConvert INSTANCE = Mappers.getMapper(DetectionConvert.class);
DetectionDO convert(DetectionCreateReqVO bean);
DetectionDO convert(DetectionUpdateReqVO bean);
DetectionRespVO convert(DetectionDO bean);
List<DetectionRespVO> convertList(List<DetectionDO> list);
PageResult<DetectionRespVO> convertPage(PageResult<DetectionDO> page);
List<DetectionExcelVO> convertList02(List<DetectionDO> list);
}

@ -0,0 +1,107 @@
package cn.iocoder.yudao.module.setting.dal.dataobject.detection;
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 devin1
*/
@TableName("setting_detection")
@KeySequence("setting_detection_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DetectionDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String oneType;
/**
*
*/
private String twoType;
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String purpose;
/**
*
*/
private String objects;
/**
*
*/
private String methods;
/**
* 0-1-
*/
private Boolean enableFlag;
/**
*
*/
private String remark;
/**
* 1
*/
private String attr1;
/**
* 2
*/
private String attr2;
/**
* 3
*/
private Integer attr3;
/**
* 4
*/
private Integer attr4;
/**
*
*/
private String createBy;
/**
* ID
*/
private Long deptId;
/**
*
*/
private String deptName;
/**
* ID
*/
private Long companyId;
/**
* ID
*/
private Long userId;
/**
*
*/
private String company;
}

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.setting.dal.mysql.detection;
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.setting.dal.dataobject.detection.DetectionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*;
/**
* Mapper
*
* @author devin1
*/
@Mapper
public interface DetectionMapper extends BaseMapperX<DetectionDO> {
default PageResult<DetectionDO> selectPage(DetectionPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DetectionDO>()
.eqIfPresent(DetectionDO::getOneType, reqVO.getOneType())
.eqIfPresent(DetectionDO::getTwoType, reqVO.getTwoType())
.eqIfPresent(DetectionDO::getCode, reqVO.getCode())
.likeIfPresent(DetectionDO::getName, reqVO.getName())
.likeIfPresent(DetectionDO::getPurpose, reqVO.getPurpose())
.likeIfPresent(DetectionDO::getObjects, reqVO.getObjects())
.likeIfPresent(DetectionDO::getMethods, reqVO.getMethods())
.eqIfPresent(DetectionDO::getEnableFlag, reqVO.getEnableFlag())
.eqIfPresent(DetectionDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DetectionDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DetectionDO::getCreateBy, reqVO.getCreateBy())
.orderByDesc(DetectionDO::getId));
}
default List<DetectionDO> selectList(DetectionExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<DetectionDO>()
.eqIfPresent(DetectionDO::getOneType, reqVO.getOneType())
.eqIfPresent(DetectionDO::getTwoType, reqVO.getTwoType())
.eqIfPresent(DetectionDO::getCode, reqVO.getCode())
.likeIfPresent(DetectionDO::getName, reqVO.getName())
.likeIfPresent(DetectionDO::getPurpose, reqVO.getPurpose())
.likeIfPresent(DetectionDO::getObjects, reqVO.getObjects())
.likeIfPresent(DetectionDO::getMethods, reqVO.getMethods())
.eqIfPresent(DetectionDO::getEnableFlag, reqVO.getEnableFlag())
.eqIfPresent(DetectionDO::getRemark, reqVO.getRemark())
.betweenIfPresent(DetectionDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DetectionDO::getCreateBy, reqVO.getCreateBy())
.orderByDesc(DetectionDO::getId));
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.setting.service.detection;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*;
import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author devin1
*/
public interface DetectionService {
/**
*
*
* @param createReqVO
* @return
*/
Long createDetection(@Valid DetectionCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateDetection(@Valid DetectionUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteDetection(Long id);
/**
*
*
* @param id
* @return
*/
DetectionDO getDetection(Long id);
/**
*
*
* @param ids
* @return
*/
List<DetectionDO> getDetectionList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<DetectionDO> getDetectionPage(DetectionPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<DetectionDO> getDetectionList(DetectionExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.setting.service.detection;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.setting.controller.admin.detection.vo.*;
import cn.iocoder.yudao.module.setting.dal.dataobject.detection.DetectionDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.setting.convert.detection.DetectionConvert;
import cn.iocoder.yudao.module.setting.dal.mysql.detection.DetectionMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.setting.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author devin1
*/
@Service
@Validated
public class DetectionServiceImpl implements DetectionService {
@Resource
private DetectionMapper detectionMapper;
@Override
public Long createDetection(DetectionCreateReqVO createReqVO) {
// 插入
DetectionDO detection = DetectionConvert.INSTANCE.convert(createReqVO);
detectionMapper.insert(detection);
// 返回
return detection.getId();
}
@Override
public void updateDetection(DetectionUpdateReqVO updateReqVO) {
// 校验存在
validateDetectionExists(updateReqVO.getId());
// 更新
DetectionDO updateObj = DetectionConvert.INSTANCE.convert(updateReqVO);
detectionMapper.updateById(updateObj);
}
@Override
public void deleteDetection(Long id) {
// 校验存在
validateDetectionExists(id);
// 删除
detectionMapper.deleteById(id);
}
private void validateDetectionExists(Long id) {
if (detectionMapper.selectById(id) == null) {
throw exception(DETECTION_NOT_EXISTS);
}
}
@Override
public DetectionDO getDetection(Long id) {
return detectionMapper.selectById(id);
}
@Override
public List<DetectionDO> getDetectionList(Collection<Long> ids) {
return detectionMapper.selectBatchIds(ids);
}
@Override
public PageResult<DetectionDO> getDetectionPage(DetectionPageReqVO pageReqVO) {
return detectionMapper.selectPage(pageReqVO);
}
@Override
public List<DetectionDO> getDetectionList(DetectionExportReqVO exportReqVO) {
return detectionMapper.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.setting.dal.mysql.detection.DetectionMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,231 @@
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