提交 e94aa881 编写于 作者: sq3536's avatar sq3536

remove lic

上级 8f1ba4d6
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen;
import cn.ibizlab.codegen.cmd.*;
......@@ -26,11 +9,6 @@ import cn.ibizlab.codegen.cmd.*;
import java.util.Locale;
/**
* User: lanwen Date: 24.03.15 Time: 17:56
* <p>
* Command line interface for OpenAPI Generator use `openapi-generator-cli.jar help` for more info
*/
public class IbizLabGenerator {
public static void main(String[] args) {
......
......@@ -31,7 +31,7 @@ public class BuildInfo {
}
} catch (IOException ignored) {
}
try (InputStream is = BuildInfo.class.getResourceAsStream("/openapi-generator-git.properties")) {
try (InputStream is = BuildInfo.class.getResourceAsStream("/ibizlab-generator-git.properties")) {
if (is != null) {
Properties gitProps = new Properties();
gitProps.load(is);
......
/*
* Copyright (C) 2010 the original author or authors.
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* NOTICE: File originally taken from:
* https://github.com/airlift/airline/blob/fc7a55e34b6361cb97235de5a1b21cba9b508f4b/src/main/java/io/airlift/airline/SuggestCommand.java#L1
* Modifications have been made to fit the needs of OpenAPI Tools CLI.
*/
package cn.ibizlab.codegen.cmd;
import com.google.common.annotations.VisibleForTesting;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.cmd;
import cn.ibizlab.codegen.CodegenConstants;
......@@ -48,7 +31,7 @@ public class Generate extends IbizLabGeneratorCommand {
private String output = "";
@Option(name = {"-i", "--input-spec"}, title = "spec file",
description = "location of the OpenAPI spec, as URL or file (required if not loaded via config using -c)")
description = "location of the ibizlab-Model spec, as URL or file (required if not loaded via config using -c)")
private String spec;
@Option(name = {"-t", "--template-dir"}, title = "template directory",
......@@ -59,7 +42,7 @@ public class Generate extends IbizLabGeneratorCommand {
@Option(
name = {"-a", "--auth"},
title = "authorization",
description = "adds authorization headers when fetching the OpenAPI definitions remotely. "
description = "adds authorization headers when fetching the definitions remotely. "
+ "Pass in a URL-encoded string of name:header with a comma separating multiple values")
private String auth;
......@@ -148,7 +131,7 @@ public class Generate extends IbizLabGeneratorCommand {
if (isNotEmpty(spec)) {
if (!spec.matches("^http(s)?://.*") && !new File(spec).exists()) {
System.err.println("[error] The spec file is not found: " + spec);
System.err.println("[error] Check the path of the OpenAPI spec and try again.");
System.err.println("[error] Check the path of the ibizlab-Model spec and try again.");
System.exit(1);
}
configurator.setInputSpec(spec);
......
......@@ -5,7 +5,7 @@ import io.airlift.airline.Help;
import javax.inject.Inject;
@Command(name = "help", description = "Display help information about openapi-generator")
@Command(name = "help", description = "Display help information about ibizlab-generator")
public class HelpCommand extends IbizLabGeneratorCommand {
@Inject
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.cmd;
import io.airlift.airline.Command;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen;
import cn.ibizlab.codegen.config.GlobalSettings;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen;
/**
......@@ -256,16 +239,16 @@ public class CodegenConstants {
public static final String GIT_HOST_DESC = "Git host, e.g. gitlab.com.";
public static final String GIT_USER_ID = "gitUserId";
public static final String GIT_USER_ID_DESC = "Git user ID, e.g. openapitools.";
public static final String GIT_USER_ID_DESC = "Git user ID, e.g. ibizlabtools.";
public static final String GIT_REPO_ID = "gitRepoId";
public static final String GIT_REPO_ID_DESC = "Git repo ID, e.g. openapi-generator.";
public static final String GIT_REPO_ID_DESC = "Git repo ID, e.g. ibizlab-generator.";
public static final String RELEASE_NOTE = "releaseNote";
public static final String RELEASE_NOTE_DESC = "Release note, default to 'Minor update'.";
public static final String HTTP_USER_AGENT = "httpUserAgent";
public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'";
public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'iBizLab-Generator/{packageVersion}/{language}'";
public static final String SUPPORTS_ES6 = "supportsES6";
public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6.";
......@@ -316,7 +299,7 @@ public class CodegenConstants {
public static final String VALIDATABLE_DESC = "Generates self-validatable models.";
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.";
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .ibizlab-generator-ignore file. Most useful on initial generation.";
public static final String REMOVE_OPERATION_ID_PREFIX = "removeOperationIdPrefix";
public static final String REMOVE_OPERATION_ID_PREFIX_DESC = "Remove prefix of operationId, e.g. config_getId => getId";
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen;
import cn.ibizlab.codegen.ignore.CodegenIgnoreProcessor;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.config;
import cn.ibizlab.codegen.CodegenConfig;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.config;
import cn.ibizlab.codegen.utils.OptionUtils;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.config;
import cn.ibizlab.codegen.model.PojoOption;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore;
import cn.ibizlab.codegen.ignore.rules.DirectoryRule;
......@@ -30,9 +13,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
/**
* Presents a processing utility for parsing and evaluating files containing common ignore patterns. (.openapi-generator-ignore)
*/
public class CodegenIgnoreProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(CodegenIgnoreProcessor.class);
......@@ -86,7 +67,7 @@ public class CodegenIgnoreProcessor {
return processor;
}
}
LOGGER.info("Output directory ({}) does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.", baseDirectorys);
LOGGER.info("Output directory ({}) does not exist, or is inaccessible. No file (.ibizlab-generator-ignore) will be evaluated.", baseDirectorys);
return new CodegenIgnoreProcessor();
}
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.nio.file.FileSystems;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.util.List;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.nio.file.FileSystems;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.util.ArrayList;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.util.List;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
public class ParserException extends Exception {
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
class Part {
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.util.List;
import java.util.regex.Pattern;
/**
* A special case rule which matches files only if they're located
* in the same directory as the .openapi-generator-ignore file.
*/
public class RootedFileRule extends Rule {
private String definedFilename = null;
private String definedExtension = null;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.ignore.rules;
import java.util.List;
......
......@@ -21,6 +21,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@Getter
@Setter
......@@ -293,15 +294,25 @@ public class EntityModel extends BaseModel {
}
private List<DEActionModel> actions;
private Map<String,DEActionModel> actions;
public EntityModel addAction(DEActionModel action)
{
if(actions==null)
actions=new ArrayList<>();
actions.add(action);
actions=new LinkedHashMap<>();
actions.put(action.getCodeName().toCamelCase(),action);
return this;
}
private static Set<String> ignoActions=new HashSet<String>(){{
add("get");add("create");add("update");add("remove");add("save");add("getdraft");add("checkkey");
add("createbatch");add("savebatch");add("updatebatch");add("removebatch");
}};
public List<DEActionModel> getExtActions()
{
return actions.values().stream().filter(s->!ignoActions.contains(s.getCodeName().toLowerCase())).collect(Collectors.toList());
}
public String getDsName()
{
......@@ -440,7 +451,7 @@ public class EntityModel extends BaseModel {
for(IPSDERBase der : dataEntity.getMinorPSDERs())
{
RelationshipModel rel=new RelationshipModel(this,der);
rel.setRelationType(der.getDERType()).setCodeName(der.getCodeName()).setEntityId(der.getMajorPSDataEntity().getId())
rel.setRelationType("reference").setCodeName(der.getCodeName()).setEntityId(der.getMajorPSDataEntity().getId())
.setEntityCodeName(der.getMajorPSDataEntity().getCodeName()).setEntityName(der.getMajorPSDataEntity().getName())
.setEntityLogicName(der.getMajorPSDataEntity().getLogicName()).setTableName(der.getMajorPSDataEntity().getTableName());
if(der.getMajorPSDataEntity().getPSSystemModule()!=null)
......@@ -490,7 +501,7 @@ public class EntityModel extends BaseModel {
codeName=der.getMinorPSDataEntity().getCodeName();
RelationshipModel rel=new RelationshipModel(this,der);
rel.setRelationType(der.getDERType()).setCodeName(codeName).setEntityId(der.getMinorPSDataEntity().getId())
rel.setRelationType("nested").setCodeName(codeName).setEntityId(der.getMinorPSDataEntity().getId())
.setEntityCodeName(der.getMinorPSDataEntity().getCodeName()).setEntityName(der.getMinorPSDataEntity().getName())
.setEntityLogicName(der.getMinorPSDataEntity().getLogicName()).setTableName(der.getMinorPSDataEntity().getTableName());
......@@ -502,7 +513,7 @@ public class EntityModel extends BaseModel {
rel.setColumnName(der1n.getPSOne2ManyDataDEField().getName().toLowerCase());
}
rel.setFkFieldCodeName(der1n.getPSPickupDEField().getCodeName());
String relfieldname=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
LookupModel lookupModel=new LookupModel().setRelationid(der.getId())
......@@ -555,8 +566,10 @@ public class EntityModel extends BaseModel {
if(relationshipModel!=null&&(!StringUtils.isEmpty(relationshipModel.getCodeName()))) {
relationshipModel.addField(fieldModel);
fieldModel.setReference(relationshipModel);
if("PICKUP".equalsIgnoreCase(defield.getDataType()))
if("PICKUP".equalsIgnoreCase(defield.getDataType())) {
relationshipModel.setFkField(fieldModel);
relationshipModel.setFkFieldCodeName(fieldModel.getCodeName().toString());
}
}
}
......@@ -755,26 +768,12 @@ public class EntityModel extends BaseModel {
}
}
Set<String> ignoActions=new HashSet<String>(){{
add("get");
add("create");
add("update");
add("remove");
add("save");
add("getdraft");
add("checkkey");
add("createbatch");
add("savebatch");
add("updatebatch");
add("removebatch");
}};
if(this.getDataEntity().getAllPSDEActions()!=null)
{
this.getDataEntity().getAllPSDEActions().forEach(item->{
String tag=item.getCodeName().toLowerCase();
if(ignoActions.contains(tag))
return;
addAction(new DEActionModel(this,item));
});
}
......
......@@ -60,7 +60,6 @@ public class RelationshipModel extends BaseModel{
private String relationType;
private boolean nested;
public String getListCode()
{
......@@ -89,6 +88,24 @@ public class RelationshipModel extends BaseModel{
private FieldModel fkField;
private String fkFieldCodeName;
public FieldModel getFkField()
{
if(fkField==null&&(!StringUtils.isEmpty(fkFieldCodeName)))
{
if("nested".equalsIgnoreCase(this.relationType)&&relEntity!=null)
{
fkField=relEntity.getFieldMap().get(fkFieldCodeName);
}
else if(ownerEntity!=null)
{
fkField=ownerEntity.getFieldMap().get(fkFieldCodeName);
}
}
return fkField;
}
private List<LookupModel> lookup;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating;
import java.util.Locale;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating;
import cn.ibizlab.codegen.templating.handlebars.BaseModelValueResolver;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating;
import com.samskivert.mustache.Escapers;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating;
import java.io.FileInputStream;
......
/*
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.utils.StringAdvUtils;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.CodegenConfig;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.CodegenConfig;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.CodegenConfig;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.utils.StringAdvUtils;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.templating.mustache;
import com.samskivert.mustache.Mustache;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.utils;
import org.commonmark.node.Node;
......
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ibizlab.codegen.utils;
import org.apache.commons.lang3.tuple.Pair;
......
......@@ -41,38 +41,37 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
public class {{entity.codeName}} extends EntityMP implements Serializable
{
{{#entity.fields}}
{{^deepStructure}}
{{#each entity.fields}}
{{#unless deepStructure}}
/**
* {{logicName}}
*/
{{#keyDEField}}
{{#phisicalDEField}}
{{#if keyDEField}}
{{#phisicalDEField}}
@TableId(value = "{{columnName}}"{{#type.number}} , type = IdType.ASSIGN_ID{{/type.number}}{{#type.string}} , type = IdType.ASSIGN_UUID{{/type.string}})
{{/phisicalDEField}}
{{/keyDEField}}
{{^keyDEField}}
{{/phisicalDEField}}
{{else}}
@TableField(value = "{{columnName}}"{{#insertOnly}} , fill = FieldFill.INSERT{{/insertOnly}}{{^phisicalDEField}} , exist = false{{/phisicalDEField}})
{{#logicValidField}}
{{#logicValidField}}
@TableLogic{{#validLogicValue}}(value = "{{validLogicValue}}"{{#invalidLogicValue}} , delval = "{{invalidLogicValue}}"{{/invalidLogicValue}}){{/validLogicValue}}
{{/logicValidField}}
{{/keyDEField}}
{{#enableAudit}}
{{/logicValidField}}
{{/if}}
{{#enableAudit}}
@Audit
{{/enableAudit}}
@Defield({{annotation}})
{{/enableAudit}}
@DEField({{annotation}})
@JsonProperty("{{jsonName}}")
{{#timeType}}
{{#timeType}}
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
{{/timeType}}
{{/timeType}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
@ApiModelProperty("{{logicName}}")
private {{type.java}} {{codeName.camelCase}};
{{/deepStructure}}
{{/entity.fields}}
{{/unless}}
{{/each}}
{{#entity.references}}
{{#each entity.references}}
/**
* {{entityLogicName}}
*/
......@@ -80,33 +79,31 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JSONField(serialize = false)
@TableField(exist = false)
private {{packageName}}.core.{{module}}.domain.{{entityCodeName}} {{codeName.camelCase}};
{{/entity.references}}
{{/each}}
{{#entity.nesteds}}
{{#each entity.nesteds}}
/**
* {{entityLogicName}}
*/
{{#listCode}}
{{#if listCode}}
@JSONField(name = "{{listCode}}")
@JsonProperty("{{listCode}}")
{{/listCode}}
{{^listCode}}
{{else}}
@JsonIgnore
@JSONField(serialize = false)
{{/listCode}}
{{#columnName}}
{{/if}}
{{#if columnName}}
@TableField(value = "{{columnName}}" , typeHandler = {{packageName}}.core.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler.class)
{{/columnName}}
{{^columnName}}
{{else}}
@TableField(exist = false)
{{/columnName}}
{{/if}}
private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{codeName.camelCase}};
{{/entity.nesteds}}
{{/each}}
{{#entity.fields}}
{{^deepStructure}}
{{^keyDEField}}
{{^predefinedType}}
{{#each entity.fields}}
{{#unless deepStructure}}
{{#unless keyDEField}}
{{#unless predefinedType}}
/**
* 设置 [{{logicName}}]
*/
......@@ -115,9 +112,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
this.modify("{{name.lowerCase}}", {{codeName.camelCase}});
return this;
}
{{/predefinedType}}
{{/keyDEField}}
{{#timeType}}
{{/unless}}
{{/unless}}
{{#timeType}}
/**
* 格式化日期 [{{logicName}}]
*/
......@@ -128,13 +125,13 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
SimpleDateFormat sdf = new SimpleDateFormat("{{format}}");
return sdf.format({{codeName.camelCase}});
}
{{/timeType}}
{{/timeType}}
{{/deepStructure}}
{{/entity.fields}}
{{/unless}}
{{/each}}
{{#entity.nesteds}}
{{#columnName}}
{{#columnName}}
/**
* 设置 [{{entityLogicName}}]
*/
......@@ -143,7 +140,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
this.modify("{{columnName}}", ({{codeName.camelCase}}!=null)?{{codeName.camelCase}}:(new ArrayList()));
return this;
}
{{/columnName}}
{{/columnName}}
{{/entity.nesteds}}
......
......@@ -58,11 +58,11 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> idList);
{{#entity.actions}}
{{#each entity.extActions}}
{{entity.codeName}} {{codeName.camelCase}}({{entity.codeName}} et);
boolean {{codeName.camelCase}}Batch(List<{{entity.codeName}}> list);
{{/entity.actions}}
{{/each}}
{{#entity.dataSets}}
Page<{{entity.codeName}}> search{{codeName}}({{entity.codeName}}SearchContext context);
List<{{entity.codeName}}> list{{codeName}}({{entity.codeName}}SearchContext context);
......
......@@ -56,4 +56,71 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{/entity.relEntities}}
public {{entity.codeName}} get({{entity.keyField.type.java}} key) {
{{entity.codeName}} et = getById(key);
Assert.notNull(et,"数据不存在,{{entity.logicName}}:"+key);
{{#entity.nesteds}}
//设置 [{{entityLogicName}}]
this.set{{codeName.pascalCase}}({{camelCase entityCodeName}}Service.selectBy{{fkField.codeName.pascalCase}}(key));
{{/entity.nesteds}}
}
List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> idList);
List<{{entity.codeName}}> getByEntities(Collection<{{entity.codeName}}> entities);
{{entity.codeName}} getDraft({{entity.codeName}} et);
boolean checkKey({{entity.codeName}} et);
@Override
{{#eq transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean create({{entity.codeName}} et) {
}
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean createBatch(List<{{entity.codeName}}> list);
boolean update({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean updateBatch(List<{{entity.codeName}}> list);
boolean save({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBatch(List<{{entity.codeName}}> list);
boolean remove({{entity.keyField.type.java}} key);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> idList);
{{#entity.actions}}
{{entity.codeName}} {{codeName.camelCase}}({{entity.codeName}} et);
boolean {{codeName.camelCase}}Batch(List<{{entity.codeName}}> list);
{{/entity.actions}}
{{#entity.dataSets}}
Page<{{entity.codeName}}> search{{codeName}}({{entity.codeName}}SearchContext context);
List<{{entity.codeName}}> list{{codeName}}({{entity.codeName}}SearchContext context);
{{/entity.dataSets}}
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}},List<{{entity.codeName}}> list);
{{/entity.references}}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册