电子档案-资产档案

new
parent 67ef100fe2
commit 2b8d5a6dfd

@ -25,6 +25,7 @@
<!-- <module>yudao-example</module>-->
<module>yudao-module-bs</module>
<module>yudao-module-archives</module>
<module>yudao-module-electronic</module>
</modules>
<name>${project.artifactId}</name>

@ -32,14 +32,15 @@ public abstract class BaseDO implements Serializable {
*
* 使 String
*/
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR,exist = false)
private String creator;
/**
* 使 SysUser id
*
* 使 String
*/
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR ,exist = false)
private String updater;
/**
*

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao</artifactId>
<version>1.7.3-snapshot</version>
</parent>
<artifactId>yudao-module-electronic</artifactId>
<packaging>pom</packaging>
<modules>
<module>yudao-module-ea-api</module>
<module>yudao-module-ea-biz</module>
</modules>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-archives-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-data-permission</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
</dependency>
<!-- 工具类相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-bpm-api</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-biz</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-electronic</artifactId>
<version>1.7.3-snapshot</version>
</parent>
<artifactId>yudao-module-ea-api</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

@ -0,0 +1,8 @@
package cn.iocoder.yudao.module.ea.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode ELECTRONIC_ASSETS_NOT_EXISTS = new ErrorCode(300010, "资产档案不存在");
}

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-electronic</artifactId>
<version>1.7.3-snapshot</version>
</parent>
<artifactId>yudao-module-ea-biz</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-ea-api</artifactId>
<version>1.7.3-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
import cn.iocoder.yudao.module.ea.convert.electronicassets.ElectronicAssetsConvert;
import cn.iocoder.yudao.module.ea.service.electronicassets.ElectronicAssetsService;
@Tag(name = "管理后台 - 资产档案")
@RestController
@RequestMapping("/ea/electronic")
@Validated
public class ElectronicAssetsController {
@Resource
private ElectronicAssetsService electronicAssetsService;
@PostMapping("/create")
@Operation(summary = "创建资产档案")
@PreAuthorize("@ss.hasPermission('ea:electronic:create')")
public CommonResult<Long> createElectronicAssets(@Valid @RequestBody ElectronicAssetsCreateReqVO createReqVO) {
return success(electronicAssetsService.createElectronicAssets(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新资产档案")
@PreAuthorize("@ss.hasPermission('ea:electronic:update')")
public CommonResult<Boolean> updateElectronicAssets(@Valid @RequestBody ElectronicAssetsUpdateReqVO updateReqVO) {
electronicAssetsService.updateElectronicAssets(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除资产档案")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('ea:electronic:delete')")
public CommonResult<Boolean> deleteElectronicAssets(@RequestParam("id") Long id) {
electronicAssetsService.deleteElectronicAssets(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得资产档案")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ea:electronic:query')")
public CommonResult<ElectronicAssetsRespVO> getElectronicAssets(@RequestParam("id") Long id) {
ElectronicAssetsDO electronicAssets = electronicAssetsService.getElectronicAssets(id);
return success(ElectronicAssetsConvert.INSTANCE.convert(electronicAssets));
}
@GetMapping("/list")
@Operation(summary = "获得资产档案列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('ea:electronic:query')")
public CommonResult<List<ElectronicAssetsRespVO>> getElectronicAssetsList(@RequestParam("ids") Collection<Long> ids) {
List<ElectronicAssetsDO> list = electronicAssetsService.getElectronicAssetsList(ids);
return success(ElectronicAssetsConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得资产档案分页")
@PreAuthorize("@ss.hasPermission('ea:electronic:query')")
public CommonResult<PageResult<ElectronicAssetsRespVO>> getElectronicAssetsPage(@Valid ElectronicAssetsPageReqVO pageVO) {
PageResult<ElectronicAssetsDO> pageResult = electronicAssetsService.getElectronicAssetsPage(pageVO);
return success(ElectronicAssetsConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出资产档案 Excel")
@PreAuthorize("@ss.hasPermission('ea:electronic:export')")
@OperateLog(type = EXPORT)
public void exportElectronicAssetsExcel(@Valid ElectronicAssetsExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<ElectronicAssetsDO> list = electronicAssetsService.getElectronicAssetsList(exportReqVO);
// 导出 Excel
List<ElectronicAssetsExcelVO> datas = ElectronicAssetsConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "资产档案.xls", "数据", ElectronicAssetsExcelVO.class, datas);
}
}

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class ElectronicAssetsBaseVO {
@Schema(description = "业务实体id", example = "5984")
private Long companyId;
@Schema(description = "业务实体名称")
private String company;
@Schema(description = "部门id", example = "32352")
private Long deptId;
@Schema(description = "部门名称", example = "芋艿")
private String deptName;
@Schema(description = "资产编号")
private String assetCode;
@Schema(description = "资产名称", example = "王五")
private String assetName;
@Schema(description = "资产描述", example = "你说的对")
private String assetDescription;
@Schema(description = "资产类型", example = "2")
private String assetType;
@Schema(description = "购买日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime purchaseDate;
@Schema(description = "报废日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime disposalDate;
@Schema(description = "资产状态", example = "1")
private String assetStatus;
@Schema(description = "资产价格", example = "21847")
private BigDecimal purchasePrice;
@Schema(description = "资产数量")
private Integer assetQuantity;
@Schema(description = "购买渠道")
private String purchaseChannel;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "2")
private String borrowStatus;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private String cherks;
@Schema(description = "归档id", example = "5964")
private Long recordId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsCreateReqVO extends ElectronicAssetsBaseVO {
}

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class ElectronicAssetsExcelVO {
@ExcelProperty("资产档案id")
private Long id;
@ExcelProperty("业务实体id")
private Long companyId;
@ExcelProperty("业务实体名称")
private String company;
@ExcelProperty("部门id")
private Long deptId;
@ExcelProperty("部门名称")
private String deptName;
@ExcelProperty("资产编号")
private String assetCode;
@ExcelProperty("资产名称")
private String assetName;
@ExcelProperty("资产描述")
private String assetDescription;
@ExcelProperty("资产类型")
private String assetType;
@ExcelProperty("购买日期")
private LocalDateTime purchaseDate;
@ExcelProperty("报废日期")
private LocalDateTime disposalDate;
@ExcelProperty("资产状态")
private String assetStatus;
@ExcelProperty("资产价格")
private BigDecimal purchasePrice;
@ExcelProperty("资产数量")
private Integer assetQuantity;
@ExcelProperty("购买渠道")
private String purchaseChannel;
@ExcelProperty("文件来源")
private String source;
@ExcelProperty("年度")
private String year;
@ExcelProperty("月份")
private String period;
@ExcelProperty("借阅状态")
private String borrowStatus;
@ExcelProperty("纸档位置")
private String position;
@ExcelProperty("完整性")
private String cherks;
@ExcelProperty("归档id")
private Long recordId;
@ExcelProperty("归档状态")
private String fileStatus;
@ExcelProperty("创建日期")
private LocalDateTime createTime;
@ExcelProperty("制单人")
private String createBy;
}

@ -0,0 +1,93 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 资产档案 Excel 导出 Request VO参数和 ElectronicAssetsPageReqVO 是一致的")
@Data
public class ElectronicAssetsExportReqVO {
@Schema(description = "业务实体id", example = "5984")
private Long companyId;
@Schema(description = "业务实体名称")
private String company;
@Schema(description = "部门id", example = "32352")
private Long deptId;
@Schema(description = "部门名称", example = "芋艿")
private String deptName;
@Schema(description = "资产编号")
private String assetCode;
@Schema(description = "资产名称", example = "王五")
private String assetName;
@Schema(description = "资产描述", example = "你说的对")
private String assetDescription;
@Schema(description = "资产类型", example = "2")
private String assetType;
@Schema(description = "购买日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] purchaseDate;
@Schema(description = "报废日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] disposalDate;
@Schema(description = "资产状态", example = "1")
private String assetStatus;
@Schema(description = "资产价格", example = "21847")
private BigDecimal purchasePrice;
@Schema(description = "资产数量")
private Integer assetQuantity;
@Schema(description = "购买渠道")
private String purchaseChannel;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "2")
private String borrowStatus;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private String cherks;
@Schema(description = "归档id", example = "5964")
private Long recordId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo;
import lombok.*;
import java.math.BigDecimal;
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 ElectronicAssetsPageReqVO extends PageParam {
@Schema(description = "业务实体id", example = "5984")
private Long companyId;
@Schema(description = "业务实体名称")
private String company;
@Schema(description = "部门id", example = "32352")
private Long deptId;
@Schema(description = "部门名称", example = "芋艿")
private String deptName;
@Schema(description = "资产编号")
private String assetCode;
@Schema(description = "资产名称", example = "王五")
private String assetName;
@Schema(description = "资产描述", example = "你说的对")
private String assetDescription;
@Schema(description = "资产类型", example = "2")
private String assetType;
@Schema(description = "购买日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] purchaseDate;
@Schema(description = "报废日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] disposalDate;
@Schema(description = "资产状态", example = "1")
private String assetStatus;
@Schema(description = "资产价格", example = "21847")
private BigDecimal purchasePrice;
@Schema(description = "资产数量")
private Integer assetQuantity;
@Schema(description = "购买渠道")
private String purchaseChannel;
@Schema(description = "文件来源")
private String source;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "2")
private String borrowStatus;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private String cherks;
@Schema(description = "归档id", example = "5964")
private Long recordId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "制单人")
private String createBy;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsRespVO extends ElectronicAssetsBaseVO {
@Schema(description = "资产档案id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17700")
private Long id;
@Schema(description = "创建日期")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.ea.controller.admin.electronicassets.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 ElectronicAssetsUpdateReqVO extends ElectronicAssetsBaseVO {
@Schema(description = "资产档案id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17700")
@NotNull(message = "资产档案id不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.ea.convert.electronicassets;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface ElectronicAssetsConvert {
ElectronicAssetsConvert INSTANCE = Mappers.getMapper(ElectronicAssetsConvert.class);
ElectronicAssetsDO convert(ElectronicAssetsCreateReqVO bean);
ElectronicAssetsDO convert(ElectronicAssetsUpdateReqVO bean);
ElectronicAssetsRespVO convert(ElectronicAssetsDO bean);
List<ElectronicAssetsRespVO> convertList(List<ElectronicAssetsDO> list);
PageResult<ElectronicAssetsRespVO> convertPage(PageResult<ElectronicAssetsDO> page);
List<ElectronicAssetsExcelVO> convertList02(List<ElectronicAssetsDO> list);
}

@ -0,0 +1,126 @@
package cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("ea_electronic_assets")
@KeySequence("ea_electronic_assets_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ElectronicAssetsDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* id
*/
private Long companyId;
/**
*
*/
private String company;
/**
* id
*/
private Long deptId;
/**
*
*/
private String deptName;
/**
*
*/
private String assetCode;
/**
*
*/
private String assetName;
/**
*
*/
private String assetDescription;
/**
*
*/
private String assetType;
/**
*
*/
private LocalDateTime purchaseDate;
/**
*
*/
private LocalDateTime disposalDate;
/**
*
*/
private String assetStatus;
/**
*
*/
private BigDecimal purchasePrice;
/**
*
*/
private Integer assetQuantity;
/**
*
*/
private String purchaseChannel;
/**
*
*/
private String source;
/**
*
*/
private String year;
/**
*
*/
private String period;
/**
*
*/
private String borrowStatus;
/**
*
*/
private String position;
/**
*
*/
private String cherks;
/**
* id
*/
private Long recordId;
/**
*
*/
private String fileStatus;
/**
*
*/
private String createBy;
}

@ -0,0 +1,78 @@
package cn.iocoder.yudao.module.ea.dal.mysql.electronicassets;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface ElectronicAssetsMapper extends BaseMapperX<ElectronicAssetsDO> {
default PageResult<ElectronicAssetsDO> selectPage(ElectronicAssetsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicAssetsDO>()
.eqIfPresent(ElectronicAssetsDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(ElectronicAssetsDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicAssetsDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(ElectronicAssetsDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicAssetsDO::getAssetCode, reqVO.getAssetCode())
.likeIfPresent(ElectronicAssetsDO::getAssetName, reqVO.getAssetName())
.eqIfPresent(ElectronicAssetsDO::getAssetDescription, reqVO.getAssetDescription())
.eqIfPresent(ElectronicAssetsDO::getAssetType, reqVO.getAssetType())
.betweenIfPresent(ElectronicAssetsDO::getPurchaseDate, reqVO.getPurchaseDate())
.betweenIfPresent(ElectronicAssetsDO::getDisposalDate, reqVO.getDisposalDate())
.eqIfPresent(ElectronicAssetsDO::getAssetStatus, reqVO.getAssetStatus())
.eqIfPresent(ElectronicAssetsDO::getPurchasePrice, reqVO.getPurchasePrice())
.eqIfPresent(ElectronicAssetsDO::getAssetQuantity, reqVO.getAssetQuantity())
.eqIfPresent(ElectronicAssetsDO::getPurchaseChannel, reqVO.getPurchaseChannel())
.eqIfPresent(ElectronicAssetsDO::getSource, reqVO.getSource())
.eqIfPresent(ElectronicAssetsDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicAssetsDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicAssetsDO::getBorrowStatus, reqVO.getBorrowStatus())
.eqIfPresent(ElectronicAssetsDO::getPosition, reqVO.getPosition())
.eqIfPresent(ElectronicAssetsDO::getCherks, reqVO.getCherks())
.eqIfPresent(ElectronicAssetsDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(ElectronicAssetsDO::getFileStatus, reqVO.getFileStatus())
.betweenIfPresent(ElectronicAssetsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicAssetsDO::getCreateBy, reqVO.getCreateBy())
.orderByDesc(ElectronicAssetsDO::getId));
}
default List<ElectronicAssetsDO> selectList(ElectronicAssetsExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ElectronicAssetsDO>()
.eqIfPresent(ElectronicAssetsDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(ElectronicAssetsDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicAssetsDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(ElectronicAssetsDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicAssetsDO::getAssetCode, reqVO.getAssetCode())
.likeIfPresent(ElectronicAssetsDO::getAssetName, reqVO.getAssetName())
.eqIfPresent(ElectronicAssetsDO::getAssetDescription, reqVO.getAssetDescription())
.eqIfPresent(ElectronicAssetsDO::getAssetType, reqVO.getAssetType())
.betweenIfPresent(ElectronicAssetsDO::getPurchaseDate, reqVO.getPurchaseDate())
.betweenIfPresent(ElectronicAssetsDO::getDisposalDate, reqVO.getDisposalDate())
.eqIfPresent(ElectronicAssetsDO::getAssetStatus, reqVO.getAssetStatus())
.eqIfPresent(ElectronicAssetsDO::getPurchasePrice, reqVO.getPurchasePrice())
.eqIfPresent(ElectronicAssetsDO::getAssetQuantity, reqVO.getAssetQuantity())
.eqIfPresent(ElectronicAssetsDO::getPurchaseChannel, reqVO.getPurchaseChannel())
.eqIfPresent(ElectronicAssetsDO::getSource, reqVO.getSource())
.eqIfPresent(ElectronicAssetsDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicAssetsDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicAssetsDO::getBorrowStatus, reqVO.getBorrowStatus())
.eqIfPresent(ElectronicAssetsDO::getPosition, reqVO.getPosition())
.eqIfPresent(ElectronicAssetsDO::getCherks, reqVO.getCherks())
.eqIfPresent(ElectronicAssetsDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(ElectronicAssetsDO::getFileStatus, reqVO.getFileStatus())
.betweenIfPresent(ElectronicAssetsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicAssetsDO::getCreateBy, reqVO.getCreateBy())
.orderByDesc(ElectronicAssetsDO::getId));
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.ea.service.electronicassets;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface ElectronicAssetsService {
/**
*
*
* @param createReqVO
* @return
*/
Long createElectronicAssets(@Valid ElectronicAssetsCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateElectronicAssets(@Valid ElectronicAssetsUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteElectronicAssets(Long id);
/**
*
*
* @param id
* @return
*/
ElectronicAssetsDO getElectronicAssets(Long id);
/**
*
*
* @param ids
* @return
*/
List<ElectronicAssetsDO> getElectronicAssetsList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ElectronicAssetsDO> getElectronicAssetsPage(ElectronicAssetsPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<ElectronicAssetsDO> getElectronicAssetsList(ElectronicAssetsExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.ea.service.electronicassets;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.ea.controller.admin.electronicassets.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electronicassets.ElectronicAssetsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ea.convert.electronicassets.ElectronicAssetsConvert;
import cn.iocoder.yudao.module.ea.dal.mysql.electronicassets.ElectronicAssetsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.ea.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class ElectronicAssetsServiceImpl implements ElectronicAssetsService {
@Resource
private ElectronicAssetsMapper electronicAssetsMapper;
@Override
public Long createElectronicAssets(ElectronicAssetsCreateReqVO createReqVO) {
// 插入
ElectronicAssetsDO electronicAssets = ElectronicAssetsConvert.INSTANCE.convert(createReqVO);
electronicAssetsMapper.insert(electronicAssets);
// 返回
return electronicAssets.getId();
}
@Override
public void updateElectronicAssets(ElectronicAssetsUpdateReqVO updateReqVO) {
// 校验存在
validateElectronicAssetsExists(updateReqVO.getId());
// 更新
ElectronicAssetsDO updateObj = ElectronicAssetsConvert.INSTANCE.convert(updateReqVO);
electronicAssetsMapper.updateById(updateObj);
}
@Override
public void deleteElectronicAssets(Long id) {
// 校验存在
validateElectronicAssetsExists(id);
// 删除
electronicAssetsMapper.deleteById(id);
}
private void validateElectronicAssetsExists(Long id) {
if (electronicAssetsMapper.selectById(id) == null) {
throw exception(ELECTRONIC_ASSETS_NOT_EXISTS);
}
}
@Override
public ElectronicAssetsDO getElectronicAssets(Long id) {
return electronicAssetsMapper.selectById(id);
}
@Override
public List<ElectronicAssetsDO> getElectronicAssetsList(Collection<Long> ids) {
return electronicAssetsMapper.selectBatchIds(ids);
}
@Override
public PageResult<ElectronicAssetsDO> getElectronicAssetsPage(ElectronicAssetsPageReqVO pageReqVO) {
return electronicAssetsMapper.selectPage(pageReqVO);
}
@Override
public List<ElectronicAssetsDO> getElectronicAssetsList(ElectronicAssetsExportReqVO exportReqVO) {
return electronicAssetsMapper.selectList(exportReqVO);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ea.dal.mysql.electronicassets.ElectronicAssetsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -112,6 +112,12 @@
<artifactId>yudao-spring-boot-starter-protection</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-ea-biz</artifactId>
<version>1.7.3-snapshot</version>
</dependency>
</dependencies>
<build>

Loading…
Cancel
Save