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

函数方式转换

上级 a03c228b
......@@ -156,7 +156,7 @@
<dependency>
<groupId>net.ibizsys.model</groupId>
<artifactId>ibiz-model</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
......
......@@ -28,5 +28,9 @@ public class ApiEntityModel extends BaseModel{
private ApiModel api;
public EntityModel getEntity()
{
return api.getSystem().getEntity(getApiDataEntity().getPSDataEntity().getCodeName());
}
}
package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -40,6 +41,24 @@ public class AppEntityModel extends BaseModel{
return this;
}
public EntityModel getEntity()
{
return app.getSystem().getEntity(getAppDataEntity().getPSDataEntity().getCodeName());
}
public String getServiceId()
{
String sybSysServiceType="DEFAULT";
if(getEntity().getDataEntity().getPSSubSysServiceAPI()!=null)
sybSysServiceType=getEntity().getDataEntity().getPSSubSysServiceAPI().getServiceType();
if(getEntity().getDataEntity().getStorageMode()==4 && (!"MIDDLEPLATFORM".equals(sybSysServiceType)) && (!"MASA".equals(sybSysServiceType)))
return getEntity().getDataEntity().getPSSubSysServiceAPI().getServiceCodeName();
else if (getAppDataEntity().getPSSysServiceAPI()!=null)
return app.getSystem().getProjectName()+"-"+ getAppDataEntity().getPSSysServiceAPI().getCodeName().toLowerCase();
else
return null;
}
public Collection<CtrlModel> getCtrls()
{
return ctrlsMap.values();
......
......@@ -66,7 +66,7 @@ public class CliOption extends DataObj
}
public String getProjectName(){
return this.getStringValue(CodegenConstants.PROJECT_NAME,this.getStringValue("system_id",this.getStringValue("system",this.getStringValue("system_name"))));
return this.getStringValue(CodegenConstants.PROJECT_NAME,"");
}
public CliOption setProjectName(String projectName)
......@@ -74,6 +74,10 @@ public class CliOption extends DataObj
return this.set(CodegenConstants.PROJECT_NAME,projectName);
}
public String getProjectDesc(){
return this.getStringValue(CodegenConstants.PROJECT_DESC,getProjectName());
}
public CliOption setProjectDesc(String projectDesc)
{
return this.set(CodegenConstants.PROJECT_DESC,projectDesc);
......
......@@ -61,7 +61,12 @@ public class ModelStorage {
IPSSystem iPSSystem = psModelService.getPSSystem();
systemModel = new SystemModel(iPSSystem);
Assert.notNull(iPSSystem,"加载系统模型错误:"+strPSModelFolderPath);
if(!StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PROJECT_NAME)))
systemModel.setProjectName(config.getAdditionalProperties().get(CodegenConstants.PROJECT_NAME).toString());
if(!StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PROJECT_DESC)))
systemModel.setProjectDesc(config.getAdditionalProperties().get(CodegenConstants.PROJECT_DESC).toString());
if(!StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PACKAGE_NAME)))
systemModel.setPackageName(config.getAdditionalProperties().get(CodegenConstants.PACKAGE_NAME).toString());
} catch (Exception e) {
throw new RuntimeException("加载系统模型错误"+strPSModelFolderPath,e);
......@@ -78,14 +83,10 @@ public class ModelStorage {
CliOption opt=new CliOption();
opt.putAll(config.getAdditionalProperties());
opt.setTemplateFileType(type);
SystemModel systemModel=getSystemModel();
if(StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PROJECT_NAME)))
opt.setProjectName(systemModel.getProjectName());
if(StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PROJECT_DESC)))
opt.setProjectDesc(systemModel.getProjectDesc());
if(StringUtils.isEmpty(config.getAdditionalProperties().get(CodegenConstants.PACKAGE_NAME)))
opt.setPackageName(systemModel.getPackageName());
opt.setProjectName(systemModel.getProjectName());
opt.setProjectDesc(systemModel.getProjectDesc());
opt.setPackageName(systemModel.getPackageName());
opt.set("system",systemModel);
return opt;
}
......
......@@ -51,12 +51,16 @@ public class SystemModel extends BaseModel {
{
this.setCodeName(this.pub.getCodeName());
this.setName(this.pub.getName());
this.setProjectName(this.pub.getCodeName().toLowerCase());
this.setProjectDesc(this.pub.getName());
this.setPackageName(this.pub.getPKGCodeName());
}
else
{
this.setCodeName(system.getCodeName());
this.setName(system.getName());
this.setProjectName(system.getCodeName().toLowerCase());
this.setProjectDesc(system.getName());
this.setPackageName(system.getCodeName().toLowerCase());
}
getEntitiesMap();
......@@ -67,20 +71,15 @@ public class SystemModel extends BaseModel {
return (IPSSystem)opt;
}
public String getProjectName()
{
return this.codeName.toLowerCase();
}
private String projectName;
public String getProjectDesc()
{
return this.name;
}
private String projectDesc;
private String packageName;
private boolean enableDS=false;
private boolean enableES=false;
private boolean enableMongo=false;
private boolean enableMQ=false;
private boolean enableOAuth2=false;
private boolean enableGlobalTransaction=false;
......@@ -89,6 +88,7 @@ public class SystemModel extends BaseModel {
private boolean enableDameng=false;
private boolean enablePostgreSQL=false;
private boolean enableDyna=false;
private boolean enableWorkflow=false;
private IPSSysSFPub pub;
......@@ -99,6 +99,10 @@ public class SystemModel extends BaseModel {
getSystem().getAllPSDataEntities().forEach(entity -> {
if((entity.getStorageMode()==1 || entity.getStorageMode()==2) && "DEFAULT".equals(entity.getDSLink()))
enableDS=true;
if(entity.getStorageMode()==2)
enableMongo=true;
if(ObjectUtils.isEmpty(entity.getAllPSDEWFs()))
enableWorkflow=true;
if("elasticsearch".equalsIgnoreCase(entity.getUserTag()))
enableES=true;
if(!ObjectUtils.isEmpty(entity.getAllPSDEDataSyncs()))
......
......@@ -57,7 +57,12 @@ public class TemplateDefinition {
while (m.find()) {
String[] pairs=m.group(1).split("@");
if(type.name().equalsIgnoreCase(pairs[0])
||type.value().equalsIgnoreCase(pairs[0])) {
||type.value().equalsIgnoreCase(pairs[0])
||type.name().endsWith(" "+pairs[0])
||type.value().endsWith(" "+pairs[0])
||type.name().startsWith(pairs[0]+".")
||type.value().startsWith(pairs[0]+".")
) {
if(pairs.length>1&&(!StringUtils.isEmpty(pairs[1])))
this.setSubType(pairs[1]);
return type;
......
......@@ -153,6 +153,8 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
@Override
public File write(Map<String, Object> data, String template, File target) throws IOException {
String templateContent = this.engineAdapter.compileTemplate(this, data, template);
if(StringUtils.isEmpty(templateContent))
return null;
return writeToFile(target.getPath(), templateContent);
}
......
......@@ -2,6 +2,7 @@ package cn.ibizlab.codegen.templating.mustache;
import cn.ibizlab.codegen.CodegenConfig;
import cn.ibizlab.codegen.utils.Inflector;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
......@@ -35,7 +36,7 @@ public class PluralizeLambda implements Mustache.Lambda {
@Override
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
String text = Inflector.getInstance().pluralize(fragment.execute());
String text = Inflector.getInstance().pluralize(StringAdvUtils.camelcase(fragment.execute()));
writer.write(text);
......
......@@ -3,5 +3,5 @@
{{>(lookup 'SUMMARYCOLUMN') item=column ctrl=ctrl}}
{{/each}}
{{else}}
<a-table-summary-cell>\{{state.dataAgg}}.{{item.codeName.lowerCase}}</a-table-summary-cell>
<a-table-summary-cell>\{{state.dataAgg}}.{{lowerCase item.codeName}}</a-table-summary-cell>
{{/eq}}
import {{page.codeName}} from "./{{page.codeName.spinalCase}}.vue";
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export { {{page.codeName}} };
......@@ -2,10 +2,10 @@
import { Subject } from 'rxjs'
import { Ref } from 'vue';
import { IndexView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{page.codeName.spinalCase}}-config';
import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}}
{{#eq controlType "APPMENU"}}
import { {{codeName}}Menu } from '@widgets/app/{{codeName.spinalCase}}-menu';
import { {{codeName}}Menu } from '@widgets/app/{{spinalCase codeName}}-menu';
{{/eq}}
{{/page.ctrls}}
import {
......
import {{page.codeName}} from "./{{page.codeName.spinalCase}}.vue";
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export { {{page.codeName}} };
<script setup lang="ts">
import { Subject } from 'rxjs';
import { EditView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{page.codeName.spinalCase}}-config';
import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}}
{{#eq controlType "FORM"}}
import { {{codeName}}Form } from '@widgets/{{appEntity.codeName.spinalCase}}/{{codeName.spinalCase}}-form';
import { {{codeName}}Form } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-form';
{{/eq}}
{{/page.ctrls}}
......
import {{page.codeName}} from "./{{page.codeName.spinalCase}}.vue";
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export { {{page.codeName}} };
<script setup lang="ts">
import { Subject } from 'rxjs';
import { GridView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{page.codeName.spinalCase}}-config';
import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}}
{{#eq controlType "GRID"}}
import { {{codeName}}Grid } from '@widgets/{{appEntity.codeName.spinalCase}}/{{codeName.spinalCase}}-grid';
import { {{codeName}}Grid } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-grid';
{{/eq}}
{{/page.ctrls}}
......
......@@ -44,7 +44,7 @@ const routes = [
{ pathName: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}", parameterName: "{{lowerCase codeName}}" },
{ pathName: 'views', parameterName: 'view' },
],
resource: "{{entity.codeName.lowerCase}}",
resource: "{{lowerCase entity.codeName}}",
requireAuth: false,
},
component: () => import("@page/{{#if appView.psAppDataEntity}}{{spinalCase appView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
......@@ -68,7 +68,7 @@ const routes = [
{ pathName: "{{lowerCase (pluralize appView.psAppDataEntity.codeName)}}", parameterName: "{{lowerCase appView.psAppDataEntity.codeName}}" },
{ pathName: 'views', parameterName: 'view' },
],
resource: "{{entity.codeName.lowerCase}}",
resource: "{{lowerCase entity.codeName}}",
requireAuth: false,
},
component: () => import("@page/{{#if appView.psAppDataEntity}}{{spinalCase appView.psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}/{{spinalCase appView.codeName}}.vue"),
......
......@@ -4,20 +4,20 @@ import { Http, EntityService } from '@ibiz-core';
* {{appEntity.logicName}}服务对象基类
*
* @export
* @class {{appEntity.codeName.pascalCase}}
* @class {{pascalCase appEntity.codeName}}
* @extends {EntityBaseService}
*/
export class {{appEntity.codeName.pascalCase}}ServiceBase extends EntityService {
export class {{pascalCase appEntity.codeName}}ServiceBase extends EntityService {
constructor(opts?: any) {
super(opts);
}
protected APPDENAME = "{{appEntity.codeName.pascalCase}}";
protected APPDENAME = "{{pascalCase appEntity.codeName}}";
{{#eq appEntity.keyPSAppDEField.codeName.lowerCase}}
protected APPDEKEY = "{{appEntity.keyPSAppDEField.codeName.pascalCase}}";
{{/eq}}
{{#if appEntity.keyPSAppDEField}}
protected APPDEKEY = "{{pascalCase appEntity.keyPSAppDEField.codeName}}";
{{/if}}
{{#each appEntity.allPSAppDEMethods as |singleAppMethod| }}
......@@ -27,36 +27,36 @@ export class {{appEntity.codeName.pascalCase}}ServiceBase extends EntityService
* @param {*} [_context={}]
* @param {*} [_data = {}]
* @returns {Promise<any>}
* @memberof {{appEntity.codeName.pascalCase}}ServiceBase
* @memberof {{pascalCase appEntity.codeName}}ServiceBase
*/
async {{singleAppMethod.codeName}}(_context: any = {}, _data: any = {}): Promise<any> {
//{{singleAppMethod}}
//{{singleAppMethod.psDEServiceAPIMethod}}
//{{singleAppMethod.psDEServiceAPIMethod.requestMethod}}
{{#eq singleAppMethod.methodType "SELECT" }}
const res = await this.http.post(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
const res = await this.http.post(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`, _data);
return res;
{{/eq}}
{{#eq singleAppMethod.methodType "FETCH" }}
const res = await this.http.post(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
const res = await this.http.post(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`, _data);
return res;
{{/eq}}
{{#eq singleAppMethod.methodType "GET" }}
const res = await this.http.get(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`);
const res = await this.http.get(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`);
return res;
{{/eq}}
{{#eq singleAppMethod.codeName "GetDraft" }}
_data[this.APPDENAME?.toLowerCase()] = undefined;
_data[this.APPDEKEY] = undefined;
const res = await this.http.post(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
const res = await this.http.post(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`, _data);
return res;
{{/eq}}
{{#eq singleAppMethod.codeName "Update" }}
const res = await this.http.post(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
const res = await this.http.post(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`, _data);
return res;
{{/eq}}
{{#eq singleAppMethod.codeName "Get" }}
const res = await this.http.get(`/{{appEntity.codeName.pluralize}}/${encodeURIComponent(_context.{{appEntity.codeName.lowerCase}})}{{singleAppMethod.requestPath}}`, _data);
const res = await this.http.get(`/{{pluralize appEntity.codeName}}/${encodeURIComponent(_context.{{lowerCase appEntity.codeName}})}{{singleAppMethod.requestPath}}`, _data);
return res;
{{/eq}}
......
import { {{appEntity.codeName.pascalCase}}ServiceBase } from './{{appEntity.codeName.spinalCase}}-service-base';
import { {{pascalCase appEntity.codeName}}ServiceBase } from './{{spinalCase appEntity.codeName}}-service-base';
/**
* ${appEntity.getLogicName()}服务
*
* @export
* @class {{appEntity.codeName.pascalCase}}Service
* @extends {{appEntity.codeName.pascalCase}}ServiceBase
* @class {{pascalCase appEntity.codeName}}Service
* @extends {{pascalCase appEntity.codeName}}ServiceBase
*/
export class {{appEntity.codeName.pascalCase}}Service extends {{appEntity.codeName.pascalCase}}ServiceBase {
export class {{pascalCase appEntity.codeName}}Service extends {{pascalCase appEntity.codeName}}ServiceBase {
/**
* Creates an instance of {{appEntity.codeName.pascalCase}}Service.
* @memberof {{appEntity.codeName.pascalCase}}Service
* Creates an instance of {{pascalCase appEntity.codeName}}Service.
* @memberof {{pascalCase appEntity.codeName}}Service
*/
constructor(opts?: any) {
{{!-- const { context: context, tag: cacheKey } = opts; --}}
......@@ -22,11 +22,11 @@ export class {{appEntity.codeName.pascalCase}}Service extends {{appEntity.codeNa
*
* @static
* @param 应用上下文
* @return {*} { {{appEntity.codeName.pascalCase}}Service }
* @memberof {{appEntity.codeName.pascalCase}}Service
* @return {*} { {{pascalCase appEntity.codeName}}Service }
* @memberof {{pascalCase appEntity.codeName}}Service
*/
static getInstance(context?: any): {{appEntity.codeName.pascalCase}}Service {
return new {{appEntity.codeName.pascalCase}}Service({ context: context });
static getInstance(context?: any): {{pascalCase appEntity.codeName}}Service {
return new {{pascalCase appEntity.codeName}}Service({ context: context });
}
}
export default {{appEntity.codeName.pascalCase}}Service;
\ No newline at end of file
export default {{pascalCase appEntity.codeName}}Service;
\ No newline at end of file
import {{ctrl.codeName}}Menu from "./{{ctrl.codeName.spinalCase}}-menu.vue";
import {{ctrl.codeName}}Menu from "./{{spinalCase ctrl.codeName}}-menu.vue";
export { {{ctrl.codeName}}Menu };
<script setup lang="ts">
import { Subject } from "rxjs";
import { CtrlConfig } from "./{{ctrl.codeName.spinalCase}}-menu-config";
import { CtrlConfig } from "./{{spinalCase ctrl.codeName}}-menu-config";
import { IParam, IActionParam, MenuControl } from "@ibiz-core";
interface Props{
context: IParam;
......
import {{ctrl.codeName}}Form from "./{{ctrl.codeName.spinalCase}}-form.vue";
import {{ctrl.codeName}}Form from "./{{spinalCase ctrl.codeName}}-form.vue";
export { {{ctrl.codeName}}Form };
import { ControlVOBase } from '@ibiz-core';
import { ControlService } from './{{ctrl.codeName.lowerCase}}-form-service';
import { ControlService } from './{{lowerCase ctrl.codeName}}-form-service';
export const CtrlConfig = {
controlCodeName: '{{ctrl.codeName}}',
......
import { ControlServiceBase } from '@ibiz-core';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@service/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
import { ControlVO } from './{{ctrl.codeName.lowerCase}}-form-config';
import { ControlVO } from './{{lowerCase ctrl.codeName}}-form-config';
export class ControlService extends ControlServiceBase {
......
{{>@macro/form-detail/include-form.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{ctrl.codeName.spinalCase}}-form-config';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-form-config';
import { FormControl, IActionParam, IParam, ControlAction } from '@ibiz-core';
interface Props {
......
import {{ctrl.codeName}}Grid from "./{{ctrl.codeName.spinalCase}}-grid.vue";
import {{ctrl.codeName}}Grid from "./{{spinalCase ctrl.codeName}}-grid.vue";
export { {{ctrl.codeName}}Grid };
{{>@macro/grid-detail/include-grid.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{ctrl.codeName.spinalCase}}-grid-config';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-grid-config';
import { GridControl, IActionParam, IParam, ControlAction } from '@ibiz-core';
interface Props {
......
{{#eq system.saaSMode 4}}
package {{packageName}}.{{apps}}.config;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class {{app.codeName}}HeaderFilter extends ZuulFilter {
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
RequestContext ctx = RequestContext.getCurrentContext();
ctx.addZuulRequestHeader("srfsystem", "{{system.codeName}}");
return null;
}
}
{{/eq}}
\ No newline at end of file
package {{packageName}}.{{apps}}.config;
import {{packageName}}.util.security.AuthenticationEntryPoint;
import {{packageName}}.util.security.AuthorizationTokenFilter;
import {{packageName}}.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.context.annotation.Profile;
import org.springframework.beans.factory.annotation.Qualifier;
@Profile("{{apps}}-prod")
@Configuration
@EnableWebSecurity
public class {{app.codeName}}SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private AuthenticationUserService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}"})
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}"})
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}"})
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}"})
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}"})
private String previewpath;
@Value("${ibiz.auth.excludesPattern:}"})
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.ico",
"/**/assets/**",
"/**/css/**",
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/**/svg/**",
"/"
).permitAll()
// 放行登录请求
.antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
// 放行注销请求
.antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**");
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
package {{packageName}}.{{apps}};
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import {{packageName}}.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@Import({
FeignClientsConfiguration.class
})
@EnableDiscoveryClient
@Configuration
@EnableFeignClients(basePackages = {"{{packageName}}" })
@EnableZuulProxy
@ComponentScan(basePackages = {"{{packageName}}.{{apps}}","{{packageName}}.util"})
@MapperScan("{{packageName}}.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
{{#unless system.enableMongo}}
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,
{{/unless}}
{{#if system.enableDS}}
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class
{{/if}}
})
public class {{app.codeName}}Application extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run({{app.codeName}}Application.class, args);
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
}
}
server:
port: {{#if app.httpPort}}{{app.httpPort}}{{else}}8080{{/if}}
#Log配置
logging:
level:
{{packageName}}: info
#zuul网关路由设置
zuul:
routes:
{{#enableWorkflow}}
wfcore:
path: /wfcore/**
serviceId: ${ibiz.ref.service.wf:ibzwf-api}}
stripPrefix: true
{{/enableWorkflow}}
loginv7:
path: /v7/login
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
changepwd:
path: /v7/changepwd
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
config:
path: /configs/**
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
oucore:
path: /ibzorganizations/**
serviceId: ${ibiz.ref.service.ou:ibzou-api}}
stripPrefix: false
oudict:
path: /dictionarys/**/Ibzou**
serviceId: ${ibiz.ref.service.ou:ibzou-api}}
stripPrefix: false
ou:
path: /ibzdepartments/**
serviceId: ${ibiz.ref.service.ou:ibzou-api}}
stripPrefix: false
uaadict:
path: /dictionarys/**/SysOperator
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
dict:
path: /dictionarys/**
serviceId: ${ibiz.ref.service.dict:ibzdict-api}}
stripPrefix: false
disk:
path: /net-disk/**
serviceId: ${ibiz.ref.service.disk:ibzdisk-api}}
stripPrefix: false
ou_sys_org:
path: /sysorganizations/**
serviceId: ${ibiz.ref.service.ou:ibzou-api}}
stripPrefix: false
ou_sys_dept:
path: /sysdepartments/**
serviceId: ${ibiz.ref.service.ou:ibzou-api}}
stripPrefix: false
lite-core:
path: /lite/**
serviceId: ${ibiz.ref.service.lite:ibzlite-api}}
stripPrefix: false
sysauthlog:
path: /sysauthlogs
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}}
stripPrefix: false
{{#each app.appEntities}}
{{#serviceId}}
{{lowerCase codeName}}:
path: /{{pluralize codeName}}/**
serviceId: ${ibiz.ref.service.{{serviceId}}:{{serviceId}}\}
stripPrefix: false
{{/serviceId}}
{{/each}}
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......@@ -66,7 +66,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
{{/timeType}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
@ApiModelProperty("{{logicName}}")
private {{type.java}} {{codeName.camelCase}};
private {{type.java}} {{camelCase codeName}};
{{/unless}}
{{/each}}
......@@ -78,7 +78,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private {{packageName}}.core.{{module}}.domain.{{entityCodeName}} {{codeName.camelCase}};
private {{packageName}}.core.{{module}}.domain.{{entityCodeName}} {{camelCase codeName}};
{{/each}}
{{#each entity.nesteds}}
......@@ -97,7 +97,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
{{else}}
@TableField(exist = false)
{{/if}}
private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{codeName.camelCase}};
private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}};
{{/each}}
{{#each entity.fields}}
......@@ -107,9 +107,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
/**
* 设置 [{{logicName}}]
*/
public {{entity.codeName}} set{{codeName.pascalCase}}({{type.java}} {{codeName.camelCase}}) {
this.{{codeName.camelCase}} = {{codeName.camelCase}};
this.modify("{{name.lowerCase}}", {{codeName.camelCase}});
public {{entity.codeName}} set{{pascalCase codeName}}({{type.java}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
this.modify("{{lowerCase name}}", {{camelCase codeName}});
return this;
}
{{/unless}}
......@@ -118,12 +118,12 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
/**
* 格式化日期 [{{logicName}}]
*/
public String format{{codeName.pascalCase}}() {
if (this.{{codeName.camelCase}} == null) {
public String format{{pascalCase codeName}}() {
if (this.{{camelCase codeName}} == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("{{format}}");
return sdf.format({{codeName.camelCase}});
return sdf.format({{camelCase codeName}});
}
{{/timeType}}
......@@ -135,9 +135,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
/**
* 设置 [{{entityLogicName}}]
*/
public {{entity.codeName}} set{{codeName.pascalCase}}(List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{codeName.camelCase}}) {
this.{{codeName.camelCase}} = {{codeName.camelCase}};
this.modify("{{columnName}}", ({{codeName.camelCase}}!=null)?{{codeName.camelCase}}:(new ArrayList()));
public {{entity.codeName}} set{{pascalCase codeName}}(List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
this.modify("{{columnName}}", ({{camelCase codeName}}!=null)?{{camelCase codeName}}:(new ArrayList()));
return this;
}
{{/columnName}}
......
......@@ -25,37 +25,37 @@ public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName}
{{#entity.dataSets}}
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{codeName.pascalCase}}(IPage page, @Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{codeName.pascalCase}}(@Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}(IPage page, @Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}(@Param("srf") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
{{/entity.dataSets}}
@Override
{{#enableEntityCache}}
@Cacheable(value = "{{entity.codeName.lowerCase}}", key = "'row:'+#p0")
@Cacheable(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0")
{{/enableEntityCache}}
{{entity.codeName}} selectById(Serializable id);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", key = "'row:'+#p0.{{entity.keyField.codeName.camelCase}}")
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
int insert({{entity.codeName}} entity);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", key = "'row:'+#p0.{{entity.keyField.codeName.camelCase}}")
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
int updateById(@Param(Constants.ENTITY) {{entity.codeName}} entity);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", key = "'row:'+#p0.{{entity.keyField.codeName.camelCase}}", condition ="#p0 != null")
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}", condition ="#p0 != null")
{{/enableEntityCache}}
int update(@Param(Constants.ENTITY) {{entity.codeName}} entity, @Param("ew") Wrapper<{{entity.codeName}}> updateWrapper);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", key = "'row:'+#p0")
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0")
{{/enableEntityCache}}
int deleteById(Serializable id);
......@@ -92,7 +92,7 @@ public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName}
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{fkField.codeName.pascalCase}}(@Param("{{fkField.codeName.camelCase}}") Serializable {{fkField.codeName.camelCase}});
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}(@Param("{{camelCase fkField.codeName}}") Serializable {{camelCase fkField.codeName}});
{{/entity.references}}
}
\ No newline at end of file
......@@ -36,31 +36,31 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
boolean create({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean createBatch(List<{{entity.codeName}}> list);
boolean update({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean updateBatch(List<{{entity.codeName}}> list);
boolean save({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBatch(List<{{entity.codeName}}> list);
boolean remove({{entity.keyField.type.java}} key);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> idList);
{{#each entity.extActions}}
{{entity.codeName}} {{codeName.camelCase}}({{entity.codeName}} et);
boolean {{codeName.camelCase}}Batch(List<{{entity.codeName}}> list);
{{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et);
boolean {{camelCase codeName}}Batch(List<{{entity.codeName}}> list);
{{/each}}
{{#entity.dataSets}}
......@@ -69,15 +69,15 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{/entity.dataSets}}
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
boolean removeBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}},List<{{entity.codeName}}> list);
boolean saveBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}},List<{{entity.codeName}}> list);
{{/entity.references}}
}
\ No newline at end of file
......@@ -47,12 +47,12 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
@Service("{{entity.codeName}}ServiceImpl")
public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeName}}> implements I{{entity.codeName}}Service {
protected I{{entity.codeName}}Service {{entity.codeName.camelCase}}Service = SpringContextHolder.getBean(this.getClass());
protected I{{entity.codeName}}Service {{camelCase entity.codeName}}Service = SpringContextHolder.getBean(this.getClass());
{{#entity.relEntities}}
@Autowired
@Lazy
protected {{packageName}}.core.{{codeName}}.service.I{{codeName}}Service {{codeName.camelCase}}Service;
protected {{packageName}}.core.{{codeName}}.service.I{{codeName}}Service {{camelCase codeName}}Service;
{{/entity.relEntities}}
......@@ -62,7 +62,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
Assert.notNull(et,"数据不存在,{{entity.logicName}}:"+key);
{{#entity.nesteds}}
//设置 [{{entityLogicName}}]
this.set{{codeName.pascalCase}}({{camelCase entityCodeName}}Service.selectBy{{fkField.codeName.pascalCase}}(key));
this.set{{pascalCase codeName}}({{camelCase entityCodeName}}Service.selectBy{{pascalCase fkField.codeName}}(key));
{{/entity.nesteds}}
}
List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> idList);
......@@ -82,7 +82,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
createIndexMajorEntityData(et);
{{/entity.isIndexSubDE}}
{{#if entity.isLogicInheritDE}}
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("{{entity.keyField.name.lowerCase}}", et.get{{keyField.codeName.pascalCase}}())))
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("{{lowerCase entity.keyField.name}}", et.get{{pascalCase keyField.codeName}}())))
return false;
{{else}}
if(!this.retBool(this.baseMapper.insert(et)))
......@@ -91,7 +91,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#each entity.nesteds}}
{{#unless listCode}}
{{#unless columnName}}
{{camelCase entityCodeName}}Service.saveBy{{fkField.codeName.pascalCase}}(key,et.{{codeName.camelCase}});
{{camelCase entityCodeName}}Service.saveBy{{pascalCase fkField.codeName}}(key,et.{{camelCase codeName}});
{{/unless}}
{{/unless}}
{{/each}}
......@@ -107,42 +107,42 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
boolean update({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean updateBatch(List<{{entity.codeName}}> list);
boolean save({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBatch(List<{{entity.codeName}}> list);
boolean remove({{entity.keyField.type.java}} key);
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", 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.codeName}} {{camelCase codeName}}({{entity.codeName}} et);
boolean {{camelCase codeName}}Batch(List<{{entity.codeName}}> list);
{{/entity.actions}}
{{#entity.dataSets}}
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{codeName.pascalCase}}({{entity.codeName}}SearchContext context);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{codeName.pascalCase}}({{entity.codeName}}SearchContext context);
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}({{entity.codeName}}SearchContext context);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}({{entity.codeName}}SearchContext context);
{{/entity.dataSets}}
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}});
boolean removeBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{entity.codeName.lowerCase}}", allEntries = true)
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBy{{fkField.codeName.pascalCase}}({{fkField.type.java}} {{fkField.codeName.camelCase}},List<{{entity.codeName}}> list);
boolean saveBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}},List<{{entity.codeName}}> list);
{{/entity.references}}
......
......@@ -5,7 +5,7 @@
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="{{entity.codeName}}ResultMap" type="{{packageName}}.core.{{module}}.domain.{{entity.codeName}}" autoMapping="true">
{{#entity.keyField.phisicalDEField}}
<id property="{{entity.keyField.codeName.camelCase}}" column="{{entity.keyField.columnName}}" /><!--主键字段映射-->
<id property="{{camelCase entity.keyField.codeName}}" column="{{entity.keyField.columnName}}" /><!--主键字段映射-->
{{/entity.keyField.phisicalDEField}}
{{#each entity.fields}}
{{#alias}}
......@@ -18,11 +18,11 @@
{{/each}}
{{#each entity.nesteds}}
{{#columnName}}
<result property="{{codeName.camelCase}}" column="{{columnName}}" typeHandler="{{packageName}}.core.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler" />
<result property="{{camelCase codeName}}" column="{{columnName}}" typeHandler="{{packageName}}.core.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler" />
{{/columnName}}
{{/each}}
{{#each entity.references}}
<association property="{{codeName.camelCase}}" javaType="{{packageName}}.core.{{module}}.domain.{{entityCodeName}}" column="{{fkField.columnName}}" select="{{packageName}}.core.{{module}}.mapper.{{entityCodeName}}Mapper.selectById" fetchType="lazy"></association>
<association property="{{camelCase codeName}}" javaType="{{packageName}}.core.{{module}}.domain.{{entityCodeName}}" column="{{fkField.columnName}}" select="{{packageName}}.core.{{module}}.mapper.{{entityCodeName}}Mapper.selectById" fetchType="lazy"></association>
{{/each}}
</resultMap>
......@@ -46,7 +46,7 @@
</select>
{{#each entity.dataQueries}}
<sql id="{{codeName.camelCase}}" databaseId="{{dsType}}">
<sql id="{{camelCase codeName}}" databaseId="{{dsType}}">
<![CDATA[
{{dsCode}}
]]>
......@@ -54,7 +54,7 @@
{{/each}}
{{#each entity.dataSets}}
<select id="search{{codeName.pascalCase}}" parameterType="{{packageName}}.core.{{module}}.filter.{{entity.codeName}}SearchContext" resultType={{#if enableGroup}}"java.util.HashMap"{{else}}"{{entity.codeName}}ResultMap"{{/if}}>
<select id="search{{pascalCase codeName}}" parameterType="{{packageName}}.core.{{module}}.filter.{{entity.codeName}}SearchContext" resultType={{#if enableGroup}}"java.util.HashMap"{{else}}"{{entity.codeName}}ResultMap"{{/if}}>
{{select}}
from (
{{#each queries}}
......@@ -72,9 +72,9 @@
{{/each}}
{{#each entity.references as | reference |}}
<select id="selectBy{{reference.fkField.codeName.pascalCase}}" resultMap="{{entity.codeName}}ResultMap">
<select id="selectBy{{pascalCase reference.fkField.codeName}}" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.defaultDataQuery}}
<include refid="{{entity.defaultDataQuery.codeName.camelCase}}" />
<include refid="{{camelCase entity.defaultDataQuery.codeName}}" />
{{#if entity.defaultDataQuery.where}}
and
{{else}}
......@@ -83,7 +83,7 @@
{{else}}
select t1.* from {{#if entity.viewName}}{{entity.viewName}}{{else}}{{entity.tableName}}{{/if}} t1 where
{{/if}}
{{reference.fkField.columnName}} = #{{{reference.fkField.codeName.camelCase}}}
{{reference.fkField.columnName}} = #{{{camelCase reference.fkField.codeName}}}
</select>
{{/each}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册