Browse Source

优化生成code

master
PoffyZhang 1 year ago
parent
commit
b941cad958
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -40,7 +40,8 @@ public class GenerateProjectCodeUtil {
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001 // 16-20 项目序号00001
Long max = projectService.count(Wrappers.lambdaQuery(Project.class) Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear()));
.eq(Project::getProjectYear,project.getProjectYear())
.eq(Project::getNewest,Boolean.TRUE));
Long maxCurrent = max + 1; Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent); String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号 // 生成20位的项目编号
@@ -57,7 +58,8 @@ public class GenerateProjectCodeUtil {
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001 // 16-20 项目序号00001
Long max = projectService.count(Wrappers.lambdaQuery(Project.class) Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear()));
.eq(Project::getProjectYear,project.getProjectYear())
.eq(Project::getNewest,Boolean.TRUE));
Long maxCurrent = max + 1; Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent); String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号 // 生成20位的项目编号


Loading…
Cancel
Save