diff --git a/README.md b/README.md index 0907c2c..2155f4c 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,23 @@ -## 简介 -* SpringBlade 2.0 是如梦技术团队作品,是一个基于 Spring Boot 2 & Spring Cloud Finchley & Mybatis 等核心技术,用于快速构建中大型系统的基础框架。 -* SpringBlade 致力于创造新颖的开发模式,将开发中遇到的痛点、生产中所踩的坑整理归纳,并将解决方案都融合到框架中。 +

+ Build Status + Coverage Status + Downloads +

-## 官网 -* 官网地址:[https://bladex.vip](https://bladex.vip) - -## 在线演示 -* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip) -* Saber演示地址:[https://saber.bladex.vip](https://saber.bladex.vip) - -## 后端项目地址 -* [Gitee地址](https://gitee.com/smallc/SpringBlade) -* [Github地址](https://github.com/chillzhuang/SpringBlade) - -## 前端项目地址 -* [Sword--基于React](https://gitee.com/smallc/Sword) -* [Saber--基于Vue](https://gitee.com/smallc/Saber) - -## 主要特性&&变化 -* 采用前后端分离的模式,前端开源出一个基于React的框架:[Sword](https://gitee.com/smallc/Sword),主要选型技术为React、Ant Design、Umi、Dva -* 采用前后端分离的模式,前端开源出一个基于Vue的框架:[Saber](https://gitee.com/smallc/Saber),主要选型技术为Vue、VueX、Avue、Element-UI +**SpringBlade微服务开发平台** +* 采用前后端分离的模式,前端开源两个框架:[Sword](https://gitee.com/smallc/Sword) (基于 React、Ant Design)、[Saber](https://gitee.com/smallc/Saber) (基于 Vue、Element-UI) * 后端采用SpringCloud全家桶,并同时对其基础组件做了高度的封装,单独开源出一个框架:[BladeTool](https://github.com/chillzhuang/blade-tool) * [BladeTool](https://github.com/chillzhuang/blade-tool)已推送至Maven中央库,直接引入即可,减少了工程的臃肿,也可更注重于业务开发 * 集成Sentinel从流量控制、熔断降级、系统负载等多个维度保护服务的稳定性。 * 注册中心、配置中心选型Nacos,为工程瘦身的同时加强各模块之间的联动。 * 使用Traefik进行反向代理,监听后台变化自动化应用新的配置文件。 -* 部署使用Docker或K8s + Jenkins +* 极简封装了多租户底层,用更少的代码换来拓展性更强的SaaS多租户系统。 +* 借鉴OAuth2,实现了多终端认证系统,可控制子系统的token权限互相隔离。 +* 借鉴Security,封装了Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案。 * 踩了踩Kong的坑,有个基本的使用方案,但不深入,因为涉及到OpenResty。 -* 封装了简单的Secure模块,采用JWT做Token认证,可拓展集成Redis等细颗粒度控制方案 -* 在2.0诞生之前,已经稳定生产了近一年,经历了从Camden -> Finchley的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构 +* 稳定生产了一年,经历了从Camden -> Finchley的技术架构,也经历了从fat jar -> docker -> k8s + jenkins的部署架构 * 项目分包明确,规范微服务的开发模式,使包与包之间的分工清晰。 -## 会员计划及交流群 -* [会员计划及交流群](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) - -## 技术文档 -* [SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) - -## 单工程SpringBoot版 -* [SpringBoot版](https://gitee.com/smallc/SpringBlade/tree/2.0-boot/) - ## 工程结构 ``` SpringBlade @@ -61,40 +39,32 @@ SpringBlade └── └── blade-user-api -- 用户api ``` -# 开源协议 -Apache Licence 2.0 ([英文原文](http://www.apache.org/licenses/LICENSE-2.0.html)) +## 官网 +* 官网地址:[https://bladex.vip](https://bladex.vip) +* 会员计划:[https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) +* 交流群:`477853168` -Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似,同样鼓励代码共享和尊重原作者的著作权,同样允许代码修改,再发布(作为开源或商业软件)。 +## 在线演示 +* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip) +* Saber演示地址:[https://saber.bladex.vip](https://saber.bladex.vip) -需要满足的条件如下: +## 项目地址 +* 后端Gitee地址:[https://gitee.com/smallc/SpringBlade](https://gitee.com/smallc/SpringBlade) +* 后端Github地址:[https://github.com/chillzhuang/SpringBlade](https://github.com/chillzhuang/SpringBlade) +* 后端SpringBoot版:[https://gitee.com/smallc/SpringBlade/tree/2.0-boot/](https://gitee.com/smallc/SpringBlade/tree/2.0-boot/) +* 前端框架Sword(基于React):[https://gitee.com/smallc/Sword](https://gitee.com/smallc/Sword) +* 前端框架Saber(基于Vue):[https://gitee.com/smallc/Saber](https://gitee.com/smallc/Saber) +* 核心框架项目地址:[https://github.com/chillzhuang/blade-tool](https://github.com/chillzhuang/blade-tool) -* 需要给代码的用户一份Apache Licence - -* 如果你修改了代码,需要在被修改的文件中说明。 - -* 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。 - -* 如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。 - -Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。 +## 技术文档 +* [SpringBlade开发手册](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade开发手册) ## 用户权益 * 允许免费用于学习、毕设、公司项目、私活等。 * 代码文件需保留相关license信息。 - -## 禁止事项 -* 直接将本项目挂淘宝等商业平台出售。 +* 禁止直接将本项目挂淘宝等商业平台出售。 * 非界面代码50%以上相似度的二次开源,二次开源需先联系作者。 -注意:若禁止条款被发现有权追讨19999的授权费。 - -## 注 -* 前端UI项目地址(基于React):[Sword](https://gitee.com/smallc/Sword) -* 前端UI项目地址(基于Vue):[Saber](https://gitee.com/smallc/Saber) -* 核心框架项目地址:[BladeTool](https://github.com/chillzhuang/blade-tool.git) -* 交流群:`477853168` - - # 界面 ## 监控界面一览 @@ -162,4 +132,7 @@ Apache Licence也是对商业应用友好的许可。使用者也可以在需要 -
\ No newline at end of file + + +## 关注我们 +![](https://images.gitee.com/uploads/images/2019/0330/065148_f0ada806_410595.jpeg) \ No newline at end of file diff --git a/blade-auth/pom.xml b/blade-auth/pom.xml index 2b2020d..5d87704 100644 --- a/blade-auth/pom.xml +++ b/blade-auth/pom.xml @@ -8,7 +8,7 @@ SpringBlade org.springblade - 2.2.0 + 2.2.1 blade-auth diff --git a/blade-common/pom.xml b/blade-common/pom.xml index e4b5955..dc0dff9 100644 --- a/blade-common/pom.xml +++ b/blade-common/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-gateway/pom.xml b/blade-gateway/pom.xml index bf9d62b..bb2afca 100644 --- a/blade-gateway/pom.xml +++ b/blade-gateway/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-ops/blade-admin/pom.xml b/blade-ops/blade-admin/pom.xml index c72e77e..f37dccd 100644 --- a/blade-ops/blade-admin/pom.xml +++ b/blade-ops/blade-admin/pom.xml @@ -5,7 +5,7 @@ blade-ops org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-ops/blade-develop/pom.xml b/blade-ops/blade-develop/pom.xml index 5d379c3..b629e16 100644 --- a/blade-ops/blade-develop/pom.xml +++ b/blade-ops/blade-develop/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-ops - 2.2.0 + 2.2.1 4.0.0 @@ -29,15 +29,9 @@ ${blade.project.version} - com.baomidou - mybatis-plus-generator - ${mybatis.plus.version} - - - - org.apache.velocity - velocity - 1.7 + org.springblade + blade-core-develop + ${blade.tool.version} diff --git a/blade-ops/blade-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java b/blade-ops/blade-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java deleted file mode 100644 index ba3ce22..0000000 --- a/blade-ops/blade-develop/src/main/java/org/springblade/develop/support/BladeCodeGenerator.java +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 org.springblade.develop.support; - -import com.baomidou.mybatisplus.annotation.DbType; -import com.baomidou.mybatisplus.core.toolkit.StringPool; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.generator.AutoGenerator; -import com.baomidou.mybatisplus.generator.InjectionConfig; -import com.baomidou.mybatisplus.generator.config.*; -import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; -import com.baomidou.mybatisplus.generator.config.converts.PostgreSqlTypeConvert; -import com.baomidou.mybatisplus.generator.config.po.TableInfo; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springblade.common.constant.CommonConstant; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PropertiesLoaderUtils; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -/** - * 代码生成器配置类 - * - * @author Chill - */ -@Data -@Slf4j -public class BladeCodeGenerator { - /** - * 代码所在系统 - */ - private String systemName = CommonConstant.SWORD_NAME; - /** - * 代码模块名称 - */ - private String codeName; - /** - * 代码所在服务名 - */ - private String serviceName = "blade-service"; - /** - * 代码生成的包名 - */ - private String packageName = "org.springblade.test"; - /** - * 代码后端生成的地址 - */ - private String packageDir; - /** - * 代码前端生成的地址 - */ - private String packageWebDir; - /** - * 需要去掉的表前缀 - */ - private String[] tablePrefix = {"blade_"}; - /** - * 需要生成的表名(两者只能取其一) - */ - private String[] includeTables = {"blade_test"}; - /** - * 需要排除的表名(两者只能取其一) - */ - private String[] excludeTables = {}; - /** - * 是否包含基础业务字段 - */ - private Boolean hasSuperEntity = Boolean.FALSE; - /** - * 基础业务字段 - */ - private String[] superEntityColumns = {"id", "create_time", "create_user", "update_time", "update_user", "status", "is_deleted"}; - /** - * 租户字段 - */ - private String tenantColumn = "tenant_code"; - /** - * 是否启用swagger - */ - private Boolean isSwagger2 = Boolean.TRUE; - - public void run() { - Properties props = getProperties(); - AutoGenerator mpg = new AutoGenerator(); - GlobalConfig gc = new GlobalConfig(); - String outputDir = getOutputDir(); - String author = props.getProperty("author"); - gc.setOutputDir(outputDir); - gc.setAuthor(author); - gc.setFileOverride(true); - gc.setOpen(false); - gc.setActiveRecord(false); - gc.setEnableCache(false); - gc.setBaseResultMap(true); - gc.setBaseColumnList(true); - gc.setMapperName("%sMapper"); - gc.setXmlName("%sMapper"); - gc.setServiceName("I%sService"); - gc.setServiceImplName("%sServiceImpl"); - gc.setControllerName("%sController"); - gc.setSwagger2(isSwagger2); - mpg.setGlobalConfig(gc); - DataSourceConfig dsc = new DataSourceConfig(); - String driverName = props.getProperty("spring.datasource.driver-class-name"); - if (StringUtil.containsAny(driverName, DbType.MYSQL.getDb())) { - dsc.setDbType(DbType.MYSQL); - dsc.setTypeConvert(new MySqlTypeConvert()); - } else { - dsc.setDbType(DbType.POSTGRE_SQL); - dsc.setTypeConvert(new PostgreSqlTypeConvert()); - } - dsc.setUrl(props.getProperty("spring.datasource.url")); - dsc.setDriverName(driverName); - dsc.setUsername(props.getProperty("spring.datasource.username")); - dsc.setPassword(props.getProperty("spring.datasource.password")); - mpg.setDataSource(dsc); - // 策略配置 - StrategyConfig strategy = new StrategyConfig(); - // strategy.setCapitalMode(true);// 全局大写命名 - // strategy.setDbColumnUnderline(true);//全局下划线命名 - strategy.setNaming(NamingStrategy.underline_to_camel); - strategy.setColumnNaming(NamingStrategy.underline_to_camel); - strategy.setTablePrefix(tablePrefix); - if (includeTables.length > 0) { - strategy.setInclude(includeTables); - } - if (excludeTables.length > 0) { - strategy.setExclude(excludeTables); - } - if (hasSuperEntity) { - strategy.setSuperEntityClass("org.springblade.core.mp.base.BaseEntity"); - strategy.setSuperEntityColumns(superEntityColumns); - strategy.setSuperServiceClass("org.springblade.core.mp.base.BaseService"); - strategy.setSuperServiceImplClass("org.springblade.core.mp.base.BaseServiceImpl"); - } else { - strategy.setSuperServiceClass("com.baomidou.mybatisplus.extension.service.IService"); - strategy.setSuperServiceImplClass("com.baomidou.mybatisplus.extension.service.impl.ServiceImpl"); - } - // 自定义 controller 父类 - strategy.setSuperControllerClass("org.springblade.core.boot.ctrl.BladeController"); - strategy.setEntityBuilderModel(false); - strategy.setEntityLombokModel(true); - strategy.setControllerMappingHyphenStyle(true); - mpg.setStrategy(strategy); - // 包配置 - PackageConfig pc = new PackageConfig(); - // 控制台扫描 - pc.setModuleName(null); - pc.setParent(packageName); - pc.setController("controller"); - pc.setEntity("entity"); - pc.setXml("mapper"); - mpg.setPackageInfo(pc); - mpg.setCfg(getInjectionConfig()); - mpg.execute(); - } - - private InjectionConfig getInjectionConfig() { - String servicePackage = serviceName.split("-").length > 1 ? serviceName.split("-")[1] : serviceName; - // 自定义配置 - Map map = new HashMap<>(16); - InjectionConfig cfg = new InjectionConfig() { - @Override - public void initMap() { - map.put("codeName", codeName); - map.put("serviceName", serviceName); - map.put("servicePackage", servicePackage); - map.put("tenantColumn", tenantColumn); - this.setMap(map); - } - }; - List focList = new ArrayList<>(); - focList.add(new FileOutConfig("/templates/sql/menu.sql.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - map.put("entityKey", (tableInfo.getEntityName().toLowerCase())); - return getOutputDir() + "/" + "/sql/menu.mysql"; - } - }); - focList.add(new FileOutConfig("/templates/entityVO.java.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputDir() + "/" + packageName.replace(".", "/") + "/" + "vo" + "/" + tableInfo.getEntityName() + "VO" + StringPool.DOT_JAVA; - } - }); - focList.add(new FileOutConfig("/templates/entityDTO.java.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputDir() + "/" + packageName.replace(".", "/") + "/" + "dto" + "/" + tableInfo.getEntityName() + "DTO" + StringPool.DOT_JAVA; - } - }); - focList.add(new FileOutConfig("/templates/wrapper.java.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputDir() + "/" + packageName.replace(".", "/") + "/" + "wrapper" + "/" + tableInfo.getEntityName() + "Wrapper" + StringPool.DOT_JAVA; - } - }); - if (Func.isNotBlank(packageWebDir)) { - if (Func.equals(systemName, CommonConstant.SWORD_NAME)) { - focList.add(new FileOutConfig("/templates/sword/action.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/actions" + "/" + tableInfo.getEntityName().toLowerCase() + ".js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/model.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/models" + "/" + tableInfo.getEntityName().toLowerCase() + ".js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/service.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/services" + "/" + tableInfo.getEntityName().toLowerCase() + ".js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/list.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/pages" + "/" + StringUtil.upperFirst(servicePackage) + "/" + tableInfo.getEntityName() + "/" + tableInfo.getEntityName() + ".js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/add.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/pages" + "/" + StringUtil.upperFirst(servicePackage) + "/" + tableInfo.getEntityName() + "/" + tableInfo.getEntityName() + "Add.js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/edit.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/pages" + "/" + StringUtil.upperFirst(servicePackage) + "/" + tableInfo.getEntityName() + "/" + tableInfo.getEntityName() + "Edit.js"; - } - }); - focList.add(new FileOutConfig("/templates/sword/view.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/pages" + "/" + StringUtil.upperFirst(servicePackage) + "/" + tableInfo.getEntityName() + "/" + tableInfo.getEntityName() + "View.js"; - } - }); - } else if (Func.equals(systemName, CommonConstant.SABER_NAME)) { - focList.add(new FileOutConfig("/templates/saber/api.js.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/api" + "/" + servicePackage.toLowerCase() + "/" + tableInfo.getEntityName().toLowerCase() + ".js"; - } - }); - focList.add(new FileOutConfig("/templates/saber/crud.vue.vm") { - @Override - public String outputFile(TableInfo tableInfo) { - return getOutputWebDir() + "/views" + "/" + servicePackage.toLowerCase() + "/" + tableInfo.getEntityName().toLowerCase() + ".vue"; - } - }); - } - } - cfg.setFileOutConfigList(focList); - return cfg; - } - - /** - * 获取配置文件 - * - * @return 配置Props - */ - private Properties getProperties() { - // 读取配置文件 - Resource resource = new ClassPathResource("/templates/props/generator.properties"); - Properties props = new Properties(); - try { - props = PropertiesLoaderUtils.loadProperties(resource); - } catch (IOException e) { - e.printStackTrace(); - } - return props; - } - - /** - * 生成到项目中 - * - * @return outputDir - */ - public String getOutputDir() { - return (Func.isBlank(packageDir) ? System.getProperty("user.dir") + "/blade-ops/blade-develop" : packageDir) + "/src/main/java"; - } - - /** - * 生成到Web项目中 - * - * @return outputDir - */ - public String getOutputWebDir() { - return (Func.isBlank(packageWebDir) ? System.getProperty("user.dir") : packageWebDir) + "/src"; - } - - /** - * 页面生成的文件名 - */ - private String getGeneratorViewPath(String viewOutputDir, TableInfo tableInfo, String suffixPath) { - String name = StringUtils.firstToLowerCase(tableInfo.getEntityName()); - String path = viewOutputDir + "/" + name + "/" + name + suffixPath; - File viewDir = new File(path).getParentFile(); - if (!viewDir.exists()) { - viewDir.mkdirs(); - } - return path; - } - -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/props/generator.properties b/blade-ops/blade-develop/src/main/resources/templates/code.properties similarity index 100% rename from blade-ops/blade-develop/src/main/resources/templates/props/generator.properties rename to blade-ops/blade-develop/src/main/resources/templates/code.properties diff --git a/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm b/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm deleted file mode 100644 index 53f4578..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/controller.java.vm +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Controller}; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import javax.validation.Valid; - -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.system.feign.IDictClient; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; -#if($!{superEntityClass}) -import org.springframework.web.bind.annotation.RequestParam; -#end -import com.baomidou.mybatisplus.core.metadata.IPage; -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) -import $!{wrapperPackage}.$!{entity}Wrapper; -import $!{package.Service}.$!{table.serviceName}; -#if($!{superControllerClassPackage}) -import $!{superControllerClassPackage}; -#end -#if(!$!{superEntityClass}) -#end -import java.util.List; - -/** - * $!{table.comment} 控制器 - * - * @author $!{author} - * @since $!{date} - */ -@RestController -@AllArgsConstructor -@RequestMapping("#if($!{package.ModuleName})/$!{package.ModuleName}#end/$!{cfg.entityKey}") -@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口") -#if($!{superControllerClass}) -public class $!{table.controllerName} extends $!{superControllerClass} { -#else -public class $!{table.controllerName} { -#end - - private $!{table.serviceName} $!{table.entityPath}Service; - - private IDictClient dictClient; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperation(value = "详情", notes = "传入$!{table.entityPath}", position = 1) - public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) { - $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath})); - $!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient); - return R.data($!{table.entityPath}Wrapper.entityVO(detail)); - } - - /** - * 分页 $!{table.comment} - */ - @GetMapping("/list") - @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}", position = 2) - public R> list($!{entity} $!{table.entityPath}, Query query) { - IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath})); - $!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient); - return R.data($!{table.entityPath}Wrapper.pageVO(pages)); - } - - /** - * 自定义分页 $!{table.comment} - */ - @GetMapping("/page") - @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}", position = 3) - public R> page($!{entity}VO $!{table.entityPath}, Query query) { - IPage<$!{entity}VO> pages = $!{table.entityPath}Service.select$!{entity}Page(Condition.getPage(query), $!{table.entityPath}); - return R.data(pages); - } - - /** - * 新增 $!{table.comment} - */ - @PostMapping("/save") - @ApiOperation(value = "新增", notes = "传入$!{table.entityPath}", position = 4) - public R save(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.save($!{table.entityPath})); - } - - /** - * 修改 $!{table.comment} - */ - @PostMapping("/update") - @ApiOperation(value = "修改", notes = "传入$!{table.entityPath}", position = 5) - public R update(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.updateById($!{table.entityPath})); - } - - /** - * 新增或修改 $!{table.comment} - */ - @PostMapping("/submit") - @ApiOperation(value = "新增或修改", notes = "传入$!{table.entityPath}", position = 6) - public R submit(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.saveOrUpdate($!{table.entityPath})); - } - - #if($!{superEntityClass}) - - /** - * 删除 $!{table.comment} - */ - @PostMapping("/remove") - @ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7) - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids))); - } - - #else - - /** - * 删除 $!{table.comment} - */ - @PostMapping("/remove") - @ApiOperation(value = "删除", notes = "传入ids", position = 7) - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids))); - } - - #end - -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/entity.java.vm b/blade-ops/blade-develop/src/main/resources/templates/entity.java.vm deleted file mode 100644 index 9ad9054..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/entity.java.vm +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Entity}; - -#foreach($pkg in $!{table.importPackages}) -import $!{pkg}; -#end -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end -#if($!{swagger2}) -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -#end - -/** - * $!{table.comment}实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -#end -#if($!{table.convert}) -@TableName("$!{table.name}") -#end -#if($!{superEntityClass}) -@EqualsAndHashCode(callSuper = true) -#end -#if($!{swagger2}) -@ApiModel(value = "$!{entity}对象", description = #if ("$!{table.comment}"=="")"$!{entity}对象"#else"$!{table.comment}"#end) -#end -#if($!{superEntityClass}) -public class $!{entity} extends $!{superEntityClass}#if($!{activeRecord})<$!{entity}>#end { -#elseif($!{activeRecord}) -@Accessors(chain = true) -public class $!{entity} extends Model<$!{entity}> { -#else -public class $!{entity} implements Serializable { -#end - - private static final long serialVersionUID = 1L; - -## ---------- BEGIN 字段循环遍历 ---------- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) -#if($!{field.keyFlag}) -#set($keyPropertyName=$!{field.propertyName}) -#end -#if("$!field.comment" != "") - /** - * $!{field.comment} - */ - #if($!{swagger2}) - @ApiModelProperty(value = "$!{field.comment}") - #end -#end -#if($!{field.keyFlag}) -## 主键 -#if($!{field.keyIdentityFlag}) - @TableId(value = "$!{field.name}", type = IdType.AUTO) -#elseif(!$null.isNull($!{idType}) && "$!idType" != "") - @TableId(value = "$!{field.name}", type = IdType.$!{idType}) -#elseif($!{field.convert}) - @TableId("$!{field.name}") -#end -## 普通字段 -#elseif($!{field.fill}) -## ----- 存在字段填充设置 ----- -#if($!{field.convert}) - @TableField(value = "$!{field.name}", fill = FieldFill.$!{field.fill}) -#else - @TableField(fill = FieldFill.$!{field.fill}) -#end -#elseif($!{field.convert}) - @TableField("$!{field.name}") -#end -## 乐观锁注解 -#if($!{versionFieldName}==$!{field.name}) - @Version -#end -## 逻辑删除注解 -#if($!{logicDeleteFieldName}==$!{field.name}) - @TableLogic -#end - private $!{field.propertyType} $!{field.propertyName}; -#end -#end -## ---------- END 字段循环遍历 ---------- - -#if(!$!{entityLombokModel}) -#foreach($field in $!{table.fields}) -#if($!{field.propertyType.equals("boolean")}) -#set($getprefix="is") -#else -#set($getprefix="get") -#end - - public $!{field.propertyType} $!{getprefix}$!{field.capitalName}() { - return $!{field.propertyName}; - } - -#if($!{entityBuilderModel}) - public $!{entity} set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { -#else - public void set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { -#end - this.$!{field.propertyName} = $!{field.propertyName}; -#if($!{entityBuilderModel}) - return this; -#end - } -#end -#end - -#if($!{entityColumnConstant}) -#foreach($field in $!{table.fields}) - public static final String $!{field.name.toUpperCase()} = "$!{field.name}"; - -#end -#end -#if($!{activeRecord}) - @Override - protected Serializable pkVal() { -#if($!{keyPropertyName}) - return this.$!{keyPropertyName}; -#else - return this.id; -#end - } - -#end -#if(!$!{entityLombokModel}) - @Override - public String toString() { - return "$!{entity}{" + -#foreach($field in $!{table.fields}) -#if($!{velocityCount}==1) - "$!{field.propertyName}=" + $!{field.propertyName} + -#else - ", $!{field.propertyName}=" + $!{field.propertyName} + -#end -#end - "}"; - } -#end -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/entityDTO.java.vm b/blade-ops/blade-develop/src/main/resources/templates/entityDTO.java.vm deleted file mode 100644 index a7f0512..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/entityDTO.java.vm +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($dtoPackage=$package.Entity.replace("entity","dto")) -package $!{dtoPackage}; - -import $!{package.Entity}.$!{entity}; -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end - -/** - * $!{table.comment}数据传输对象实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -@EqualsAndHashCode(callSuper = true) -#end -public class $!{entity}DTO extends $!{entity} { - private static final long serialVersionUID = 1L; - -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/entityVO.java.vm b/blade-ops/blade-develop/src/main/resources/templates/entityVO.java.vm deleted file mode 100644 index cc88136..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/entityVO.java.vm +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($voPackage=$package.Entity.replace("entity","vo")) -package $!{voPackage}; - -import $!{package.Entity}.$!{entity}; -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end -#if($!{swagger2}) -import io.swagger.annotations.ApiModel; -#end - -/** - * $!{table.comment}视图实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -@EqualsAndHashCode(callSuper = true) -#end -#if($!{swagger2}) -@ApiModel(value = "$!{entity}VO对象", description = #if ("$!{table.comment}"=="")"$!{entity}VO对象"#else"$!{table.comment}"#end) -#end -public class $!{entity}VO extends $!{entity} { - private static final long serialVersionUID = 1L; - -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/mapper.java.vm b/blade-ops/blade-develop/src/main/resources/templates/mapper.java.vm deleted file mode 100644 index 81f3422..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/mapper.java.vm +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Mapper}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{superMapperClassPackage}; -import com.baomidou.mybatisplus.core.metadata.IPage; -import java.util.List; - -/** - * $!{table.comment} Mapper 接口 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{kotlin}) -interface $!{table.mapperName} : $!{superMapperClass}<$!{entity}> -#else -public interface $!{table.mapperName} extends $!{superMapperClass}<$!{entity}> { - - /** - * 自定义分页 - * - * @param page - * @param $!{table.entityPath} - * @return - */ - List<$!{entity}VO> select$!{entity}Page(IPage page, $!{entity}VO $!{table.entityPath}); - -} -#end diff --git a/blade-ops/blade-develop/src/main/resources/templates/mapper.xml.vm b/blade-ops/blade-develop/src/main/resources/templates/mapper.xml.vm deleted file mode 100644 index 9384ff7..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/mapper.xml.vm +++ /dev/null @@ -1,34 +0,0 @@ - - - - -#if($!{enableCache}) - - - -#end -#if($!{baseResultMap}) - - -#foreach($field in $!{table.fields}) -#if($!{field.keyFlag})##生成主键排在第一位 - -#end -#end -#foreach($field in $!{table.commonFields})##生成公共字段 - -#end -#foreach($field in $!{table.fields}) -#if(!$!{field.keyFlag} && $!{field.name} != $!{cfg.tenantColumn})##生成普通字段 - -#end -#end - - -#end - - - - diff --git a/blade-ops/blade-develop/src/main/resources/templates/saber/api.js.vm b/blade-ops/blade-develop/src/main/resources/templates/saber/api.js.vm deleted file mode 100644 index 0ea8f9c..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/saber/api.js.vm +++ /dev/null @@ -1,50 +0,0 @@ -import request from '@/router/axios'; - -export const getList = (current, size, params) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/list', - method: 'get', - params: { - ...params, - current, - size, - } - }) -} - -export const getDetail = (id) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/detail', - method: 'get', - params: { - id - } - }) -} - -export const remove = (ids) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', - method: 'post', - params: { - ids, - } - }) -} - -export const add = (row) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', - method: 'post', - data: row - }) -} - -export const update = (row) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', - method: 'post', - data: row - }) -} - diff --git a/blade-ops/blade-develop/src/main/resources/templates/saber/crud.vue.vm b/blade-ops/blade-develop/src/main/resources/templates/saber/crud.vue.vm deleted file mode 100644 index 24dad04..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/saber/crud.vue.vm +++ /dev/null @@ -1,176 +0,0 @@ - - - - - diff --git a/blade-ops/blade-develop/src/main/resources/templates/service.java.vm b/blade-ops/blade-develop/src/main/resources/templates/service.java.vm deleted file mode 100644 index 4b37a25..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/service.java.vm +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Service}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{superServiceClassPackage}; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * $!{table.comment} 服务类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{kotlin}) -interface $!{table.serviceName} : $!{superServiceClass}<$!{entity}> -#else -public interface $!{table.serviceName} extends $!{superServiceClass}<$!{entity}> { - - /** - * 自定义分页 - * - * @param page - * @param $!{table.entityPath} - * @return - */ - IPage<$!{entity}VO> select$!{entity}Page(IPage<$!{entity}VO> page, $!{entity}VO $!{table.entityPath}); - -} -#end diff --git a/blade-ops/blade-develop/src/main/resources/templates/serviceImpl.java.vm b/blade-ops/blade-develop/src/main/resources/templates/serviceImpl.java.vm deleted file mode 100644 index d025d13..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/serviceImpl.java.vm +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.ServiceImpl}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{package.Mapper}.$!{table.mapperName}; -import $!{package.Service}.$!{table.serviceName}; -import $!{superServiceImplClassPackage}; -import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * $!{table.comment} 服务实现类 - * - * @author $!{author} - * @since $!{date} - */ -@Service -#if($!{kotlin}) -open class $!{table.serviceImplName} : $!{superServiceImplClass}<$!{table.mapperName}, $!{entity}>(), $!{table.serviceName} { - -} -#else -public class $!{table.serviceImplName} extends $!{superServiceImplClass}<$!{table.mapperName}, $!{entity}> implements $!{table.serviceName} { - - @Override - public IPage<$!{entity}VO> select$!{entity}Page(IPage<$!{entity}VO> page, $!{entity}VO $!{table.entityPath}) { - return page.setRecords(baseMapper.select$!{entity}Page(page, $!{table.entityPath})); - } - -} -#end diff --git a/blade-ops/blade-develop/src/main/resources/templates/sql/menu.sql.vm b/blade-ops/blade-develop/src/main/resources/templates/sql/menu.sql.vm deleted file mode 100644 index 01866c8..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sql/menu.sql.vm +++ /dev/null @@ -1,11 +0,0 @@ -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0); -set @parentid = (SELECT LAST_INSERT_ID()); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0); diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/action.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/action.js.vm deleted file mode 100644 index e0eb476..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/action.js.vm +++ /dev/null @@ -1,37 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -export const $!{upperEntityPath}_NAMESPACE = '$!{table.entityPath}'; - -export function $!{upperEntityPath}_LIST(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/fetchList`, - payload, - }; -} - -export function $!{upperEntityPath}_DETAIL(id) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/fetchDetail`, - payload: { id }, - }; -} - -export function $!{upperEntityPath}_CLEAR_DETAIL() { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/clearDetail`, - payload: {}, - }; -} - -export function $!{upperEntityPath}_SUBMIT(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/submit`, - payload, - }; -} - -export function $!{upperEntityPath}_REMOVE(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/remove`, - payload, - }; -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/add.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/add.js.vm deleted file mode 100644 index 459b1bb..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/add.js.vm +++ /dev/null @@ -1,75 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { Form, Input, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_SUBMIT } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ loading }) => ({ - submitting: loading.effects['$!{table.entityPath}/submit'], -})) -@Form.create() -class $!{entity}Add extends PureComponent { - handleSubmit = e => { - e.preventDefault(); - const { dispatch, form } = this.props; - form.validateFieldsAndScroll((err, values) => { - if (!err) { - dispatch($!{upperEntityPath}_SUBMIT(values)); - } - }); - }; - - render() { - const { - form: { getFieldDecorator }, - submitting, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -

- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {getFieldDecorator('$!{field.propertyName}', { - rules: [ - { - required: true, - message: '请输入$!{field.comment}', - }, - ], - })()} - -#end -#end - -
- - ); - } -} - -export default $!{entity}Add; diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/edit.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/edit.js.vm deleted file mode 100644 index ba2657c..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/edit.js.vm +++ /dev/null @@ -1,99 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { Form, Input, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_DETAIL, $!{upperEntityPath}_SUBMIT } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath}, loading }) => ({ - $!{table.entityPath}, - submitting: loading.effects['$!{table.entityPath}/submit'], -})) -@Form.create() -class $!{entity}Edit extends PureComponent { - componentWillMount() { - const { - dispatch, - match: { - params: { id }, - }, - } = this.props; - dispatch($!{upperEntityPath}_DETAIL(id)); - } - - handleSubmit = e => { - e.preventDefault(); - const { - dispatch, - match: { - params: { id }, - }, - form, - } = this.props; - form.validateFieldsAndScroll((err, values) => { - if (!err) { - const params = { - id, - ...values, - }; - console.log(params); - dispatch($!{upperEntityPath}_SUBMIT(params)); - } - }); - }; - - render() { - const { - form: { getFieldDecorator }, - $!{table.entityPath}: { detail }, - submitting, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -
- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {getFieldDecorator('$!{field.propertyName}', { - rules: [ - { - required: true, - message: '请输入$!{field.comment}', - }, - ], - initialValue: detail.$!{field.propertyName}, - })()} - -#end -#end - -
-
- ); - } -} - -export default $!{entity}Edit; diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/list.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/list.js.vm deleted file mode 100644 index ddb851b..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/list.js.vm +++ /dev/null @@ -1,84 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { connect } from 'dva'; -import { Button, Col, Form, Input, Row } from 'antd'; -import Panel from '../../../components/Panel'; -import { $!{upperEntityPath}_LIST } from '../../../actions/$!{table.entityPath}'; -import Grid from '../../../components/Sword/Grid'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath}, loading }) => ({ - $!{table.entityPath}, - loading: loading.models.$!{table.entityPath}, -})) -@Form.create() -class $!{entity} extends PureComponent { - // ============ 查询 =============== - handleSearch = params => { - const { dispatch } = this.props; - dispatch($!{upperEntityPath}_LIST(params)); - }; - - // ============ 查询表单 =============== - renderSearchForm = onReset => { - const { form } = this.props; - const { getFieldDecorator } = form; - - return ( - - - - {getFieldDecorator('name')()} - - - -
- - -
- -
- ); - }; - - render() { - const code = '$!{table.entityPath}'; - - const { - form, - loading, - $!{table.entityPath}: { data }, - } = this.props; - - const columns = [ -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - { - title: '$!{field.comment}', - dataIndex: '$!{field.propertyName}', - }, -#end -#end - ]; - - return ( - - - - ); - } -} -export default $!{entity}; diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/model.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/model.js.vm deleted file mode 100644 index 9390b88..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/model.js.vm +++ /dev/null @@ -1,88 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import { message } from 'antd'; -import router from 'umi/router'; -import { $!{upperEntityPath}_NAMESPACE } from '../actions/$!{table.entityPath}'; -import { list, submit, detail, remove } from '../services/$!{table.entityPath}'; - -export default { - namespace: $!{upperEntityPath}_NAMESPACE, - state: { - data: { - list: [], - pagination: false, - }, - detail: {}, - }, - effects: { - *fetchList({ payload }, { call, put }) { - const response = yield call(list, payload); - if (response.success) { - yield put({ - type: 'saveList', - payload: { - list: response.data.records, - pagination: { - total: response.data.total, - current: response.data.current, - pageSize: response.data.size, - }, - }, - }); - } - }, - *fetchDetail({ payload }, { call, put }) { - const response = yield call(detail, payload); - if (response.success) { - yield put({ - type: 'saveDetail', - payload: { - detail: response.data, - }, - }); - } - }, - *clearDetail({ payload }, { put }) { - yield put({ - type: 'removeDetail', - payload: { payload }, - }); - }, - *submit({ payload }, { call }) { - const response = yield call(submit, payload); - if (response.success) { - message.success('提交成功'); - router.push('/$!{cfg.servicePackage}/$!{table.entityPath}'); - } - }, - *remove({ payload }, { call }) { - const { - data: { keys }, - success, - } = payload; - const response = yield call(remove, { ids: keys }); - if (response.success) { - success(); - } - }, - }, - reducers: { - saveList(state, action) { - return { - ...state, - data: action.payload, - }; - }, - saveDetail(state, action) { - return { - ...state, - detail: action.payload.detail, - }; - }, - removeDetail(state) { - return { - ...state, - detail: {}, - }; - }, - }, -}; diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/service.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/service.js.vm deleted file mode 100644 index 1ec606a..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/service.js.vm +++ /dev/null @@ -1,26 +0,0 @@ -#set($params="$" + "{stringify" + "(params)" + "}") -import { stringify } from 'qs'; -import func from '../utils/Func'; -import request from '../utils/request'; - -export async function list(params) { - return request(`/api/$!{cfg.serviceName}/$!{cfg.entityKey}/list?$!{params}`); -} - -export async function submit(params) { - return request('/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', { - method: 'POST', - body: params, - }); -} - -export async function detail(params) { - return request(`/api/$!{cfg.serviceName}/$!{cfg.entityKey}/detail?$!{params}`); -} - -export async function remove(params) { - return request('/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', { - method: 'POST', - body: func.toFormData(params), - }); -} diff --git a/blade-ops/blade-develop/src/main/resources/templates/sword/view.js.vm b/blade-ops/blade-develop/src/main/resources/templates/sword/view.js.vm deleted file mode 100644 index 1104856..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/sword/view.js.vm +++ /dev/null @@ -1,76 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import router from 'umi/router'; -import { Form, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_DETAIL } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath} }) => ({ - $!{table.entityPath}, -})) -@Form.create() -class $!{entity}View extends PureComponent { - componentWillMount() { - const { - dispatch, - match: { - params: { id }, - }, - } = this.props; - dispatch($!{upperEntityPath}_DETAIL(id)); - } - - handleEdit = () => { - const { - match: { - params: { id }, - }, - } = this.props; - router.push(`/$!{cfg.servicePackage}/$!{table.entityPath}/edit/$!{id}`); - }; - - render() { - const { - $!{table.entityPath}: { detail }, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -
- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {detail.$!{field.propertyName}} - -#end -#end - -
-
- ); - } -} -export default $!{entity}View; diff --git a/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm b/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm deleted file mode 100644 index 0f79a8e..0000000 --- a/blade-ops/blade-develop/src/main/resources/templates/wrapper.java.vm +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) -package $!{wrapperPackage}; - -import lombok.AllArgsConstructor; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.feign.IDictClient; -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; - -/** - * $!{table.comment}包装类,返回视图层所需的字段 - * - * @author $!{author} - * @since $!{date} - */ -@AllArgsConstructor -public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> { - - private IDictClient dictClient; - - @Override - public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) { - $!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class); - - /*R dict = dictClient.getValue("$!{table.entityPath}" , $!{table.entityPath}VO.getCategory()); - if (dict.isSuccess()) { - String categoryName = dict.getData(); - $!{table.entityPath}VO.setCategoryName(categoryName); - }*/ - - return $!{table.entityPath}VO; - } - -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/props/generator.properties b/blade-ops/blade-develop/src/test/resources/templates/code.properties similarity index 100% rename from blade-ops/blade-develop/src/test/resources/templates/props/generator.properties rename to blade-ops/blade-develop/src/test/resources/templates/code.properties diff --git a/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm b/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm deleted file mode 100644 index 53f4578..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/controller.java.vm +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Controller}; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import javax.validation.Valid; - -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.system.feign.IDictClient; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; -#if($!{superEntityClass}) -import org.springframework.web.bind.annotation.RequestParam; -#end -import com.baomidou.mybatisplus.core.metadata.IPage; -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) -import $!{wrapperPackage}.$!{entity}Wrapper; -import $!{package.Service}.$!{table.serviceName}; -#if($!{superControllerClassPackage}) -import $!{superControllerClassPackage}; -#end -#if(!$!{superEntityClass}) -#end -import java.util.List; - -/** - * $!{table.comment} 控制器 - * - * @author $!{author} - * @since $!{date} - */ -@RestController -@AllArgsConstructor -@RequestMapping("#if($!{package.ModuleName})/$!{package.ModuleName}#end/$!{cfg.entityKey}") -@Api(value = "$!{table.comment}", tags = "$!{table.comment}接口") -#if($!{superControllerClass}) -public class $!{table.controllerName} extends $!{superControllerClass} { -#else -public class $!{table.controllerName} { -#end - - private $!{table.serviceName} $!{table.entityPath}Service; - - private IDictClient dictClient; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperation(value = "详情", notes = "传入$!{table.entityPath}", position = 1) - public R<$!{entity}VO> detail($!{entity} $!{table.entityPath}) { - $!{entity} detail = $!{table.entityPath}Service.getOne(Condition.getQueryWrapper($!{table.entityPath})); - $!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient); - return R.data($!{table.entityPath}Wrapper.entityVO(detail)); - } - - /** - * 分页 $!{table.comment} - */ - @GetMapping("/list") - @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}", position = 2) - public R> list($!{entity} $!{table.entityPath}, Query query) { - IPage<$!{entity}> pages = $!{table.entityPath}Service.page(Condition.getPage(query), Condition.getQueryWrapper($!{table.entityPath})); - $!{entity}Wrapper $!{table.entityPath}Wrapper = new $!{entity}Wrapper(dictClient); - return R.data($!{table.entityPath}Wrapper.pageVO(pages)); - } - - /** - * 自定义分页 $!{table.comment} - */ - @GetMapping("/page") - @ApiOperation(value = "分页", notes = "传入$!{table.entityPath}", position = 3) - public R> page($!{entity}VO $!{table.entityPath}, Query query) { - IPage<$!{entity}VO> pages = $!{table.entityPath}Service.select$!{entity}Page(Condition.getPage(query), $!{table.entityPath}); - return R.data(pages); - } - - /** - * 新增 $!{table.comment} - */ - @PostMapping("/save") - @ApiOperation(value = "新增", notes = "传入$!{table.entityPath}", position = 4) - public R save(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.save($!{table.entityPath})); - } - - /** - * 修改 $!{table.comment} - */ - @PostMapping("/update") - @ApiOperation(value = "修改", notes = "传入$!{table.entityPath}", position = 5) - public R update(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.updateById($!{table.entityPath})); - } - - /** - * 新增或修改 $!{table.comment} - */ - @PostMapping("/submit") - @ApiOperation(value = "新增或修改", notes = "传入$!{table.entityPath}", position = 6) - public R submit(@Valid @RequestBody $!{entity} $!{table.entityPath}) { - return R.status($!{table.entityPath}Service.saveOrUpdate($!{table.entityPath})); - } - - #if($!{superEntityClass}) - - /** - * 删除 $!{table.comment} - */ - @PostMapping("/remove") - @ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7) - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.deleteLogic(Func.toIntList(ids))); - } - - #else - - /** - * 删除 $!{table.comment} - */ - @PostMapping("/remove") - @ApiOperation(value = "删除", notes = "传入ids", position = 7) - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status($!{table.entityPath}Service.removeByIds(Func.toIntList(ids))); - } - - #end - -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/entity.java.vm b/blade-ops/blade-develop/src/test/resources/templates/entity.java.vm deleted file mode 100644 index 9ad9054..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/entity.java.vm +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Entity}; - -#foreach($pkg in $!{table.importPackages}) -import $!{pkg}; -#end -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end -#if($!{swagger2}) -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -#end - -/** - * $!{table.comment}实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -#end -#if($!{table.convert}) -@TableName("$!{table.name}") -#end -#if($!{superEntityClass}) -@EqualsAndHashCode(callSuper = true) -#end -#if($!{swagger2}) -@ApiModel(value = "$!{entity}对象", description = #if ("$!{table.comment}"=="")"$!{entity}对象"#else"$!{table.comment}"#end) -#end -#if($!{superEntityClass}) -public class $!{entity} extends $!{superEntityClass}#if($!{activeRecord})<$!{entity}>#end { -#elseif($!{activeRecord}) -@Accessors(chain = true) -public class $!{entity} extends Model<$!{entity}> { -#else -public class $!{entity} implements Serializable { -#end - - private static final long serialVersionUID = 1L; - -## ---------- BEGIN 字段循环遍历 ---------- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) -#if($!{field.keyFlag}) -#set($keyPropertyName=$!{field.propertyName}) -#end -#if("$!field.comment" != "") - /** - * $!{field.comment} - */ - #if($!{swagger2}) - @ApiModelProperty(value = "$!{field.comment}") - #end -#end -#if($!{field.keyFlag}) -## 主键 -#if($!{field.keyIdentityFlag}) - @TableId(value = "$!{field.name}", type = IdType.AUTO) -#elseif(!$null.isNull($!{idType}) && "$!idType" != "") - @TableId(value = "$!{field.name}", type = IdType.$!{idType}) -#elseif($!{field.convert}) - @TableId("$!{field.name}") -#end -## 普通字段 -#elseif($!{field.fill}) -## ----- 存在字段填充设置 ----- -#if($!{field.convert}) - @TableField(value = "$!{field.name}", fill = FieldFill.$!{field.fill}) -#else - @TableField(fill = FieldFill.$!{field.fill}) -#end -#elseif($!{field.convert}) - @TableField("$!{field.name}") -#end -## 乐观锁注解 -#if($!{versionFieldName}==$!{field.name}) - @Version -#end -## 逻辑删除注解 -#if($!{logicDeleteFieldName}==$!{field.name}) - @TableLogic -#end - private $!{field.propertyType} $!{field.propertyName}; -#end -#end -## ---------- END 字段循环遍历 ---------- - -#if(!$!{entityLombokModel}) -#foreach($field in $!{table.fields}) -#if($!{field.propertyType.equals("boolean")}) -#set($getprefix="is") -#else -#set($getprefix="get") -#end - - public $!{field.propertyType} $!{getprefix}$!{field.capitalName}() { - return $!{field.propertyName}; - } - -#if($!{entityBuilderModel}) - public $!{entity} set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { -#else - public void set$!{field.capitalName}($!{field.propertyType} $!{field.propertyName}) { -#end - this.$!{field.propertyName} = $!{field.propertyName}; -#if($!{entityBuilderModel}) - return this; -#end - } -#end -#end - -#if($!{entityColumnConstant}) -#foreach($field in $!{table.fields}) - public static final String $!{field.name.toUpperCase()} = "$!{field.name}"; - -#end -#end -#if($!{activeRecord}) - @Override - protected Serializable pkVal() { -#if($!{keyPropertyName}) - return this.$!{keyPropertyName}; -#else - return this.id; -#end - } - -#end -#if(!$!{entityLombokModel}) - @Override - public String toString() { - return "$!{entity}{" + -#foreach($field in $!{table.fields}) -#if($!{velocityCount}==1) - "$!{field.propertyName}=" + $!{field.propertyName} + -#else - ", $!{field.propertyName}=" + $!{field.propertyName} + -#end -#end - "}"; - } -#end -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/entityDTO.java.vm b/blade-ops/blade-develop/src/test/resources/templates/entityDTO.java.vm deleted file mode 100644 index a7f0512..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/entityDTO.java.vm +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($dtoPackage=$package.Entity.replace("entity","dto")) -package $!{dtoPackage}; - -import $!{package.Entity}.$!{entity}; -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end - -/** - * $!{table.comment}数据传输对象实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -@EqualsAndHashCode(callSuper = true) -#end -public class $!{entity}DTO extends $!{entity} { - private static final long serialVersionUID = 1L; - -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/entityVO.java.vm b/blade-ops/blade-develop/src/test/resources/templates/entityVO.java.vm deleted file mode 100644 index cc88136..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/entityVO.java.vm +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($voPackage=$package.Entity.replace("entity","vo")) -package $!{voPackage}; - -import $!{package.Entity}.$!{entity}; -#if($!{entityLombokModel}) -import lombok.Data; -import lombok.EqualsAndHashCode; -#end -#if($!{swagger2}) -import io.swagger.annotations.ApiModel; -#end - -/** - * $!{table.comment}视图实体类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{entityLombokModel}) -@Data -@EqualsAndHashCode(callSuper = true) -#end -#if($!{swagger2}) -@ApiModel(value = "$!{entity}VO对象", description = #if ("$!{table.comment}"=="")"$!{entity}VO对象"#else"$!{table.comment}"#end) -#end -public class $!{entity}VO extends $!{entity} { - private static final long serialVersionUID = 1L; - -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/mapper.java.vm b/blade-ops/blade-develop/src/test/resources/templates/mapper.java.vm deleted file mode 100644 index 81f3422..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/mapper.java.vm +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Mapper}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{superMapperClassPackage}; -import com.baomidou.mybatisplus.core.metadata.IPage; -import java.util.List; - -/** - * $!{table.comment} Mapper 接口 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{kotlin}) -interface $!{table.mapperName} : $!{superMapperClass}<$!{entity}> -#else -public interface $!{table.mapperName} extends $!{superMapperClass}<$!{entity}> { - - /** - * 自定义分页 - * - * @param page - * @param $!{table.entityPath} - * @return - */ - List<$!{entity}VO> select$!{entity}Page(IPage page, $!{entity}VO $!{table.entityPath}); - -} -#end diff --git a/blade-ops/blade-develop/src/test/resources/templates/mapper.xml.vm b/blade-ops/blade-develop/src/test/resources/templates/mapper.xml.vm deleted file mode 100644 index 9384ff7..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/mapper.xml.vm +++ /dev/null @@ -1,34 +0,0 @@ - - - - -#if($!{enableCache}) - - - -#end -#if($!{baseResultMap}) - - -#foreach($field in $!{table.fields}) -#if($!{field.keyFlag})##生成主键排在第一位 - -#end -#end -#foreach($field in $!{table.commonFields})##生成公共字段 - -#end -#foreach($field in $!{table.fields}) -#if(!$!{field.keyFlag} && $!{field.name} != $!{cfg.tenantColumn})##生成普通字段 - -#end -#end - - -#end - - - - diff --git a/blade-ops/blade-develop/src/test/resources/templates/saber/api.js.vm b/blade-ops/blade-develop/src/test/resources/templates/saber/api.js.vm deleted file mode 100644 index 0ea8f9c..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/saber/api.js.vm +++ /dev/null @@ -1,50 +0,0 @@ -import request from '@/router/axios'; - -export const getList = (current, size, params) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/list', - method: 'get', - params: { - ...params, - current, - size, - } - }) -} - -export const getDetail = (id) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/detail', - method: 'get', - params: { - id - } - }) -} - -export const remove = (ids) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', - method: 'post', - params: { - ids, - } - }) -} - -export const add = (row) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', - method: 'post', - data: row - }) -} - -export const update = (row) => { - return request({ - url: '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', - method: 'post', - data: row - }) -} - diff --git a/blade-ops/blade-develop/src/test/resources/templates/saber/crud.vue.vm b/blade-ops/blade-develop/src/test/resources/templates/saber/crud.vue.vm deleted file mode 100644 index 24dad04..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/saber/crud.vue.vm +++ /dev/null @@ -1,176 +0,0 @@ - - - - - diff --git a/blade-ops/blade-develop/src/test/resources/templates/service.java.vm b/blade-ops/blade-develop/src/test/resources/templates/service.java.vm deleted file mode 100644 index 4b37a25..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/service.java.vm +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.Service}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{superServiceClassPackage}; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * $!{table.comment} 服务类 - * - * @author $!{author} - * @since $!{date} - */ -#if($!{kotlin}) -interface $!{table.serviceName} : $!{superServiceClass}<$!{entity}> -#else -public interface $!{table.serviceName} extends $!{superServiceClass}<$!{entity}> { - - /** - * 自定义分页 - * - * @param page - * @param $!{table.entityPath} - * @return - */ - IPage<$!{entity}VO> select$!{entity}Page(IPage<$!{entity}VO> page, $!{entity}VO $!{table.entityPath}); - -} -#end diff --git a/blade-ops/blade-develop/src/test/resources/templates/serviceImpl.java.vm b/blade-ops/blade-develop/src/test/resources/templates/serviceImpl.java.vm deleted file mode 100644 index d025d13..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/serviceImpl.java.vm +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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 $!{package.ServiceImpl}; - -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; -import $!{package.Mapper}.$!{table.mapperName}; -import $!{package.Service}.$!{table.serviceName}; -import $!{superServiceImplClassPackage}; -import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.core.metadata.IPage; - -/** - * $!{table.comment} 服务实现类 - * - * @author $!{author} - * @since $!{date} - */ -@Service -#if($!{kotlin}) -open class $!{table.serviceImplName} : $!{superServiceImplClass}<$!{table.mapperName}, $!{entity}>(), $!{table.serviceName} { - -} -#else -public class $!{table.serviceImplName} extends $!{superServiceImplClass}<$!{table.mapperName}, $!{entity}> implements $!{table.serviceName} { - - @Override - public IPage<$!{entity}VO> select$!{entity}Page(IPage<$!{entity}VO> page, $!{entity}VO $!{table.entityPath}) { - return page.setRecords(baseMapper.select$!{entity}Page(page, $!{table.entityPath})); - } - -} -#end diff --git a/blade-ops/blade-develop/src/test/resources/templates/sql/menu.sql.vm b/blade-ops/blade-develop/src/test/resources/templates/sql/menu.sql.vm deleted file mode 100644 index 01866c8..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sql/menu.sql.vm +++ /dev/null @@ -1,11 +0,0 @@ -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0); -set @parentid = (SELECT LAST_INSERT_ID()); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0); -INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) -VALUES (@parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0); diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/action.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/action.js.vm deleted file mode 100644 index e0eb476..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/action.js.vm +++ /dev/null @@ -1,37 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -export const $!{upperEntityPath}_NAMESPACE = '$!{table.entityPath}'; - -export function $!{upperEntityPath}_LIST(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/fetchList`, - payload, - }; -} - -export function $!{upperEntityPath}_DETAIL(id) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/fetchDetail`, - payload: { id }, - }; -} - -export function $!{upperEntityPath}_CLEAR_DETAIL() { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/clearDetail`, - payload: {}, - }; -} - -export function $!{upperEntityPath}_SUBMIT(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/submit`, - payload, - }; -} - -export function $!{upperEntityPath}_REMOVE(payload) { - return { - type: `${$!{upperEntityPath}_NAMESPACE}/remove`, - payload, - }; -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/add.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/add.js.vm deleted file mode 100644 index 459b1bb..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/add.js.vm +++ /dev/null @@ -1,75 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { Form, Input, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_SUBMIT } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ loading }) => ({ - submitting: loading.effects['$!{table.entityPath}/submit'], -})) -@Form.create() -class $!{entity}Add extends PureComponent { - handleSubmit = e => { - e.preventDefault(); - const { dispatch, form } = this.props; - form.validateFieldsAndScroll((err, values) => { - if (!err) { - dispatch($!{upperEntityPath}_SUBMIT(values)); - } - }); - }; - - render() { - const { - form: { getFieldDecorator }, - submitting, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -

- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {getFieldDecorator('$!{field.propertyName}', { - rules: [ - { - required: true, - message: '请输入$!{field.comment}', - }, - ], - })()} - -#end -#end - -
- - ); - } -} - -export default $!{entity}Add; diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/edit.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/edit.js.vm deleted file mode 100644 index ba2657c..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/edit.js.vm +++ /dev/null @@ -1,99 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { Form, Input, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_DETAIL, $!{upperEntityPath}_SUBMIT } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath}, loading }) => ({ - $!{table.entityPath}, - submitting: loading.effects['$!{table.entityPath}/submit'], -})) -@Form.create() -class $!{entity}Edit extends PureComponent { - componentWillMount() { - const { - dispatch, - match: { - params: { id }, - }, - } = this.props; - dispatch($!{upperEntityPath}_DETAIL(id)); - } - - handleSubmit = e => { - e.preventDefault(); - const { - dispatch, - match: { - params: { id }, - }, - form, - } = this.props; - form.validateFieldsAndScroll((err, values) => { - if (!err) { - const params = { - id, - ...values, - }; - console.log(params); - dispatch($!{upperEntityPath}_SUBMIT(params)); - } - }); - }; - - render() { - const { - form: { getFieldDecorator }, - $!{table.entityPath}: { detail }, - submitting, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -
- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {getFieldDecorator('$!{field.propertyName}', { - rules: [ - { - required: true, - message: '请输入$!{field.comment}', - }, - ], - initialValue: detail.$!{field.propertyName}, - })()} - -#end -#end - -
-
- ); - } -} - -export default $!{entity}Edit; diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/list.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/list.js.vm deleted file mode 100644 index ddb851b..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/list.js.vm +++ /dev/null @@ -1,84 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import { connect } from 'dva'; -import { Button, Col, Form, Input, Row } from 'antd'; -import Panel from '../../../components/Panel'; -import { $!{upperEntityPath}_LIST } from '../../../actions/$!{table.entityPath}'; -import Grid from '../../../components/Sword/Grid'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath}, loading }) => ({ - $!{table.entityPath}, - loading: loading.models.$!{table.entityPath}, -})) -@Form.create() -class $!{entity} extends PureComponent { - // ============ 查询 =============== - handleSearch = params => { - const { dispatch } = this.props; - dispatch($!{upperEntityPath}_LIST(params)); - }; - - // ============ 查询表单 =============== - renderSearchForm = onReset => { - const { form } = this.props; - const { getFieldDecorator } = form; - - return ( - - - - {getFieldDecorator('name')()} - - - -
- - -
- -
- ); - }; - - render() { - const code = '$!{table.entityPath}'; - - const { - form, - loading, - $!{table.entityPath}: { data }, - } = this.props; - - const columns = [ -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - { - title: '$!{field.comment}', - dataIndex: '$!{field.propertyName}', - }, -#end -#end - ]; - - return ( - - - - ); - } -} -export default $!{entity}; diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/model.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/model.js.vm deleted file mode 100644 index 9390b88..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/model.js.vm +++ /dev/null @@ -1,88 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import { message } from 'antd'; -import router from 'umi/router'; -import { $!{upperEntityPath}_NAMESPACE } from '../actions/$!{table.entityPath}'; -import { list, submit, detail, remove } from '../services/$!{table.entityPath}'; - -export default { - namespace: $!{upperEntityPath}_NAMESPACE, - state: { - data: { - list: [], - pagination: false, - }, - detail: {}, - }, - effects: { - *fetchList({ payload }, { call, put }) { - const response = yield call(list, payload); - if (response.success) { - yield put({ - type: 'saveList', - payload: { - list: response.data.records, - pagination: { - total: response.data.total, - current: response.data.current, - pageSize: response.data.size, - }, - }, - }); - } - }, - *fetchDetail({ payload }, { call, put }) { - const response = yield call(detail, payload); - if (response.success) { - yield put({ - type: 'saveDetail', - payload: { - detail: response.data, - }, - }); - } - }, - *clearDetail({ payload }, { put }) { - yield put({ - type: 'removeDetail', - payload: { payload }, - }); - }, - *submit({ payload }, { call }) { - const response = yield call(submit, payload); - if (response.success) { - message.success('提交成功'); - router.push('/$!{cfg.servicePackage}/$!{table.entityPath}'); - } - }, - *remove({ payload }, { call }) { - const { - data: { keys }, - success, - } = payload; - const response = yield call(remove, { ids: keys }); - if (response.success) { - success(); - } - }, - }, - reducers: { - saveList(state, action) { - return { - ...state, - data: action.payload, - }; - }, - saveDetail(state, action) { - return { - ...state, - detail: action.payload.detail, - }; - }, - removeDetail(state) { - return { - ...state, - detail: {}, - }; - }, - }, -}; diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/service.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/service.js.vm deleted file mode 100644 index 1ec606a..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/service.js.vm +++ /dev/null @@ -1,26 +0,0 @@ -#set($params="$" + "{stringify" + "(params)" + "}") -import { stringify } from 'qs'; -import func from '../utils/Func'; -import request from '../utils/request'; - -export async function list(params) { - return request(`/api/$!{cfg.serviceName}/$!{cfg.entityKey}/list?$!{params}`); -} - -export async function submit(params) { - return request('/api/$!{cfg.serviceName}/$!{cfg.entityKey}/submit', { - method: 'POST', - body: params, - }); -} - -export async function detail(params) { - return request(`/api/$!{cfg.serviceName}/$!{cfg.entityKey}/detail?$!{params}`); -} - -export async function remove(params) { - return request('/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', { - method: 'POST', - body: func.toFormData(params), - }); -} diff --git a/blade-ops/blade-develop/src/test/resources/templates/sword/view.js.vm b/blade-ops/blade-develop/src/test/resources/templates/sword/view.js.vm deleted file mode 100644 index 1104856..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/sword/view.js.vm +++ /dev/null @@ -1,76 +0,0 @@ -#set($upperEntityPath=$table.entityPath.toUpperCase()) -import React, { PureComponent } from 'react'; -import router from 'umi/router'; -import { Form, Card, Button } from 'antd'; -import { connect } from 'dva'; -import Panel from '../../../components/Panel'; -import styles from '../../../layouts/Sword.less'; -import { $!{upperEntityPath}_DETAIL } from '../../../actions/$!{table.entityPath}'; - -const FormItem = Form.Item; - -@connect(({ $!{table.entityPath} }) => ({ - $!{table.entityPath}, -})) -@Form.create() -class $!{entity}View extends PureComponent { - componentWillMount() { - const { - dispatch, - match: { - params: { id }, - }, - } = this.props; - dispatch($!{upperEntityPath}_DETAIL(id)); - } - - handleEdit = () => { - const { - match: { - params: { id }, - }, - } = this.props; - router.push(`/$!{cfg.servicePackage}/$!{table.entityPath}/edit/$!{id}`); - }; - - render() { - const { - $!{table.entityPath}: { detail }, - } = this.props; - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 }, - md: { span: 10 }, - }, - }; - - const action = ( - - ); - - return ( - -
- -#foreach($field in $!{table.fields}) -#if($!{field.name}!=$!{cfg.tenantColumn}) - - {detail.$!{field.propertyName}} - -#end -#end - -
-
- ); - } -} -export default $!{entity}View; diff --git a/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm b/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm deleted file mode 100644 index 0f79a8e..0000000 --- a/blade-ops/blade-develop/src/test/resources/templates/wrapper.java.vm +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). - *

- * 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 - *

- * http://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. - */ -#set($wrapperPackage=$package.Entity.replace("entity","wrapper")) -package $!{wrapperPackage}; - -import lombok.AllArgsConstructor; -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.system.feign.IDictClient; -import $!{package.Entity}.$!{entity}; -#set($voPackage=$package.Entity.replace("entity","vo")) -import $!{voPackage}.$!{entity}VO; - -/** - * $!{table.comment}包装类,返回视图层所需的字段 - * - * @author $!{author} - * @since $!{date} - */ -@AllArgsConstructor -public class $!{entity}Wrapper extends BaseEntityWrapper<$!{entity}, $!{entity}VO> { - - private IDictClient dictClient; - - @Override - public $!{entity}VO entityVO($!{entity} $!{table.entityPath}) { - $!{entity}VO $!{table.entityPath}VO = BeanUtil.copy($!{table.entityPath}, $!{entity}VO.class); - - /*R dict = dictClient.getValue("$!{table.entityPath}" , $!{table.entityPath}VO.getCategory()); - if (dict.isSuccess()) { - String categoryName = dict.getData(); - $!{table.entityPath}VO.setCategoryName(categoryName); - }*/ - - return $!{table.entityPath}VO; - } - -} diff --git a/blade-ops/pom.xml b/blade-ops/pom.xml index a794479..294cc3c 100644 --- a/blade-ops/pom.xml +++ b/blade-ops/pom.xml @@ -5,7 +5,7 @@ SpringBlade org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service-api/blade-desk-api/pom.xml b/blade-service-api/blade-desk-api/pom.xml index 30fcc68..f01ea5c 100644 --- a/blade-service-api/blade-desk-api/pom.xml +++ b/blade-service-api/blade-desk-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service-api/blade-dict-api/pom.xml b/blade-service-api/blade-dict-api/pom.xml index 29f3cf6..c333f9b 100644 --- a/blade-service-api/blade-dict-api/pom.xml +++ b/blade-service-api/blade-dict-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service-api/blade-system-api/pom.xml b/blade-service-api/blade-system-api/pom.xml index 1f6e07c..fbad37a 100644 --- a/blade-service-api/blade-system-api/pom.xml +++ b/blade-service-api/blade-system-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service-api/blade-user-api/pom.xml b/blade-service-api/blade-user-api/pom.xml index 6ae90c3..9f3e4e4 100644 --- a/blade-service-api/blade-user-api/pom.xml +++ b/blade-service-api/blade-user-api/pom.xml @@ -5,7 +5,7 @@ blade-service-api org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index 4d8c499..0b56a44 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -5,13 +5,13 @@ SpringBlade org.springblade - 2.2.0 + 2.2.1 4.0.0 blade-service-api ${project.artifactId} - 2.2.0 + 2.2.1 pom SpringBlade 微服务API集合 diff --git a/blade-service/blade-desk/pom.xml b/blade-service/blade-desk/pom.xml index 6a9c93c..74ef811 100644 --- a/blade-service/blade-desk/pom.xml +++ b/blade-service/blade-desk/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-service - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service/blade-log/pom.xml b/blade-service/blade-log/pom.xml index 087734c..52ca251 100644 --- a/blade-service/blade-log/pom.xml +++ b/blade-service/blade-log/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service/blade-system/pom.xml b/blade-service/blade-system/pom.xml index 7cf4e40..223b44d 100644 --- a/blade-service/blade-system/pom.xml +++ b/blade-service/blade-system/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java index ff4af68..c1aa4e7 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java @@ -23,7 +23,9 @@ import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.annotation.PreAuth; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.constant.RoleConstant; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.AuthClient; import org.springblade.system.service.IAuthClientService; @@ -42,6 +44,7 @@ import javax.validation.Valid; @RequestMapping("/client") @ApiIgnore @Api(value = "应用管理", tags = "接口") +@PreAuth(RoleConstant.HAS_ROLE_ADMIN) public class AuthClientController extends BladeController { private IAuthClientService clientService; diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java index 9dcfc30..9e3dbdb 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java @@ -20,7 +20,9 @@ import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.annotation.PreAuth; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.constant.RoleConstant; import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.Menu; @@ -44,6 +46,7 @@ import java.util.Map; @AllArgsConstructor @RequestMapping("/menu") @Api(value = "菜单", tags = "菜单") +@PreAuth(RoleConstant.HAS_ROLE_ADMIN) public class MenuController extends BladeController { private IMenuService menuService; diff --git a/blade-service/blade-user/pom.xml b/blade-service/blade-user/pom.xml index 240d5be..49b831c 100644 --- a/blade-service/blade-user/pom.xml +++ b/blade-service/blade-user/pom.xml @@ -5,7 +5,7 @@ blade-service org.springblade - 2.2.0 + 2.2.1 4.0.0 diff --git a/blade-service/pom.xml b/blade-service/pom.xml index f07ad04..3b6bcd0 100644 --- a/blade-service/pom.xml +++ b/blade-service/pom.xml @@ -7,12 +7,12 @@ org.springblade SpringBlade - 2.2.0 + 2.2.1 blade-service ${project.artifactId} - 2.2.0 + 2.2.1 pom SpringBlade 微服务集合 diff --git a/pic/springblade-framework.png b/pic/springblade-framework.png new file mode 100644 index 0000000..12a5fd1 Binary files /dev/null and b/pic/springblade-framework.png differ diff --git a/pom.xml b/pom.xml index 52f1bab..80a3f46 100644 --- a/pom.xml +++ b/pom.xml @@ -5,17 +5,17 @@ org.springblade SpringBlade - 2.2.0 + 2.2.1 pom - 2.2.0 - 2.2.0 + 2.2.1 + 2.2.1 1.8 2.9.2 1.5.21 - 1.9.0 + 1.9.2 3.1.0 4.0.1 1.6.0