电子档案附件
parent
ebbbe48720
commit
3bca7d8034
@ -0,0 +1,121 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
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.ea.controller.admin.electronicattachment.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ea.convert.electronicattachment.ElectronicAttachmentConvert;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO;
|
||||||
|
import cn.iocoder.yudao.module.ea.service.electronicattachment.ElectronicAttachmentService;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||||
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||||
|
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 org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
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("/ea/electronic-attachment")
|
||||||
|
@Validated
|
||||||
|
public class ElectronicAttachmentController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ElectronicAttachmentService electronicAttachmentService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建电子档案附件")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:create')")
|
||||||
|
public CommonResult<Long> createElectronicAttachment(@Valid @RequestBody ElectronicAttachmentCreateReqVO createReqVO) {
|
||||||
|
return success(electronicAttachmentService.createElectronicAttachment(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新电子档案附件")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:update')")
|
||||||
|
public CommonResult<Boolean> updateElectronicAttachment(@Valid @RequestBody ElectronicAttachmentUpdateReqVO updateReqVO) {
|
||||||
|
electronicAttachmentService.updateElectronicAttachment(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除电子档案附件")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:delete')")
|
||||||
|
public CommonResult<Boolean> deleteElectronicAttachment(@RequestParam("id") Long id) {
|
||||||
|
electronicAttachmentService.deleteElectronicAttachment(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@Operation(summary = "上传电子档案附件")
|
||||||
|
@Parameter(name = "multipartFile", description = "文件", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:create')")
|
||||||
|
public CommonResult<FileDO> upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException {
|
||||||
|
String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
|
||||||
|
FilePageReqVO pageReqVO = new FilePageReqVO();
|
||||||
|
String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
||||||
|
pageReqVO.setPath(lastSegment);
|
||||||
|
PageResult<FileDO> filePage = fileService.getFilePage(pageReqVO);
|
||||||
|
return success(filePage.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得电子档案附件")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')")
|
||||||
|
public CommonResult<ElectronicAttachmentRespVO> getElectronicAttachment(@RequestParam("id") Long id) {
|
||||||
|
ElectronicAttachmentDO electronicAttachment = electronicAttachmentService.getElectronicAttachment(id);
|
||||||
|
return success(ElectronicAttachmentConvert.INSTANCE.convert(electronicAttachment));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得电子档案附件列表")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')")
|
||||||
|
public CommonResult<List<ElectronicAttachmentRespVO>> getElectronicAttachmentList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
|
List<ElectronicAttachmentDO> list = electronicAttachmentService.getElectronicAttachmentList(ids);
|
||||||
|
return success(ElectronicAttachmentConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得电子档案附件分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:query')")
|
||||||
|
public CommonResult<PageResult<ElectronicAttachmentRespVO>> getElectronicAttachmentPage(@Valid ElectronicAttachmentPageReqVO pageVO) {
|
||||||
|
PageResult<ElectronicAttachmentDO> pageResult = electronicAttachmentService.getElectronicAttachmentPage(pageVO);
|
||||||
|
return success(ElectronicAttachmentConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出电子档案附件 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ea:electronic-attachment:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportElectronicAttachmentExcel(@Valid ElectronicAttachmentExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<ElectronicAttachmentDO> list = electronicAttachmentService.getElectronicAttachmentList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<ElectronicAttachmentExcelVO> datas = ElectronicAttachmentConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "电子档案附件.xls", "数据", ElectronicAttachmentExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 电子档案附件创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ElectronicAttachmentCreateReqVO extends ElectronicAttachmentBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 Excel VO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ElectronicAttachmentExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty("业务id")
|
||||||
|
private Long businessId;
|
||||||
|
|
||||||
|
@ExcelProperty("业务类型")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ExcelProperty("制单人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@ExcelProperty("删除状态")
|
||||||
|
private String delStatus;
|
||||||
|
|
||||||
|
@ExcelProperty("文件后缀")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
@ExcelProperty("文件地址")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@ExcelProperty("绝对路径")
|
||||||
|
private String fileAp;
|
||||||
|
|
||||||
|
@ExcelProperty("流程号")
|
||||||
|
private String flowCode;
|
||||||
|
|
||||||
|
@ExcelProperty("用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ExcelProperty("摘要")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@ExcelProperty("所属部门id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ExcelProperty("所属部门")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 电子档案附件分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ElectronicAttachmentPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "业务id", example = "23183")
|
||||||
|
private Long businessId;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", example = "1")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "制单人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体id", example = "23467")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@Schema(description = "删除状态", example = "2")
|
||||||
|
private String delStatus;
|
||||||
|
|
||||||
|
@Schema(description = "文件后缀")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@Schema(description = "绝对路径")
|
||||||
|
private String fileAp;
|
||||||
|
|
||||||
|
@Schema(description = "流程号")
|
||||||
|
private String flowCode;
|
||||||
|
|
||||||
|
@Schema(description = "用户id", example = "4434")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "摘要")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门id", example = "14022")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门", example = "芋艿")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 电子档案附件 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ElectronicAttachmentRespVO extends ElectronicAttachmentBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23298")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 电子档案附件更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ElectronicAttachmentUpdateReqVO extends ElectronicAttachmentBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23298")
|
||||||
|
@NotNull(message = "主键不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.convert.electronicattachment;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExcelVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentRespVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ElectronicAttachmentConvert {
|
||||||
|
|
||||||
|
ElectronicAttachmentConvert INSTANCE = Mappers.getMapper(ElectronicAttachmentConvert.class);
|
||||||
|
|
||||||
|
ElectronicAttachmentDO convert(ElectronicAttachmentCreateReqVO bean);
|
||||||
|
|
||||||
|
ElectronicAttachmentDO convert(ElectronicAttachmentUpdateReqVO bean);
|
||||||
|
|
||||||
|
ElectronicAttachmentRespVO convert(ElectronicAttachmentDO bean);
|
||||||
|
|
||||||
|
List<ElectronicAttachmentRespVO> convertList(List<ElectronicAttachmentDO> list);
|
||||||
|
|
||||||
|
PageResult<ElectronicAttachmentRespVO> convertPage(PageResult<ElectronicAttachmentDO> page);
|
||||||
|
|
||||||
|
List<ElectronicAttachmentExcelVO> convertList02(List<ElectronicAttachmentDO> list);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("ea_electronic_attachment")
|
||||||
|
@KeySequence("ea_electronic_attachment_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ElectronicAttachmentDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 业务id
|
||||||
|
*/
|
||||||
|
private Long businessId;
|
||||||
|
/**
|
||||||
|
* 业务类型
|
||||||
|
*/
|
||||||
|
private String businessType;
|
||||||
|
/**
|
||||||
|
* 制单人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 业务实体id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
/**
|
||||||
|
* 业务实体
|
||||||
|
*/
|
||||||
|
private String company;
|
||||||
|
/**
|
||||||
|
* 删除状态
|
||||||
|
*/
|
||||||
|
private String delStatus;
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String suffix;
|
||||||
|
/**
|
||||||
|
* 文件地址
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
/**
|
||||||
|
* 绝对路径
|
||||||
|
*/
|
||||||
|
private String fileAp;
|
||||||
|
/**
|
||||||
|
* 流程号
|
||||||
|
*/
|
||||||
|
private String flowCode;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 摘要
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 所属部门id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.dal.mysql.electronicattachment;
|
||||||
|
|
||||||
|
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.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ElectronicAttachmentMapper extends BaseMapperX<ElectronicAttachmentDO> {
|
||||||
|
|
||||||
|
default PageResult<ElectronicAttachmentDO> selectPage(ElectronicAttachmentPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicAttachmentDO>()
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getBusinessId, reqVO.getBusinessId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getBusinessType, reqVO.getBusinessType())
|
||||||
|
.betweenIfPresent(ElectronicAttachmentDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCreateBy, reqVO.getCreateBy())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getDelStatus, reqVO.getDelStatus())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getSuffix, reqVO.getSuffix())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFileUrl, reqVO.getFileUrl())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFileAp, reqVO.getFileAp())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFlowCode, reqVO.getFlowCode())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getNote, reqVO.getNote())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(ElectronicAttachmentDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.orderByDesc(ElectronicAttachmentDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<ElectronicAttachmentDO> selectList(ElectronicAttachmentExportReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<ElectronicAttachmentDO>()
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getBusinessId, reqVO.getBusinessId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getBusinessType, reqVO.getBusinessType())
|
||||||
|
.betweenIfPresent(ElectronicAttachmentDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCreateBy, reqVO.getCreateBy())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getDelStatus, reqVO.getDelStatus())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getSuffix, reqVO.getSuffix())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFileUrl, reqVO.getFileUrl())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFileAp, reqVO.getFileAp())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getFlowCode, reqVO.getFlowCode())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getNote, reqVO.getNote())
|
||||||
|
.eqIfPresent(ElectronicAttachmentDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(ElectronicAttachmentDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.orderByDesc(ElectronicAttachmentDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.service.electronicattachment;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface ElectronicAttachmentService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建电子档案附件
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createElectronicAttachment(@Valid ElectronicAttachmentCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新电子档案附件
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateElectronicAttachment(@Valid ElectronicAttachmentUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子档案附件
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteElectronicAttachment(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得电子档案附件
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 电子档案附件
|
||||||
|
*/
|
||||||
|
ElectronicAttachmentDO getElectronicAttachment(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得电子档案附件列表
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
* @return 电子档案附件列表
|
||||||
|
*/
|
||||||
|
List<ElectronicAttachmentDO> getElectronicAttachmentList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得电子档案附件分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 电子档案附件分页
|
||||||
|
*/
|
||||||
|
PageResult<ElectronicAttachmentDO> getElectronicAttachmentPage(ElectronicAttachmentPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得电子档案附件列表, 用于 Excel 导出
|
||||||
|
*
|
||||||
|
* @param exportReqVO 查询条件
|
||||||
|
* @return 电子档案附件列表
|
||||||
|
*/
|
||||||
|
List<ElectronicAttachmentDO> getElectronicAttachmentList(ElectronicAttachmentExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
package cn.iocoder.yudao.module.ea.service.electronicattachment;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.controller.admin.electronicattachment.vo.ElectronicAttachmentUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ea.convert.electronicattachment.ElectronicAttachmentConvert;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicattachment.ElectronicAttachmentDO;
|
||||||
|
import cn.iocoder.yudao.module.ea.dal.mysql.electronicattachment.ElectronicAttachmentMapper;
|
||||||
|
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.ea.enums.ErrorCodeConstants.ELECTRONIC_ATTACHMENT_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子档案附件 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ElectronicAttachmentServiceImpl implements ElectronicAttachmentService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ElectronicAttachmentMapper electronicAttachmentMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createElectronicAttachment(ElectronicAttachmentCreateReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
ElectronicAttachmentDO electronicAttachment = ElectronicAttachmentConvert.INSTANCE.convert(createReqVO);
|
||||||
|
electronicAttachmentMapper.insert(electronicAttachment);
|
||||||
|
// 返回
|
||||||
|
return electronicAttachment.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateElectronicAttachment(ElectronicAttachmentUpdateReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateElectronicAttachmentExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
ElectronicAttachmentDO updateObj = ElectronicAttachmentConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
electronicAttachmentMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteElectronicAttachment(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateElectronicAttachmentExists(id);
|
||||||
|
// 删除
|
||||||
|
electronicAttachmentMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateElectronicAttachmentExists(Long id) {
|
||||||
|
if (electronicAttachmentMapper.selectById(id) == null) {
|
||||||
|
throw exception(ELECTRONIC_ATTACHMENT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ElectronicAttachmentDO getElectronicAttachment(Long id) {
|
||||||
|
return electronicAttachmentMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ElectronicAttachmentDO> getElectronicAttachmentList(Collection<Long> ids) {
|
||||||
|
return electronicAttachmentMapper.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ElectronicAttachmentDO> getElectronicAttachmentPage(ElectronicAttachmentPageReqVO pageReqVO) {
|
||||||
|
return electronicAttachmentMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ElectronicAttachmentDO> getElectronicAttachmentList(ElectronicAttachmentExportReqVO exportReqVO) {
|
||||||
|
return electronicAttachmentMapper.selectList(exportReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue