Procházet zdrojové kódy

1、平台协议生成代码

dongpo před 2 měsíci
rodič
revize
7a70f77b7f
13 změnil soubory, kde provedl 526 přidání a 1 odebrání
  1. 3 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  2. 95 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/AgreementController.java
  3. 23 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementPageReqVO.java
  4. 30 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementRespVO.java
  5. 25 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementSaveReqVO.java
  6. 41 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/agreement/AgreementDO.java
  7. 1 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/MenuDO.java
  8. 28 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/agreement/AgreementMapper.java
  9. 55 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/agreement/AgreementService.java
  10. 74 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/agreement/AgreementServiceImpl.java
  11. 12 0
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/agreement/AgreementMapper.xml
  12. 138 0
      yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/agreement/AgreementServiceImplTest.java
  13. 1 0
      yudao-ui/yudao-ui-admin-vue3/src/utils/dict.ts

+ 3 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@@ -173,4 +173,7 @@ public interface ErrorCodeConstants {
     // ========== 站内信发送 1-002-028-000 ==========
     ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失");
 
+    // ========== 平台协议 1_002_029_000 ==========
+    ErrorCode AGREEMENT_NOT_EXISTS = new ErrorCode(1_002_029_000, "平台协议不存在");
+
 }

+ 95 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/AgreementController.java

@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.system.controller.admin.agreement;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.constraints.*;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
+
+import cn.iocoder.yudao.module.system.controller.admin.agreement.vo.*;
+import cn.iocoder.yudao.module.system.dal.dataobject.agreement.AgreementDO;
+import cn.iocoder.yudao.module.system.service.agreement.AgreementService;
+
+@Tag(name = "管理后台 - 平台协议")
+@RestController
+@RequestMapping("/system/agreement")
+@Validated
+public class AgreementController {
+
+    @Resource
+    private AgreementService agreementService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建平台协议")
+    @PreAuthorize("@ss.hasPermission('system:agreement:create')")
+    public CommonResult<Long> createAgreement(@Valid @RequestBody AgreementSaveReqVO createReqVO) {
+        return success(agreementService.createAgreement(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新平台协议")
+    @PreAuthorize("@ss.hasPermission('system:agreement:update')")
+    public CommonResult<Boolean> updateAgreement(@Valid @RequestBody AgreementSaveReqVO updateReqVO) {
+        agreementService.updateAgreement(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除平台协议")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('system:agreement:delete')")
+    public CommonResult<Boolean> deleteAgreement(@RequestParam("id") Long id) {
+        agreementService.deleteAgreement(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得平台协议")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('system:agreement:query')")
+    public CommonResult<AgreementRespVO> getAgreement(@RequestParam("id") Long id) {
+        AgreementDO agreement = agreementService.getAgreement(id);
+        return success(BeanUtils.toBean(agreement, AgreementRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得平台协议分页")
+    @PreAuthorize("@ss.hasPermission('system:agreement:query')")
+    public CommonResult<PageResult<AgreementRespVO>> getAgreementPage(@Valid AgreementPageReqVO pageReqVO) {
+        PageResult<AgreementDO> pageResult = agreementService.getAgreementPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, AgreementRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出平台协议 Excel")
+    @PreAuthorize("@ss.hasPermission('system:agreement:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportAgreementExcel(@Valid AgreementPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<AgreementDO> list = agreementService.getAgreementPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "平台协议.xls", "数据", AgreementRespVO.class,
+                        BeanUtils.toBean(list, AgreementRespVO.class));
+    }
+
+}

+ 23 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementPageReqVO.java

@@ -0,0 +1,23 @@
+package cn.iocoder.yudao.module.system.controller.admin.agreement.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+@Schema(description = "管理后台 - 平台协议分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class AgreementPageReqVO extends PageParam {
+
+    @Schema(description = "协议类型:1服务条款 2隐私声明", example = "1")
+    private Integer type;
+
+    @Schema(description = "路径,备用字段")
+    private String path;
+
+    @Schema(description = "协议内容")
+    private String content;
+
+}

+ 30 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementRespVO.java

@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.system.controller.admin.agreement.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import java.util.*;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 平台协议 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class AgreementRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5752")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "协议类型:1服务条款 2隐私声明", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("协议类型:1服务条款 2隐私声明")
+    private Integer type;
+
+    @Schema(description = "路径,备用字段")
+    @ExcelProperty("路径,备用字段")
+    private String path;
+
+    @Schema(description = "协议内容")
+    @ExcelProperty("协议内容")
+    private String content;
+
+}

+ 25 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/agreement/vo/AgreementSaveReqVO.java

@@ -0,0 +1,25 @@
+package cn.iocoder.yudao.module.system.controller.admin.agreement.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 平台协议新增/修改 Request VO")
+@Data
+public class AgreementSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5752")
+    private Long id;
+
+    @Schema(description = "协议类型:1服务条款 2隐私声明", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "协议类型:1服务条款 2隐私声明不能为空")
+    private Integer type;
+
+    @Schema(description = "路径,备用字段")
+    private String path;
+
+    @Schema(description = "协议内容")
+    private String content;
+
+}

+ 41 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/agreement/AgreementDO.java

@@ -0,0 +1,41 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.agreement;
+
+import lombok.*;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 平台协议 DO
+ *
+ * @author dp
+ */
+@TableName("system_agreement")
+@KeySequence("system_agreement_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class AgreementDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 协议类型:1服务条款 2隐私声明
+     */
+    private Integer type;
+    /**
+     * 路径,备用字段
+     */
+    private String path;
+    /**
+     * 协议内容
+     */
+    private String content;
+
+}

+ 1 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/MenuDO.java

@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
  *
  * @author ruoyi
  */
-@TableName("system_menu_copy1")
+@TableName("system_menu")
 @KeySequence("system_menu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 @Data
 @EqualsAndHashCode(callSuper = true)

+ 28 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/agreement/AgreementMapper.java

@@ -0,0 +1,28 @@
+package cn.iocoder.yudao.module.system.dal.mysql.agreement;
+
+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.system.dal.dataobject.agreement.AgreementDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.system.controller.admin.agreement.vo.*;
+
+/**
+ * 平台协议 Mapper
+ *
+ * @author dp
+ */
+@Mapper
+public interface AgreementMapper extends BaseMapperX<AgreementDO> {
+
+    default PageResult<AgreementDO> selectPage(AgreementPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<AgreementDO>()
+                .eqIfPresent(AgreementDO::getType, reqVO.getType())
+                .eqIfPresent(AgreementDO::getPath, reqVO.getPath())
+                .eqIfPresent(AgreementDO::getContent, reqVO.getContent())
+                .orderByDesc(AgreementDO::getId));
+    }
+
+}

+ 55 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/agreement/AgreementService.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.system.service.agreement;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.system.controller.admin.agreement.vo.*;
+import cn.iocoder.yudao.module.system.dal.dataobject.agreement.AgreementDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * 平台协议 Service 接口
+ *
+ * @author dp
+ */
+public interface AgreementService {
+
+    /**
+     * 创建平台协议
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createAgreement(@Valid AgreementSaveReqVO createReqVO);
+
+    /**
+     * 更新平台协议
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateAgreement(@Valid AgreementSaveReqVO updateReqVO);
+
+    /**
+     * 删除平台协议
+     *
+     * @param id 编号
+     */
+    void deleteAgreement(Long id);
+
+    /**
+     * 获得平台协议
+     *
+     * @param id 编号
+     * @return 平台协议
+     */
+    AgreementDO getAgreement(Long id);
+
+    /**
+     * 获得平台协议分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 平台协议分页
+     */
+    PageResult<AgreementDO> getAgreementPage(AgreementPageReqVO pageReqVO);
+
+}

+ 74 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/agreement/AgreementServiceImpl.java

@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.system.service.agreement;
+
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import cn.iocoder.yudao.module.system.controller.admin.agreement.vo.*;
+import cn.iocoder.yudao.module.system.dal.dataobject.agreement.AgreementDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+import cn.iocoder.yudao.module.system.dal.mysql.agreement.AgreementMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
+
+/**
+ * 平台协议 Service 实现类
+ *
+ * @author dp
+ */
+@Service
+@Validated
+public class AgreementServiceImpl implements AgreementService {
+
+    @Resource
+    private AgreementMapper agreementMapper;
+
+    @Override
+    public Long createAgreement(AgreementSaveReqVO createReqVO) {
+        // 插入
+        AgreementDO agreement = BeanUtils.toBean(createReqVO, AgreementDO.class);
+        agreementMapper.insert(agreement);
+        // 返回
+        return agreement.getId();
+    }
+
+    @Override
+    public void updateAgreement(AgreementSaveReqVO updateReqVO) {
+        // 校验存在
+        validateAgreementExists(updateReqVO.getId());
+        // 更新
+        AgreementDO updateObj = BeanUtils.toBean(updateReqVO, AgreementDO.class);
+        agreementMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteAgreement(Long id) {
+        // 校验存在
+        validateAgreementExists(id);
+        // 删除
+        agreementMapper.deleteById(id);
+    }
+
+    private void validateAgreementExists(Long id) {
+        if (agreementMapper.selectById(id) == null) {
+            throw exception(AGREEMENT_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public AgreementDO getAgreement(Long id) {
+        return agreementMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<AgreementDO> getAgreementPage(AgreementPageReqVO pageReqVO) {
+        return agreementMapper.selectPage(pageReqVO);
+    }
+
+}

+ 12 - 0
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/agreement/AgreementMapper.xml

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

+ 138 - 0
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/agreement/AgreementServiceImplTest.java

@@ -0,0 +1,138 @@
+// package cn.iocoder.yudao.module.system.service.agreement;
+//
+// 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.system.controller.admin.agreement.vo.*;
+// import cn.iocoder.yudao.module.system.dal.dataobject.agreement.AgreementDO;
+// import cn.iocoder.yudao.module.system.dal.mysql.agreement.AgreementMapper;
+// 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.system.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 AgreementServiceImpl} 的单元测试类
+//  *
+//  * @author dp
+//  */
+// @Import(AgreementServiceImpl.class)
+// public class AgreementServiceImplTest extends BaseDbUnitTest {
+//
+//     @Resource
+//     private AgreementServiceImpl agreementService;
+//
+//     @Resource
+//     private AgreementMapper agreementMapper;
+//
+//     @Test
+//     public void testCreateAgreement_success() {
+//         // 准备参数
+//         AgreementSaveReqVO createReqVO = randomPojo(AgreementSaveReqVO.class).setId(null);
+//
+//         // 调用
+//         Long agreementId = agreementService.createAgreement(createReqVO);
+//         // 断言
+//         assertNotNull(agreementId);
+//         // 校验记录的属性是否正确
+//         AgreementDO agreement = agreementMapper.selectById(agreementId);
+//         assertPojoEquals(createReqVO, agreement, "id");
+//     }
+//
+//     @Test
+//     public void testUpdateAgreement_success() {
+//         // mock 数据
+//         AgreementDO dbAgreement = randomPojo(AgreementDO.class);
+//         agreementMapper.insert(dbAgreement);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         AgreementSaveReqVO updateReqVO = randomPojo(AgreementSaveReqVO.class, o -> {
+//             o.setId(dbAgreement.getId()); // 设置更新的 ID
+//         });
+//
+//         // 调用
+//         agreementService.updateAgreement(updateReqVO);
+//         // 校验是否更新正确
+//         AgreementDO agreement = agreementMapper.selectById(updateReqVO.getId()); // 获取最新的
+//         assertPojoEquals(updateReqVO, agreement);
+//     }
+//
+//     @Test
+//     public void testUpdateAgreement_notExists() {
+//         // 准备参数
+//         AgreementSaveReqVO updateReqVO = randomPojo(AgreementSaveReqVO.class);
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> agreementService.updateAgreement(updateReqVO), AGREEMENT_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     public void testDeleteAgreement_success() {
+//         // mock 数据
+//         AgreementDO dbAgreement = randomPojo(AgreementDO.class);
+//         agreementMapper.insert(dbAgreement);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         Long id = dbAgreement.getId();
+//
+//         // 调用
+//         agreementService.deleteAgreement(id);
+//        // 校验数据不存在了
+//        assertNull(agreementMapper.selectById(id));
+//     }
+//
+//     @Test
+//     public void testDeleteAgreement_notExists() {
+//         // 准备参数
+//         Long id = randomLongId();
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> agreementService.deleteAgreement(id), AGREEMENT_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
+//     public void testGetAgreementPage() {
+//        // mock 数据
+//        AgreementDO dbAgreement = randomPojo(AgreementDO.class, o -> { // 等会查询到
+//            o.setType(null);
+//            o.setPath(null);
+//            o.setContent(null);
+//        });
+//        agreementMapper.insert(dbAgreement);
+//        // 测试 type 不匹配
+//        agreementMapper.insert(cloneIgnoreId(dbAgreement, o -> o.setType(null)));
+//        // 测试 path 不匹配
+//        agreementMapper.insert(cloneIgnoreId(dbAgreement, o -> o.setPath(null)));
+//        // 测试 content 不匹配
+//        agreementMapper.insert(cloneIgnoreId(dbAgreement, o -> o.setContent(null)));
+//        // 准备参数
+//        AgreementPageReqVO reqVO = new AgreementPageReqVO();
+//        reqVO.setType(null);
+//        reqVO.setPath(null);
+//        reqVO.setContent(null);
+//
+//        // 调用
+//        PageResult<AgreementDO> pageResult = agreementService.getAgreementPage(reqVO);
+//        // 断言
+//        assertEquals(1, pageResult.getTotal());
+//        assertEquals(1, pageResult.getList().size());
+//        assertPojoEquals(dbAgreement, pageResult.getList().get(0));
+//     }
+//
+// }

+ 1 - 0
yudao-ui/yudao-ui-admin-vue3/src/utils/dict.ts

@@ -91,6 +91,7 @@ export const getDictObj = (dictType: string, value: any): DictDataType | undefin
  */
 export const getDictLabel = (dictType: string, value: any): string => {
   const dictOptions: DictDataType[] = getDictOptions(dictType)
+  // @ts-ignore
   const dictLabel = ref('')
   dictOptions.forEach((dict: DictDataType) => {
     if (dict.value === value + '') {