diff --git a/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java b/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java index 5c4180f..e932c63 100644 --- a/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java +++ b/yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java @@ -12,4 +12,7 @@ public interface ErrorCodeConstants { // ========== Fta 企业信息(1-040-100-000) ========== ErrorCode ENTERPRISE_INFORMATION_NOT_EXISTS = new ErrorCode(1_040_100_000, "企业信息不存在"); + // ========== 企业证件 (1-041-100-000) ========== + ErrorCode CREDENTIAL_MANAGEMENT_NOT_EXISTS = new ErrorCode(1-041-100-000, "企业证件不存在"); + } diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/CredentialManagementController.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/CredentialManagementController.java new file mode 100644 index 0000000..20c77ad --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/CredentialManagementController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementRespVO; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO; +import cn.iocoder.yudao.module.fta.service.enterpriseinformation.CredentialManagementService; +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.*; +import javax.servlet.http.*; +import java.io.IOException; +import java.util.List; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 企业证件") +@RestController +@RequestMapping("/fta/credential-management") +@Validated +public class CredentialManagementController { + + @Resource + private CredentialManagementService credentialManagementService; + + @PostMapping("/create") + @Operation(summary = "创建企业证件") + @PreAuthorize("@ss.hasPermission('fta:credential-management:create')") + public CommonResult createCredentialManagement(@Valid @RequestBody CredentialManagementSaveReqVO createReqVO) { + return success(credentialManagementService.createCredentialManagement(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业证件") + @PreAuthorize("@ss.hasPermission('fta:credential-management:update')") + public CommonResult updateCredentialManagement(@Valid @RequestBody CredentialManagementSaveReqVO updateReqVO) { + credentialManagementService.updateCredentialManagement(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除企业证件") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('fta:credential-management:delete')") + public CommonResult deleteCredentialManagement(@RequestParam("id") Long id) { + credentialManagementService.deleteCredentialManagement(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得企业证件") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('fta:credential-management:query')") + public CommonResult getCredentialManagement(@RequestParam("id") Long id) { + CredentialManagementDO credentialManagement = credentialManagementService.getCredentialManagement(id); + return success(BeanUtils.toBean(credentialManagement, CredentialManagementRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得企业证件分页") + @PreAuthorize("@ss.hasPermission('fta:credential-management:query')") + public CommonResult> getCredentialManagementPage(@Valid CredentialManagementPageReqVO pageReqVO) { + PageResult pageResult = credentialManagementService.getCredentialManagementPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, CredentialManagementRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出企业证件 Excel") + @PreAuthorize("@ss.hasPermission('fta:credential-management:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportCredentialManagementExcel(@Valid CredentialManagementPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = credentialManagementService.getCredentialManagementPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业证件.xls", "数据", CredentialManagementRespVO.class, + BeanUtils.toBean(list, CredentialManagementRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementPageReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementPageReqVO.java new file mode 100644 index 0000000..d1515c6 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementPageReqVO.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo; + +import lombok.*; +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 java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; +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 CredentialManagementPageReqVO extends PageParam { + + @Schema(description = "企业id", example = "13133") + private String informationId; + + @Schema(description = "经营方式") + private String businessPattern; + + @Schema(description = "有效期限") + private String usefulLife; + + @Schema(description = "发证机关") + private String licenceIssuingAuthority; + + @Schema(description = "发证日期") + private LocalDateTime dateOfIssue; + + @Schema(description = "流程状态", example = "1") + private String status; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "到期时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) + private Date[] expiryDate; + + @Schema(description = "证件类型(0安全员证,1安全负责人证,2危险品证)", example = "2") + private Boolean idType; + + @Schema(description = "证书编号") + private String certificateNumber; + + @Schema(description = "姓名", example = "王五") + private String name; + + @Schema(description = "人员类型", example = "2") + private String personnelType; + + @Schema(description = "性别(0男,1女)") + private Boolean sex; + + @Schema(description = "行业类别") + private String categoryOfEmployment; + + @Schema(description = "企业名称", example = "芋艿") + private String enterpriseName; + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementRespVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementRespVO.java new file mode 100644 index 0000000..1dc7fd6 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementRespVO.java @@ -0,0 +1,80 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 企业证件 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CredentialManagementRespVO { + + @Schema(description = "企业id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13133") + @ExcelProperty("企业id") + private String informationId; + + @Schema(description = "经营方式") + @ExcelProperty("经营方式") + private String businessPattern; + + @Schema(description = "有效期限") + @ExcelProperty("有效期限") + private String usefulLife; + + @Schema(description = "发证机关") + @ExcelProperty("发证机关") + private String licenceIssuingAuthority; + + @Schema(description = "发证日期") + @ExcelProperty("发证日期") + private LocalDateTime dateOfIssue; + + @Schema(description = "流程状态", example = "1") + @ExcelProperty("流程状态") + private String status; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23598") + @ExcelProperty("id") + private Long id; + + @Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("到期时间") + private Date expiryDate; + + @Schema(description = "证件类型(0安全员证,1安全负责人证,2危险品证)", example = "2") + @ExcelProperty("证件类型(0安全员证,1安全负责人证,2危险品证)") + private Boolean idType; + + @Schema(description = "证书编号") + @ExcelProperty("证书编号") + private String certificateNumber; + + @Schema(description = "姓名", example = "王五") + @ExcelProperty("姓名") + private String name; + + @Schema(description = "人员类型", example = "2") + @ExcelProperty("人员类型") + private String personnelType; + + @Schema(description = "性别(0男,1女)") + @ExcelProperty("性别(0男,1女)") + private Boolean sex; + + @Schema(description = "行业类别") + @ExcelProperty("行业类别") + private String categoryOfEmployment; + + @Schema(description = "企业名称", example = "芋艿") + @ExcelProperty("企业名称") + private String enterpriseName; + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementSaveReqVO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementSaveReqVO.java new file mode 100644 index 0000000..b80c499 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/controller/admin/enterpriseinformation/vo/CredentialManagementSaveReqVO.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +import java.time.LocalDateTime; +import java.util.Date; + +@Schema(description = "管理后台 - 企业证件新增/修改 Request VO") +@Data +public class CredentialManagementSaveReqVO { + + @Schema(description = "企业id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13133") + @NotEmpty(message = "企业id不能为空") + private String informationId; + + @Schema(description = "经营方式") + private String businessPattern; + + @Schema(description = "有效期限") + private String usefulLife; + + @Schema(description = "发证机关") + private String licenceIssuingAuthority; + + @Schema(description = "发证日期") + private LocalDateTime dateOfIssue; + + @Schema(description = "流程状态", example = "1") + private String status; + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23598") + private Long id; + + @Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "到期时间不能为空") + private Date expiryDate; + + @Schema(description = "证件类型(0安全员证,1安全负责人证,2危险品证)", example = "2") + private Boolean idType; + + @Schema(description = "证书编号") + private String certificateNumber; + + @Schema(description = "姓名", example = "王五") + private String name; + + @Schema(description = "人员类型", example = "2") + private String personnelType; + + @Schema(description = "性别(0男,1女)") + private Boolean sex; + + @Schema(description = "行业类别") + private String categoryOfEmployment; + + @Schema(description = "企业名称", example = "芋艿") + private String enterpriseName; + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java new file mode 100644 index 0000000..3d60386 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/dataobject/enterpriseinformation/CredentialManagementDO.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 企业证件 DO + * + * @author xue + */ +@TableName("fta_credential_management") +@KeySequence("fta_credential_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CredentialManagementDO extends BaseDO { + + /** + * 企业id + */ + private String informationId; + /** + * 经营方式 + */ + private String businessPattern; + /** + * 有效期限 + */ + private String usefulLife; + /** + * 发证机关 + */ + private String licenceIssuingAuthority; + /** + * 发证日期 + */ + private LocalDateTime dateOfIssue; + /** + * 流程状态 + */ + private String status; + /** + * id + */ + @TableId + private Long id; + /** + * 到期时间 + */ + private Date expiryDate; + /** + * 证件类型(0安全员证,1安全负责人证,2危险品证) + */ + private Boolean idType; + /** + * 证书编号 + */ + private String certificateNumber; + /** + * 姓名 + */ + private String name; + /** + * 人员类型 + */ + private String personnelType; + /** + * 性别(0男,1女) + */ + private Boolean sex; + /** + * 行业类别 + */ + private String categoryOfEmployment; + /** + * 企业名称 + */ + private String enterpriseName; + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/CredentialManagementMapper.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/CredentialManagementMapper.java new file mode 100644 index 0000000..2a779dd --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/CredentialManagementMapper.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation; + +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.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO; +import org.apache.ibatis.annotations.Mapper; + + +/** + * 企业证件 Mapper + * + * @author xue + */ +@Mapper +public interface CredentialManagementMapper extends BaseMapperX { + + default PageResult selectPage(CredentialManagementPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(CredentialManagementDO::getInformationId, reqVO.getInformationId()) + .eqIfPresent(CredentialManagementDO::getBusinessPattern, reqVO.getBusinessPattern()) + .eqIfPresent(CredentialManagementDO::getUsefulLife, reqVO.getUsefulLife()) + .eqIfPresent(CredentialManagementDO::getLicenceIssuingAuthority, reqVO.getLicenceIssuingAuthority()) + .eqIfPresent(CredentialManagementDO::getDateOfIssue, reqVO.getDateOfIssue()) + .eqIfPresent(CredentialManagementDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(CredentialManagementDO::getCreateTime, reqVO.getCreateTime()) + .betweenIfPresent(CredentialManagementDO::getExpiryDate,reqVO.getExpiryDate()) + .eqIfPresent(CredentialManagementDO::getIdType, reqVO.getIdType()) + .eqIfPresent(CredentialManagementDO::getCertificateNumber, reqVO.getCertificateNumber()) + .likeIfPresent(CredentialManagementDO::getName, reqVO.getName()) + .eqIfPresent(CredentialManagementDO::getPersonnelType, reqVO.getPersonnelType()) + .eqIfPresent(CredentialManagementDO::getSex, reqVO.getSex()) + .eqIfPresent(CredentialManagementDO::getCategoryOfEmployment, reqVO.getCategoryOfEmployment()) + .likeIfPresent(CredentialManagementDO::getEnterpriseName, reqVO.getEnterpriseName()) + .orderByDesc(CredentialManagementDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java index abef2c2..bf53477 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/dal/mysql/enterpriseinformation/EnterpriseInformationMapper.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation; -import java.util.*; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementService.java new file mode 100644 index 0000000..a39fb9e --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementService.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.fta.service.enterpriseinformation; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO; + + +import javax.validation.*; + + +/** + * 企业证件 Service 接口 + * + * @author xue + */ +public interface CredentialManagementService { + + /** + * 创建企业证件 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createCredentialManagement(@Valid CredentialManagementSaveReqVO createReqVO); + + /** + * 更新企业证件 + * + * @param updateReqVO 更新信息 + */ + void updateCredentialManagement(@Valid CredentialManagementSaveReqVO updateReqVO); + + /** + * 删除企业证件 + * + * @param id 编号 + */ + void deleteCredentialManagement(Long id); + + /** + * 获得企业证件 + * + * @param id 编号 + * @return 企业证件 + */ + CredentialManagementDO getCredentialManagement(Long id); + + /** + * 获得企业证件分页 + * + * @param pageReqVO 分页查询 + * @return 企业证件分页 + */ + PageResult getCredentialManagementPage(CredentialManagementPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementServiceImpl.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementServiceImpl.java new file mode 100644 index 0000000..7d120c0 --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/CredentialManagementServiceImpl.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.fta.service.enterpriseinformation; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO; +import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO; +import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO; +import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.CredentialManagementMapper; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*; + +/** + * 企业证件 Service 实现类 + * + * @author xue + */ +@Service +@Validated +public class CredentialManagementServiceImpl implements CredentialManagementService { + + @Resource + private CredentialManagementMapper credentialManagementMapper; + + @Override + public Long createCredentialManagement(CredentialManagementSaveReqVO createReqVO) { + // 插入 + CredentialManagementDO credentialManagement = BeanUtils.toBean(createReqVO, CredentialManagementDO.class); + credentialManagementMapper.insert(credentialManagement); + // 返回 + return credentialManagement.getId(); + } + + @Override + public void updateCredentialManagement(CredentialManagementSaveReqVO updateReqVO) { + // 校验存在 + validateCredentialManagementExists(updateReqVO.getId()); + // 更新 + CredentialManagementDO updateObj = BeanUtils.toBean(updateReqVO, CredentialManagementDO.class); + credentialManagementMapper.updateById(updateObj); + } + + @Override + public void deleteCredentialManagement(Long id) { + // 校验存在 + validateCredentialManagementExists(id); + // 删除 + credentialManagementMapper.deleteById(id); + } + + private void validateCredentialManagementExists(Long id) { + if (credentialManagementMapper.selectById(id) == null) { + throw exception(CREDENTIAL_MANAGEMENT_NOT_EXISTS); + } + } + + @Override + public CredentialManagementDO getCredentialManagement(Long id) { + return credentialManagementMapper.selectById(id); + } + + @Override + public PageResult getCredentialManagementPage(CredentialManagementPageReqVO pageReqVO) { + return credentialManagementMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java index 29aae05..443d674 100644 --- a/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/java/cn/iocoder/yudao/module/fta/service/enterpriseinformation/EnterpriseInformationService.java @@ -1,11 +1,9 @@ package cn.iocoder.yudao.module.fta.service.enterpriseinformation; -import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; /** * 企业信息 Service 接口 diff --git a/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterpriseinformation/CredentialManagementMapper.xml b/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterpriseinformation/CredentialManagementMapper.xml new file mode 100644 index 0000000..9d537dc --- /dev/null +++ b/yudao-module-fta/yudao-module-fta-biz/src/main/resources/mapper/enterpriseinformation/CredentialManagementMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file