Browse Source

1、付款信息管理代码生成

dongpo 7 months ago
parent
commit
3242b772aa
11 changed files with 640 additions and 0 deletions
  1. 4 0
      yudao-module-finance/yudao-module-cash-api/src/main/java/cn/iocoder/yudao/module/cash/enums/ErrorCodeConstants.java
  2. 95 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/PaymentInfoController.java
  3. 48 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoPageReqVO.java
  4. 57 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoRespVO.java
  5. 35 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoSaveReqVO.java
  6. 64 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/dal/dataobject/paymentinfo/PaymentInfoDO.java
  7. 34 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/dal/mysql/paymentinfo/PaymentInfoMapper.java
  8. 55 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoService.java
  9. 74 0
      yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoServiceImpl.java
  10. 12 0
      yudao-module-finance/yudao-module-cash-biz/src/main/resources/mapper/paymentinfo/PaymentInfoMapper.xml
  11. 162 0
      yudao-module-finance/yudao-module-cash-biz/src/test/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoServiceImplTest.java

+ 4 - 0
yudao-module-finance/yudao-module-cash-api/src/main/java/cn/iocoder/yudao/module/cash/enums/ErrorCodeConstants.java

@@ -6,4 +6,8 @@ public interface ErrorCodeConstants {
 
     // ========== 回款信息 1_050_001_001 ==========
     ErrorCode REFUND_INFO_NOT_EXISTS = new ErrorCode(1_050_001_001, "回款信息不存在");
+
+
+    // ========== 付款信息 1_050_002_001 ==========
+    ErrorCode PAYMENT_INFO_NOT_EXISTS = new ErrorCode(1_050_002_001, "付款信息不存在");
 }

+ 95 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/PaymentInfoController.java

@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.cash.controller.admin.paymentinfo;
+
+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.cash.controller.admin.paymentinfo.vo.*;
+import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
+import cn.iocoder.yudao.module.cash.service.paymentinfo.PaymentInfoService;
+
+@Tag(name = "管理后台 - 付款信息")
+@RestController
+@RequestMapping("/cash/payment-info")
+@Validated
+public class PaymentInfoController {
+
+    @Resource
+    private PaymentInfoService paymentInfoService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建付款信息")
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:create')")
+    public CommonResult<Long> createPaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO createReqVO) {
+        return success(paymentInfoService.createPaymentInfo(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新付款信息")
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:update')")
+    public CommonResult<Boolean> updatePaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO updateReqVO) {
+        paymentInfoService.updatePaymentInfo(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除付款信息")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:delete')")
+    public CommonResult<Boolean> deletePaymentInfo(@RequestParam("id") Long id) {
+        paymentInfoService.deletePaymentInfo(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得付款信息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:query')")
+    public CommonResult<PaymentInfoRespVO> getPaymentInfo(@RequestParam("id") Long id) {
+        PaymentInfoDO paymentInfo = paymentInfoService.getPaymentInfo(id);
+        return success(BeanUtils.toBean(paymentInfo, PaymentInfoRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得付款信息分页")
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:query')")
+    public CommonResult<PageResult<PaymentInfoRespVO>> getPaymentInfoPage(@Valid PaymentInfoPageReqVO pageReqVO) {
+        PageResult<PaymentInfoDO> pageResult = paymentInfoService.getPaymentInfoPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, PaymentInfoRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出付款信息 Excel")
+    @PreAuthorize("@ss.hasPermission('cash:payment-info:export')")
+    @ApiAccessLog(operateType = EXPORT)
+    public void exportPaymentInfoExcel(@Valid PaymentInfoPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<PaymentInfoDO> list = paymentInfoService.getPaymentInfoPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "付款信息.xls", "数据", PaymentInfoRespVO.class,
+                        BeanUtils.toBean(list, PaymentInfoRespVO.class));
+    }
+
+}

+ 48 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoPageReqVO.java

@@ -0,0 +1,48 @@
+package cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import java.math.BigDecimal;
+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 PaymentInfoPageReqVO extends PageParam {
+
+    @Schema(description = "付款编号:年月日+uuid", example = "25414")
+    private String paymentInfoUuid;
+
+    @Schema(description = "付款标题")
+    private String paymentTitle;
+
+    @Schema(description = "付款日期")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private String[] paymentDate;
+
+    @Schema(description = "付款金额")
+    private BigDecimal paymentMoney;
+
+    @Schema(description = "收款方信息")
+    private String payee;
+
+    @Schema(description = "付款事由", example = "不香")
+    private String reason;
+
+    @Schema(description = "单据状态:0:已完成,1:作废", example = "1")
+    private String status;
+
+    @Schema(description = "备注")
+    private String remarks;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}

+ 57 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoRespVO.java

@@ -0,0 +1,57 @@
+package cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import java.util.*;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 付款信息 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class PaymentInfoRespVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "22098")
+    @ExcelProperty("主键")
+    private Long id;
+
+    @Schema(description = "付款编号:年月日+uuid", example = "25414")
+    @ExcelProperty("付款编号:年月日+uuid")
+    private String paymentInfoUuid;
+
+    @Schema(description = "付款标题")
+    @ExcelProperty("付款标题")
+    private String paymentTitle;
+
+    @Schema(description = "付款日期")
+    @ExcelProperty("付款日期")
+    private String paymentDate;
+
+    @Schema(description = "付款金额", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("付款金额")
+    private BigDecimal paymentMoney;
+
+    @Schema(description = "收款方信息")
+    @ExcelProperty("收款方信息")
+    private String payee;
+
+    @Schema(description = "付款事由", example = "不香")
+    @ExcelProperty("付款事由")
+    private String reason;
+
+    @Schema(description = "单据状态:0:已完成,1:作废", example = "1")
+    @ExcelProperty("单据状态:0:已完成,1:作废")
+    private String status;
+
+    @Schema(description = "备注")
+    @ExcelProperty("备注")
+    private String remarks;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 35 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/controller/admin/paymentinfo/vo/PaymentInfoSaveReqVO.java

@@ -0,0 +1,35 @@
+package cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+import java.math.BigDecimal;
+
+@Schema(description = "管理后台 - 付款信息新增/修改 Request VO")
+@Data
+public class PaymentInfoSaveReqVO {
+
+    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "22098")
+    private Long id;
+
+    @Schema(description = "付款标题")
+    private String paymentTitle;
+
+    @Schema(description = "付款日期")
+    private String paymentDate;
+
+    @Schema(description = "付款金额", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "付款金额不能为空")
+    private BigDecimal paymentMoney;
+
+    @Schema(description = "收款方信息")
+    private String payee;
+
+    @Schema(description = "付款事由", example = "不香")
+    private String reason;
+
+    @Schema(description = "备注")
+    private String remarks;
+
+}

+ 64 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/dal/dataobject/paymentinfo/PaymentInfoDO.java

@@ -0,0 +1,64 @@
+package cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo;
+
+import lombok.*;
+import java.util.*;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 付款信息 DO
+ *
+ * @author dp
+ */
+@TableName("finance_payment_info")
+@KeySequence("finance_payment_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class PaymentInfoDO extends BaseDO {
+
+    /**
+     * 主键
+     */
+    @TableId
+    private Long id;
+    /**
+     * 付款编号:年月日+uuid
+     */
+    private String paymentInfoUuid;
+    /**
+     * 付款标题
+     */
+    private String paymentTitle;
+    /**
+     * 付款日期
+     */
+    private String paymentDate;
+    /**
+     * 付款金额
+     */
+    private BigDecimal paymentMoney;
+    /**
+     * 收款方信息
+     */
+    private String payee;
+    /**
+     * 付款事由
+     */
+    private String reason;
+    /**
+     * 单据状态:0:已完成,1:作废
+     */
+    private String status;
+    /**
+     * 备注
+     */
+    private String remarks;
+
+}

+ 34 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/dal/mysql/paymentinfo/PaymentInfoMapper.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.cash.dal.mysql.paymentinfo;
+
+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.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo.*;
+
+/**
+ * 付款信息 Mapper
+ *
+ * @author dp
+ */
+@Mapper
+public interface PaymentInfoMapper extends BaseMapperX<PaymentInfoDO> {
+
+    default PageResult<PaymentInfoDO> selectPage(PaymentInfoPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<PaymentInfoDO>()
+                .eqIfPresent(PaymentInfoDO::getPaymentInfoUuid, reqVO.getPaymentInfoUuid())
+                .eqIfPresent(PaymentInfoDO::getPaymentTitle, reqVO.getPaymentTitle())
+                .betweenIfPresent(PaymentInfoDO::getPaymentDate, reqVO.getPaymentDate())
+                .eqIfPresent(PaymentInfoDO::getPaymentMoney, reqVO.getPaymentMoney())
+                .eqIfPresent(PaymentInfoDO::getPayee, reqVO.getPayee())
+                .eqIfPresent(PaymentInfoDO::getReason, reqVO.getReason())
+                .eqIfPresent(PaymentInfoDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(PaymentInfoDO::getRemarks, reqVO.getRemarks())
+                .betweenIfPresent(PaymentInfoDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(PaymentInfoDO::getId));
+    }
+
+}

+ 55 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoService.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.cash.service.paymentinfo;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo.*;
+import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * 付款信息 Service 接口
+ *
+ * @author dp
+ */
+public interface PaymentInfoService {
+
+    /**
+     * 创建付款信息
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createPaymentInfo(@Valid PaymentInfoSaveReqVO createReqVO);
+
+    /**
+     * 更新付款信息
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updatePaymentInfo(@Valid PaymentInfoSaveReqVO updateReqVO);
+
+    /**
+     * 删除付款信息
+     *
+     * @param id 编号
+     */
+    void deletePaymentInfo(Long id);
+
+    /**
+     * 获得付款信息
+     *
+     * @param id 编号
+     * @return 付款信息
+     */
+    PaymentInfoDO getPaymentInfo(Long id);
+
+    /**
+     * 获得付款信息分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 付款信息分页
+     */
+    PageResult<PaymentInfoDO> getPaymentInfoPage(PaymentInfoPageReqVO pageReqVO);
+
+}

+ 74 - 0
yudao-module-finance/yudao-module-cash-biz/src/main/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoServiceImpl.java

@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.cash.service.paymentinfo;
+
+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.cash.controller.admin.paymentinfo.vo.*;
+import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
+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.cash.dal.mysql.paymentinfo.PaymentInfoMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.cash.enums.ErrorCodeConstants.*;
+
+/**
+ * 付款信息 Service 实现类
+ *
+ * @author dp
+ */
+@Service
+@Validated
+public class PaymentInfoServiceImpl implements PaymentInfoService {
+
+    @Resource
+    private PaymentInfoMapper paymentInfoMapper;
+
+    @Override
+    public Long createPaymentInfo(PaymentInfoSaveReqVO createReqVO) {
+        // 插入
+        PaymentInfoDO paymentInfo = BeanUtils.toBean(createReqVO, PaymentInfoDO.class);
+        paymentInfoMapper.insert(paymentInfo);
+        // 返回
+        return paymentInfo.getId();
+    }
+
+    @Override
+    public void updatePaymentInfo(PaymentInfoSaveReqVO updateReqVO) {
+        // 校验存在
+        validatePaymentInfoExists(updateReqVO.getId());
+        // 更新
+        PaymentInfoDO updateObj = BeanUtils.toBean(updateReqVO, PaymentInfoDO.class);
+        paymentInfoMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deletePaymentInfo(Long id) {
+        // 校验存在
+        validatePaymentInfoExists(id);
+        // 删除
+        paymentInfoMapper.deleteById(id);
+    }
+
+    private void validatePaymentInfoExists(Long id) {
+        if (paymentInfoMapper.selectById(id) == null) {
+            throw exception(PAYMENT_INFO_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public PaymentInfoDO getPaymentInfo(Long id) {
+        return paymentInfoMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<PaymentInfoDO> getPaymentInfoPage(PaymentInfoPageReqVO pageReqVO) {
+        return paymentInfoMapper.selectPage(pageReqVO);
+    }
+
+}

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

+ 162 - 0
yudao-module-finance/yudao-module-cash-biz/src/test/java/cn/iocoder/yudao/module/cash/service/paymentinfo/PaymentInfoServiceImplTest.java

@@ -0,0 +1,162 @@
+// package cn.iocoder.yudao.module.cash.service.paymentinfo;
+//
+// 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.cash.controller.admin.paymentinfo.vo.*;
+// import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
+// import cn.iocoder.yudao.module.cash.dal.mysql.paymentinfo.PaymentInfoMapper;
+// 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.cash.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 PaymentInfoServiceImpl} 的单元测试类
+//  *
+//  * @author dp
+//  */
+// @Import(PaymentInfoServiceImpl.class)
+// public class PaymentInfoServiceImplTest extends BaseDbUnitTest {
+//
+//     @Resource
+//     private PaymentInfoServiceImpl paymentInfoService;
+//
+//     @Resource
+//     private PaymentInfoMapper paymentInfoMapper;
+//
+//     @Test
+//     public void testCreatePaymentInfo_success() {
+//         // 准备参数
+//         PaymentInfoSaveReqVO createReqVO = randomPojo(PaymentInfoSaveReqVO.class).setId(null);
+//
+//         // 调用
+//         Long paymentInfoId = paymentInfoService.createPaymentInfo(createReqVO);
+//         // 断言
+//         assertNotNull(paymentInfoId);
+//         // 校验记录的属性是否正确
+//         PaymentInfoDO paymentInfo = paymentInfoMapper.selectById(paymentInfoId);
+//         assertPojoEquals(createReqVO, paymentInfo, "id");
+//     }
+//
+//     @Test
+//     public void testUpdatePaymentInfo_success() {
+//         // mock 数据
+//         PaymentInfoDO dbPaymentInfo = randomPojo(PaymentInfoDO.class);
+//         paymentInfoMapper.insert(dbPaymentInfo);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         PaymentInfoSaveReqVO updateReqVO = randomPojo(PaymentInfoSaveReqVO.class, o -> {
+//             o.setId(dbPaymentInfo.getId()); // 设置更新的 ID
+//         });
+//
+//         // 调用
+//         paymentInfoService.updatePaymentInfo(updateReqVO);
+//         // 校验是否更新正确
+//         PaymentInfoDO paymentInfo = paymentInfoMapper.selectById(updateReqVO.getId()); // 获取最新的
+//         assertPojoEquals(updateReqVO, paymentInfo);
+//     }
+//
+//     @Test
+//     public void testUpdatePaymentInfo_notExists() {
+//         // 准备参数
+//         PaymentInfoSaveReqVO updateReqVO = randomPojo(PaymentInfoSaveReqVO.class);
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> paymentInfoService.updatePaymentInfo(updateReqVO), PAYMENT_INFO_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     public void testDeletePaymentInfo_success() {
+//         // mock 数据
+//         PaymentInfoDO dbPaymentInfo = randomPojo(PaymentInfoDO.class);
+//         paymentInfoMapper.insert(dbPaymentInfo);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         Long id = dbPaymentInfo.getId();
+//
+//         // 调用
+//         paymentInfoService.deletePaymentInfo(id);
+//        // 校验数据不存在了
+//        assertNull(paymentInfoMapper.selectById(id));
+//     }
+//
+//     @Test
+//     public void testDeletePaymentInfo_notExists() {
+//         // 准备参数
+//         Long id = randomLongId();
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> paymentInfoService.deletePaymentInfo(id), PAYMENT_INFO_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
+//     public void testGetPaymentInfoPage() {
+//        // mock 数据
+//        PaymentInfoDO dbPaymentInfo = randomPojo(PaymentInfoDO.class, o -> { // 等会查询到
+//            o.setPaymentInfoUuid(null);
+//            o.setPaymentTitle(null);
+//            o.setPaymentDate(null);
+//            o.setPaymentMoney(null);
+//            o.setPayee(null);
+//            o.setReason(null);
+//            o.setStatus(null);
+//            o.setRemarks(null);
+//            o.setCreateTime(null);
+//        });
+//        paymentInfoMapper.insert(dbPaymentInfo);
+//        // 测试 paymentInfoUuid 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setPaymentInfoUuid(null)));
+//        // 测试 paymentTitle 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setPaymentTitle(null)));
+//        // 测试 paymentDate 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setPaymentDate(null)));
+//        // 测试 paymentMoney 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setPaymentMoney(null)));
+//        // 测试 payee 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setPayee(null)));
+//        // 测试 reason 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setReason(null)));
+//        // 测试 status 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setStatus(null)));
+//        // 测试 remarks 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setRemarks(null)));
+//        // 测试 createTime 不匹配
+//        paymentInfoMapper.insert(cloneIgnoreId(dbPaymentInfo, o -> o.setCreateTime(null)));
+//        // 准备参数
+//        PaymentInfoPageReqVO reqVO = new PaymentInfoPageReqVO();
+//        reqVO.setPaymentInfoUuid(null);
+//        reqVO.setPaymentTitle(null);
+//        reqVO.setPaymentDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
+//        reqVO.setPaymentMoney(null);
+//        reqVO.setPayee(null);
+//        reqVO.setReason(null);
+//        reqVO.setStatus(null);
+//        reqVO.setRemarks(null);
+//        reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
+//
+//        // 调用
+//        PageResult<PaymentInfoDO> pageResult = paymentInfoService.getPaymentInfoPage(reqVO);
+//        // 断言
+//        assertEquals(1, pageResult.getTotal());
+//        assertEquals(1, pageResult.getList().size());
+//        assertPojoEquals(dbPaymentInfo, pageResult.getList().get(0));
+//     }
+//
+// }