diff --git a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java index 65726454..69657919 100644 --- a/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java +++ b/yudao-module-bs/yudao-module-bs-api/src/main/java/cn/iocoder/yudao/module/bs/enums/ErrorCodeConstants.java @@ -10,5 +10,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { ErrorCode INVOICE_NOT_EXISTS = new ErrorCode(200100, "我的发票不存在"); - + ErrorCode EXPENSE_APPLY_NOT_EXISTS = new ErrorCode(200200, "申请单不存在"); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/ExpenseApplyController.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/ExpenseApplyController.java new file mode 100644 index 00000000..371b5d93 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/ExpenseApplyController.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.*; +import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.service.expenseapply.ExpenseApplyService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + +@Tag(name = "管理后台 - 申请单") +@RestController +@RequestMapping("/bs/expense-apply") +@Validated +public class ExpenseApplyController { + + @Resource + private ExpenseApplyService expenseApplyService; + + @PostMapping("/create") + @Operation(summary = "创建申请单") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:create')") + public CommonResult createExpenseApply(@Valid @RequestBody ExpenseApplyCreateReqVO createReqVO) { + return success(expenseApplyService.createExpenseApply(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新申请单") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:update')") + public CommonResult updateExpenseApply(@Valid @RequestBody ExpenseApplyUpdateReqVO updateReqVO) { + expenseApplyService.updateExpenseApply(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除申请单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('bs:expense-apply:delete')") + public CommonResult deleteExpenseApply(@RequestParam("id") Long id) { + expenseApplyService.deleteExpenseApply(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得申请单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult getExpenseApply(@RequestParam("id") Long id) { + ExpenseApplyDO expenseApply = expenseApplyService.getExpenseApply(id); + return success(ExpenseApplyConvert.INSTANCE.convert(expenseApply)); + } + + @GetMapping("/list") + @Operation(summary = "获得申请单列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult> getExpenseApplyList(@RequestParam("ids") Collection ids) { + List list = expenseApplyService.getExpenseApplyList(ids); + return success(ExpenseApplyConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得申请单分页") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") + public CommonResult> getExpenseApplyPage(@Valid ExpenseApplyPageReqVO pageVO) { + PageResult pageResult = expenseApplyService.getExpenseApplyPage(pageVO); + return success(ExpenseApplyConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出申请单 Excel") + @PreAuthorize("@ss.hasPermission('bs:expense-apply:export')") + @OperateLog(type = EXPORT) + public void exportExpenseApplyExcel(@Valid ExpenseApplyExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = expenseApplyService.getExpenseApplyList(exportReqVO); + // 导出 Excel + List datas = ExpenseApplyConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "申请单.xls", "数据", ExpenseApplyExcelVO.class, datas); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java new file mode 100644 index 00000000..12e60d1c --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyBaseVO.java @@ -0,0 +1,49 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * 申请单 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class ExpenseApplyBaseVO { + + @Schema(description = "申请类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "申请类型不能为空") + private String billType; + + @Schema(description = "申请者ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9227") + @NotNull(message = "申请者ID不能为空") + private Long userId; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @NotNull(message = "用户昵称不能为空") + private String nickname; + + @Schema(description = "部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32343") + @NotNull(message = "部门ID不能为空") + private Long deptId; + + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotNull(message = "部门名称不能为空") + private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + private String reason; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "附件不能为空") + private String files; + + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java new file mode 100644 index 00000000..a26d6ffd --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 申请单创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyCreateReqVO extends ExpenseApplyBaseVO { + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java new file mode 100644 index 00000000..234e2131 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExcelVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + + +/** + * 申请单 Excel VO + * + * @author 芋道源码 + */ +@Data +public class ExpenseApplyExcelVO { + + @ExcelProperty("id") + private Long id; + + @ExcelProperty(value = "申请类型", converter = DictConvert.class) + @DictFormat("bs_bill_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String billType; + + @ExcelProperty("申请单号") + private String applyNo; + + @ExcelProperty("申请者ID") + private Long userId; + + @ExcelProperty("用户昵称") + private String nickname; + + @ExcelProperty("部门ID") + private Long deptId; + + @ExcelProperty("部门名称") + private String deptName; + + @ExcelProperty("项目名称") + private String projectName; + + @ExcelProperty("申请事由") + private String reason; + + @ExcelProperty("申请金额") + private BigDecimal amount; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat("bs_expense_apply_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 + private String status; + + @ExcelProperty("备注") + private String remark; + + @ExcelProperty("附件") + private String files; + + @ExcelProperty("创建者") + private String createBy; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("更新者") + private String updateBy; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java new file mode 100644 index 00000000..50513519 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyExportReqVO.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 申请单 Excel 导出 Request VO,参数和 ExpenseApplyPageReqVO 是一致的") +@Data +public class ExpenseApplyExportReqVO { + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "申请单号") + private String applyNo; + + @Schema(description = "申请者ID", example = "9227") + private Long userId; + + @Schema(description = "用户昵称", example = "张三") + private String nickname; + + @Schema(description = "部门ID", example = "32343") + private Long deptId; + + @Schema(description = "部门名称", example = "王五") + private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + private String reason; + + @Schema(description = "申请金额") + private BigDecimal amount; + + @Schema(description = "状态", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private String files; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updateBy; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java new file mode 100644 index 00000000..b88f555e --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +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 ExpenseApplyPageReqVO extends PageParam { + + @Schema(description = "申请类型", example = "2") + private String billType; + + @Schema(description = "申请单号") + private String applyNo; + + @Schema(description = "申请者ID", example = "9227") + private Long userId; + + @Schema(description = "用户昵称", example = "张三") + private String nickname; + + @Schema(description = "部门ID", example = "32343") + private Long deptId; + + @Schema(description = "部门名称", example = "王五") + private String deptName; + + @Schema(description = "项目名称", example = "芋艿") + private String projectName; + + @Schema(description = "申请事由", example = "不香") + private String reason; + + @Schema(description = "申请金额") + private BigDecimal amount; + + @Schema(description = "状态", example = "2") + private String status; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "附件") + private String files; + + @Schema(description = "创建者") + private String createBy; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "更新者") + private String updateBy; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java new file mode 100644 index 00000000..03f65991 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyRespVO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 申请单 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyRespVO extends ExpenseApplyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14225") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java new file mode 100644 index 00000000..6619f3dc --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyUpdateReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 申请单更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ExpenseApplyUpdateReqVO extends ExpenseApplyBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14225") + @NotNull(message = "id不能为空") + private Long id; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java new file mode 100644 index 00000000..4ad58b48 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/convert/expenseapply/ExpenseApplyConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.bs.convert.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExcelVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyRespVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 申请单 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ExpenseApplyConvert { + + ExpenseApplyConvert INSTANCE = Mappers.getMapper(ExpenseApplyConvert.class); + + ExpenseApplyDO convert(ExpenseApplyCreateReqVO bean); + + ExpenseApplyDO convert(ExpenseApplyUpdateReqVO bean); + + ExpenseApplyRespVO convert(ExpenseApplyDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java new file mode 100644 index 00000000..85fa6ce2 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java @@ -0,0 +1,84 @@ +package cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.math.BigDecimal; + +/** + * 申请单 DO + * + * @author 芋道源码 + */ +@TableName(value = "bs_expense_apply", autoResultMap = true) +@KeySequence("bs_expense_apply_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ExpenseApplyDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 申请类型 + * + * 枚举 {@link TODO bs_bill_type 对应的类} + */ + private String billType; + /** + * 申请单号 + */ + private String applyNo; + /** + * 申请者ID + */ + private Long userId; + /** + * 用户昵称 + */ + private String nickname; + /** + * 部门ID + */ + private Long deptId; + /** + * 部门名称 + */ + private String deptName; + /** + * 项目名称 + */ + private String projectName; + /** + * 申请事由 + */ + private String reason; + /** + * 申请金额 + */ + private BigDecimal amount; + /** + * 状态 + * + * 枚举 {@link TODO bs_expense_apply_status 对应的类} + */ + private String status; + /** + * 备注 + */ + private String remark; + /** + * 附件 + */ + private String files; + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java index e470891c..9ed1c5af 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java @@ -31,14 +31,7 @@ public class InvoiceDO extends BaseDO { * 附件 */ private String files; - /** - * 创建者 - */ - private String createBy; - /** - * 更新者 - */ - private String updateBy; + /** * 发票类型 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java new file mode 100644 index 00000000..7b1fa6ab --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/expenseapply/ExpenseApplyMapper.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.bs.dal.mysql.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 申请单 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ExpenseApplyMapper extends BaseMapperX { + + default PageResult selectPage(ExpenseApplyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ExpenseApplyDO::getBillType, reqVO.getBillType()) + .eqIfPresent(ExpenseApplyDO::getApplyNo, reqVO.getApplyNo()) + .eqIfPresent(ExpenseApplyDO::getUserId, reqVO.getUserId()) + .likeIfPresent(ExpenseApplyDO::getNickname, reqVO.getNickname()) + .eqIfPresent(ExpenseApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ExpenseApplyDO::getDeptName, reqVO.getDeptName()) + .likeIfPresent(ExpenseApplyDO::getProjectName, reqVO.getProjectName()) + .eqIfPresent(ExpenseApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(ExpenseApplyDO::getAmount, reqVO.getAmount()) + .eqIfPresent(ExpenseApplyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ExpenseApplyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ExpenseApplyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(ExpenseApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ExpenseApplyDO::getId)); + } + + default List selectList(ExpenseApplyExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(ExpenseApplyDO::getBillType, reqVO.getBillType()) + .eqIfPresent(ExpenseApplyDO::getApplyNo, reqVO.getApplyNo()) + .eqIfPresent(ExpenseApplyDO::getUserId, reqVO.getUserId()) + .likeIfPresent(ExpenseApplyDO::getNickname, reqVO.getNickname()) + .eqIfPresent(ExpenseApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(ExpenseApplyDO::getDeptName, reqVO.getDeptName()) + .likeIfPresent(ExpenseApplyDO::getProjectName, reqVO.getProjectName()) + .eqIfPresent(ExpenseApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(ExpenseApplyDO::getAmount, reqVO.getAmount()) + .eqIfPresent(ExpenseApplyDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ExpenseApplyDO::getRemark, reqVO.getRemark()) + .eqIfPresent(ExpenseApplyDO::getFiles, reqVO.getFiles()) + .betweenIfPresent(ExpenseApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ExpenseApplyDO::getId)); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java index c4633ac7..26506c25 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/invoice/InvoiceMapper.java @@ -21,9 +21,7 @@ public interface InvoiceMapper extends BaseMapperX { default PageResult selectPage(InvoicePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) - .eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) @@ -41,9 +39,7 @@ public interface InvoiceMapper extends BaseMapperX { default List selectList(InvoiceExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() .eqIfPresent(InvoiceDO::getFiles, reqVO.getFiles()) - .eqIfPresent(InvoiceDO::getCreateBy, reqVO.getCreateBy()) .betweenIfPresent(InvoiceDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(InvoiceDO::getUpdateBy, reqVO.getUpdateBy()) .eqIfPresent(InvoiceDO::getInvoiceType, reqVO.getInvoiceType()) .eqIfPresent(InvoiceDO::getInvoiceCode, reqVO.getInvoiceCode()) .eqIfPresent(InvoiceDO::getInvoiceNum, reqVO.getInvoiceNum()) diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java new file mode 100644 index 00000000..1119b72e --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.bs.service.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 申请单 Service 接口 + * + * @author 芋道源码 + */ +public interface ExpenseApplyService { + + /** + * 创建申请单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createExpenseApply(@Valid ExpenseApplyCreateReqVO createReqVO); + + /** + * 更新申请单 + * + * @param updateReqVO 更新信息 + */ + void updateExpenseApply(@Valid ExpenseApplyUpdateReqVO updateReqVO); + + /** + * 删除申请单 + * + * @param id 编号 + */ + void deleteExpenseApply(Long id); + + /** + * 获得申请单 + * + * @param id 编号 + * @return 申请单 + */ + ExpenseApplyDO getExpenseApply(Long id); + + /** + * 获得申请单列表 + * + * @param ids 编号 + * @return 申请单列表 + */ + List getExpenseApplyList(Collection ids); + + /** + * 获得申请单分页 + * + * @param pageReqVO 分页查询 + * @return 申请单分页 + */ + PageResult getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO); + + /** + * 获得申请单列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 申请单列表 + */ + List getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO); + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java new file mode 100644 index 00000000..12ebc39e --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.bs.service.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.EXPENSE_APPLY_NOT_EXISTS; + +/** + * 申请单 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ExpenseApplyServiceImpl implements ExpenseApplyService { + + @Resource + private ExpenseApplyMapper expenseApplyMapper; + + @Override + public Long createExpenseApply(ExpenseApplyCreateReqVO createReqVO) { + // 插入 + ExpenseApplyDO expenseApply = ExpenseApplyConvert.INSTANCE.convert(createReqVO); + expenseApplyMapper.insert(expenseApply); + // 返回 + return expenseApply.getId(); + } + + @Override + public void updateExpenseApply(ExpenseApplyUpdateReqVO updateReqVO) { + // 校验存在 + validateExpenseApplyExists(updateReqVO.getId()); + // 更新 + ExpenseApplyDO updateObj = ExpenseApplyConvert.INSTANCE.convert(updateReqVO); + expenseApplyMapper.updateById(updateObj); + } + + @Override + public void deleteExpenseApply(Long id) { + // 校验存在 + validateExpenseApplyExists(id); + // 删除 + expenseApplyMapper.deleteById(id); + } + + private void validateExpenseApplyExists(Long id) { + if (expenseApplyMapper.selectById(id) == null) { + throw exception(EXPENSE_APPLY_NOT_EXISTS); + } + } + + @Override + public ExpenseApplyDO getExpenseApply(Long id) { + return expenseApplyMapper.selectById(id); + } + + @Override + public List getExpenseApplyList(Collection ids) { + return expenseApplyMapper.selectBatchIds(ids); + } + + @Override + public PageResult getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO) { + return expenseApplyMapper.selectPage(pageReqVO); + } + + @Override + public List getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO) { + return expenseApplyMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml new file mode 100644 index 00000000..6e4dcdc0 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/resources/mapper/expenseapply/ExpenseApplyMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java b/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java new file mode 100644 index 00000000..96c5a1a1 --- /dev/null +++ b/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java @@ -0,0 +1,259 @@ +package cn.iocoder.yudao.module.bs.service.expenseapply; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; +import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.Import; + +import javax.annotation.Resource; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; +import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.EXPENSE_APPLY_NOT_EXISTS; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link ExpenseApplyServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ +@Import(ExpenseApplyServiceImpl.class) +public class ExpenseApplyServiceImplTest extends BaseDbUnitTest { + + @Resource + private ExpenseApplyServiceImpl expenseApplyService; + + @Resource + private ExpenseApplyMapper expenseApplyMapper; + + @Test + public void testCreateExpenseApply_success() { + // 准备参数 + ExpenseApplyCreateReqVO reqVO = randomPojo(ExpenseApplyCreateReqVO.class); + + // 调用 + Long expenseApplyId = expenseApplyService.createExpenseApply(reqVO); + // 断言 + assertNotNull(expenseApplyId); + // 校验记录的属性是否正确 + ExpenseApplyDO expenseApply = expenseApplyMapper.selectById(expenseApplyId); + assertPojoEquals(reqVO, expenseApply); + } + + @Test + public void testUpdateExpenseApply_success() { + // mock 数据 + ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class); + expenseApplyMapper.insert(dbExpenseApply);// @Sql: 先插入出一条存在的数据 + // 准备参数 + ExpenseApplyUpdateReqVO reqVO = randomPojo(ExpenseApplyUpdateReqVO.class, o -> { + o.setId(dbExpenseApply.getId()); // 设置更新的 ID + }); + + // 调用 + expenseApplyService.updateExpenseApply(reqVO); + // 校验是否更新正确 + ExpenseApplyDO expenseApply = expenseApplyMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, expenseApply); + } + + @Test + public void testUpdateExpenseApply_notExists() { + // 准备参数 + ExpenseApplyUpdateReqVO reqVO = randomPojo(ExpenseApplyUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> expenseApplyService.updateExpenseApply(reqVO), EXPENSE_APPLY_NOT_EXISTS); + } + + @Test + public void testDeleteExpenseApply_success() { + // mock 数据 + ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class); + expenseApplyMapper.insert(dbExpenseApply);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbExpenseApply.getId(); + + // 调用 + expenseApplyService.deleteExpenseApply(id); + // 校验数据不存在了 + assertNull(expenseApplyMapper.selectById(id)); + } + + @Test + public void testDeleteExpenseApply_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> expenseApplyService.deleteExpenseApply(id), EXPENSE_APPLY_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetExpenseApplyPage() { + // mock 数据 + ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class, o -> { // 等会查询到 + o.setBillType(null); + o.setApplyNo(null); + o.setUserId(null); + o.setNickname(null); + o.setDeptId(null); + o.setDeptName(null); + o.setProjectName(null); + o.setReason(null); + o.setAmount(null); + o.setStatus(null); + o.setRemark(null); + o.setFiles(null); + o.setCreateBy(null); + o.setCreateTime(null); + o.setUpdateBy(null); + }); + expenseApplyMapper.insert(dbExpenseApply); + // 测试 billType 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setBillType(null))); + // 测试 applyNo 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setApplyNo(null))); + // 测试 userId 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUserId(null))); + // 测试 nickname 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setNickname(null))); + // 测试 deptId 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptName(null))); + // 测试 projectName 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setProjectName(null))); + // 测试 reason 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setReason(null))); + // 测试 amount 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setAmount(null))); + // 测试 status 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setStatus(null))); + // 测试 remark 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setRemark(null))); + // 测试 files 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setFiles(null))); + // 测试 createBy 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateBy(null))); + // 测试 createTime 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateTime(null))); + // 测试 updateBy 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUpdateBy(null))); + // 准备参数 + ExpenseApplyPageReqVO reqVO = new ExpenseApplyPageReqVO(); + reqVO.setBillType(null); + reqVO.setApplyNo(null); + reqVO.setUserId(null); + reqVO.setNickname(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setProjectName(null); + reqVO.setReason(null); + reqVO.setAmount(null); + reqVO.setStatus(null); + reqVO.setRemark(null); + reqVO.setFiles(null); + reqVO.setCreateBy(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setUpdateBy(null); + + // 调用 + PageResult pageResult = expenseApplyService.getExpenseApplyPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbExpenseApply, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetExpenseApplyList() { + // mock 数据 + ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class, o -> { // 等会查询到 + o.setBillType(null); + o.setApplyNo(null); + o.setUserId(null); + o.setNickname(null); + o.setDeptId(null); + o.setDeptName(null); + o.setProjectName(null); + o.setReason(null); + o.setAmount(null); + o.setStatus(null); + o.setRemark(null); + o.setFiles(null); + o.setCreateBy(null); + o.setCreateTime(null); + o.setUpdateBy(null); + }); + expenseApplyMapper.insert(dbExpenseApply); + // 测试 billType 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setBillType(null))); + // 测试 applyNo 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setApplyNo(null))); + // 测试 userId 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUserId(null))); + // 测试 nickname 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setNickname(null))); + // 测试 deptId 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptId(null))); + // 测试 deptName 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptName(null))); + // 测试 projectName 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setProjectName(null))); + // 测试 reason 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setReason(null))); + // 测试 amount 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setAmount(null))); + // 测试 status 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setStatus(null))); + // 测试 remark 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setRemark(null))); + // 测试 files 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setFiles(null))); + // 测试 createBy 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateBy(null))); + // 测试 createTime 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateTime(null))); + // 测试 updateBy 不匹配 + expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUpdateBy(null))); + // 准备参数 + ExpenseApplyExportReqVO reqVO = new ExpenseApplyExportReqVO(); + reqVO.setBillType(null); + reqVO.setApplyNo(null); + reqVO.setUserId(null); + reqVO.setNickname(null); + reqVO.setDeptId(null); + reqVO.setDeptName(null); + reqVO.setProjectName(null); + reqVO.setReason(null); + reqVO.setAmount(null); + reqVO.setStatus(null); + reqVO.setRemark(null); + reqVO.setFiles(null); + reqVO.setCreateBy(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + reqVO.setUpdateBy(null); + + // 调用 + List list = expenseApplyService.getExpenseApplyList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbExpenseApply, list.get(0)); + } + +}