feat: 申请单主单代码临时提交
parent
4dfc6e5f07
commit
1580d21d83
@ -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<Long> createExpenseApply(@Valid @RequestBody ExpenseApplyCreateReqVO createReqVO) {
|
||||||
|
return success(expenseApplyService.createExpenseApply(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新申请单")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bs:expense-apply:update')")
|
||||||
|
public CommonResult<Boolean> 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<Boolean> 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<ExpenseApplyRespVO> 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<List<ExpenseApplyRespVO>> getExpenseApplyList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
|
List<ExpenseApplyDO> list = expenseApplyService.getExpenseApplyList(ids);
|
||||||
|
return success(ExpenseApplyConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得申请单分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bs:expense-apply:query')")
|
||||||
|
public CommonResult<PageResult<ExpenseApplyRespVO>> getExpenseApplyPage(@Valid ExpenseApplyPageReqVO pageVO) {
|
||||||
|
PageResult<ExpenseApplyDO> 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<ExpenseApplyDO> list = expenseApplyService.getExpenseApplyList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<ExpenseApplyExcelVO> datas = ExpenseApplyConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "申请单.xls", "数据", ExpenseApplyExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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<ExpenseApplyRespVO> convertList(List<ExpenseApplyDO> list);
|
||||||
|
|
||||||
|
PageResult<ExpenseApplyRespVO> convertPage(PageResult<ExpenseApplyDO> page);
|
||||||
|
|
||||||
|
List<ExpenseApplyExcelVO> convertList02(List<ExpenseApplyDO> list);
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -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<ExpenseApplyDO> {
|
||||||
|
|
||||||
|
default PageResult<ExpenseApplyDO> selectPage(ExpenseApplyPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ExpenseApplyDO>()
|
||||||
|
.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<ExpenseApplyDO> selectList(ExpenseApplyExportReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<ExpenseApplyDO>()
|
||||||
|
.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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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<ExpenseApplyDO> getExpenseApplyList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得申请单分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 申请单分页
|
||||||
|
*/
|
||||||
|
PageResult<ExpenseApplyDO> getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得申请单列表, 用于 Excel 导出
|
||||||
|
*
|
||||||
|
* @param exportReqVO 查询条件
|
||||||
|
* @return 申请单列表
|
||||||
|
*/
|
||||||
|
List<ExpenseApplyDO> getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
}
|
@ -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<ExpenseApplyDO> getExpenseApplyList(Collection<Long> ids) {
|
||||||
|
return expenseApplyMapper.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ExpenseApplyDO> getExpenseApplyPage(ExpenseApplyPageReqVO pageReqVO) {
|
||||||
|
return expenseApplyMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExpenseApplyDO> getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO) {
|
||||||
|
return expenseApplyMapper.selectList(exportReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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<ExpenseApplyDO> 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<ExpenseApplyDO> list = expenseApplyService.getExpenseApplyList(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, list.size());
|
||||||
|
assertPojoEquals(dbExpenseApply, list.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue