mirror of
https://github.com/chillzhuang/SpringBlade.git
synced 2024-12-22 09:09:24 +08:00
🎉 2.4.1.RELEASE
This commit is contained in:
parent
c129a6ad4f
commit
8f182fc863
@ -1,7 +1,7 @@
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-Greenwich.SR2-blue.svg" alt="Coverage Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.6.RELEASE-blue.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.1.7.RELEASE-blue.svg" alt="Downloads">
|
||||
</p>
|
||||
|
||||
## SpringBlade微服务开发平台
|
||||
@ -45,7 +45,8 @@ SpringBlade
|
||||
* 官网地址:[https://bladex.vip](https://bladex.vip)
|
||||
* 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip)
|
||||
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
|
||||
* 交流群:`477853168`
|
||||
* 交流一群:`477853168`
|
||||
* 交流二群:`751253339`
|
||||
|
||||
## 在线演示
|
||||
* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip)
|
||||
|
@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blade-auth</artifactId>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -21,10 +21,14 @@ 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.develop.entity.Code;
|
||||
import org.springblade.develop.entity.Datasource;
|
||||
import org.springblade.develop.service.ICodeService;
|
||||
import org.springblade.develop.service.IDatasourceService;
|
||||
import org.springblade.develop.support.BladeCodeGenerator;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
@ -38,18 +42,22 @@ import java.util.Map;
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@ApiIgnore
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/code")
|
||||
@Api(value = "代码生成", tags = "代码生成")
|
||||
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
|
||||
public class CodeController extends BladeController {
|
||||
|
||||
private ICodeService codeService;
|
||||
private IDatasourceService datasourceService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value = "详情", notes = "传入code")
|
||||
public R<Code> detail(Code code) {
|
||||
Code detail = codeService.getOne(Condition.getQueryWrapper(code));
|
||||
@ -65,6 +73,7 @@ public class CodeController extends BladeController {
|
||||
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "modelName", value = "实体名", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@ApiOperation(value = "分页", notes = "传入code")
|
||||
public R<IPage<Code>> list(@ApiIgnore @RequestParam Map<String, Object> code, Query query) {
|
||||
IPage<Code> pages = codeService.page(Condition.getPage(query), Condition.getQueryWrapper(code, Code.class));
|
||||
@ -75,9 +84,10 @@ public class CodeController extends BladeController {
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@ApiOperation(value = "新增或修改", notes = "传入code")
|
||||
public R submit(@Valid @RequestBody Code code) {
|
||||
return R.status(codeService.saveOrUpdate(code));
|
||||
return R.status(codeService.submit(code));
|
||||
}
|
||||
|
||||
|
||||
@ -85,30 +95,53 @@ public class CodeController extends BladeController {
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@ApiOperation(value = "删除", notes = "传入ids")
|
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(codeService.removeByIds(Func.toIntList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制
|
||||
*/
|
||||
@PostMapping("/copy")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperation(value = "复制", notes = "传入id")
|
||||
public R copy(@ApiParam(value = "主键", required = true) @RequestParam Integer id) {
|
||||
Code code = codeService.getById(id);
|
||||
code.setId(null);
|
||||
code.setCodeName(code.getCodeName() + "-copy");
|
||||
return R.status(codeService.save(code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 代码生成
|
||||
*/
|
||||
@PostMapping("/gen-code")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperation(value = "代码生成", notes = "传入ids")
|
||||
public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
|
||||
Collection<Code> codes = codeService.listByIds(Func.toIntList(ids));
|
||||
codes.forEach(code -> {
|
||||
BladeCodeGenerator generator = new BladeCodeGenerator();
|
||||
// 设置数据源
|
||||
Datasource datasource = datasourceService.getById(code.getDatasourceId());
|
||||
generator.setDriverName(datasource.getDriverClass());
|
||||
generator.setUrl(datasource.getUrl());
|
||||
generator.setUsername(datasource.getUsername());
|
||||
generator.setPassword(datasource.getPassword());
|
||||
// 设置基础配置
|
||||
generator.setSystemName(system);
|
||||
generator.setServiceName(code.getServiceName());
|
||||
generator.setCodeName(code.getCodeName());
|
||||
generator.setPackageName(code.getPackageName());
|
||||
generator.setPackageDir(code.getApiPath());
|
||||
generator.setPackageWebDir(code.getWebPath());
|
||||
generator.setTablePrefix(Func.toStrArray(code.getTablePrefix()));
|
||||
generator.setIncludeTables(Func.toStrArray(code.getTableName()));
|
||||
// 设置是否继承基础业务字段
|
||||
generator.setHasSuperEntity(false);
|
||||
generator.setHasSuperEntity(code.getBaseMode() == 2);
|
||||
// 设置是否开启包装器模式
|
||||
generator.setHasWrapper(code.getWrapMode() == 2);
|
||||
generator.run();
|
||||
});
|
||||
return R.success("代码生成成功");
|
||||
|
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.develop.entity.Datasource;
|
||||
import org.springblade.develop.service.IDatasourceService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据源配置表 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/datasource")
|
||||
@Api(value = "数据源配置表", tags = "数据源配置表接口")
|
||||
public class DatasourceController extends BladeController {
|
||||
|
||||
private IDatasourceService datasourceService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value = "详情", notes = "传入datasource")
|
||||
public R<Datasource> detail(Datasource datasource) {
|
||||
Datasource detail = datasourceService.getOne(Condition.getQueryWrapper(datasource));
|
||||
return R.data(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页 数据源配置表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@ApiOperation(value = "分页", notes = "传入datasource")
|
||||
public R<IPage<Datasource>> list(Datasource datasource, Query query) {
|
||||
IPage<Datasource> pages = datasourceService.page(Condition.getPage(query), Condition.getQueryWrapper(datasource));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增 数据源配置表
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@ApiOperation(value = "新增", notes = "传入datasource")
|
||||
public R save(@Valid @RequestBody Datasource datasource) {
|
||||
return R.status(datasourceService.save(datasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改 数据源配置表
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperation(value = "修改", notes = "传入datasource")
|
||||
public R update(@Valid @RequestBody Datasource datasource) {
|
||||
return R.status(datasourceService.updateById(datasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改 数据源配置表
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperation(value = "新增或修改", notes = "传入datasource")
|
||||
public R submit(@Valid @RequestBody Datasource datasource) {
|
||||
datasource.setUrl(datasource.getUrl().replace("&", "&"));
|
||||
return R.status(datasourceService.saveOrUpdate(datasource));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除 数据源配置表
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperation(value = "逻辑删除", notes = "传入ids")
|
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(datasourceService.deleteLogic(Func.toIntList(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据源列表
|
||||
*/
|
||||
@GetMapping("/select")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperation(value = "下拉数据源", notes = "查询列表")
|
||||
public R<List<Datasource>> select() {
|
||||
List<Datasource> list = datasourceService.list();
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,6 @@ import java.io.Serializable;
|
||||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_code")
|
||||
@ -45,6 +44,12 @@ public class Code implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 数据源主键
|
||||
*/
|
||||
@ApiModelProperty(value = "数据源主键")
|
||||
private Integer datasourceId;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
@ -75,6 +80,18 @@ public class Code implements Serializable {
|
||||
@ApiModelProperty(value = "主键名")
|
||||
private String pkName;
|
||||
|
||||
/**
|
||||
* 基础业务模式
|
||||
*/
|
||||
@ApiModelProperty(value = "基础业务模式")
|
||||
private Integer baseMode;
|
||||
|
||||
/**
|
||||
* 包装器模式
|
||||
*/
|
||||
@ApiModelProperty(value = "包装器模式")
|
||||
private Integer wrapMode;
|
||||
|
||||
/**
|
||||
* 后端包名
|
||||
*/
|
||||
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* 数据源配置表实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_datasource")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Datasource对象", description = "数据源配置表")
|
||||
public class Datasource extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 驱动类
|
||||
*/
|
||||
@ApiModelProperty(value = "驱动类")
|
||||
private String driverClass;
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
@ApiModelProperty(value = "连接地址")
|
||||
private String url;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -22,7 +22,6 @@ import org.springblade.develop.entity.Code;
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface CodeMapper extends BaseMapper<Code> {
|
||||
|
||||
|
@ -5,10 +5,13 @@
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="codeResultMap" type="org.springblade.develop.entity.Code">
|
||||
<id column="id" property="id"/>
|
||||
<result column="datasource_id" property="datasourceId"/>
|
||||
<result column="service_name" property="serviceName"/>
|
||||
<result column="code_name" property="codeName"/>
|
||||
<result column="table_name" property="tableName"/>
|
||||
<result column="pk_name" property="pkName"/>
|
||||
<result column="base_mode" property="baseMode"/>
|
||||
<result column="wrap_mode" property="wrapMode"/>
|
||||
<result column="table_prefix" property="tablePrefix"/>
|
||||
<result column="package_name" property="packageName"/>
|
||||
<result column="api_path" property="apiPath"/>
|
||||
@ -16,10 +19,4 @@
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="baseColumnList">
|
||||
select
|
||||
id, service_name, code_name, table_name, pk_name, model_name, package_name, api_path, web_path, is_deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springblade.develop.entity.Datasource;
|
||||
|
||||
/**
|
||||
* 数据源配置表 Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface DatasourceMapper extends BaseMapper<Datasource> {
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.develop.mapper.DatasourceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="datasourceResultMap" type="org.springblade.develop.entity.Datasource">
|
||||
<result column="id" property="id"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_dept" property="createDept"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="driver_class" property="driverClass"/>
|
||||
<result column="url" property="url"/>
|
||||
<result column="username" property="username"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
@ -23,8 +23,15 @@ import org.springblade.develop.entity.Code;
|
||||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface ICodeService extends IService<Code> {
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean submit(Code code);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.service;
|
||||
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.develop.entity.Datasource;
|
||||
|
||||
/**
|
||||
* 数据源配置表 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IDatasourceService extends BaseService<Datasource> {
|
||||
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
package org.springblade.develop.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.develop.entity.Code;
|
||||
import org.springblade.develop.mapper.CodeMapper;
|
||||
import org.springblade.develop.service.ICodeService;
|
||||
@ -25,9 +26,14 @@ import org.springframework.stereotype.Service;
|
||||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
public class CodeServiceImpl extends ServiceImpl<CodeMapper, Code> implements ICodeService {
|
||||
|
||||
@Override
|
||||
public boolean submit(Code code) {
|
||||
code.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
||||
return saveOrUpdate(code);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* 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
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* 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.service.impl;
|
||||
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.develop.entity.Datasource;
|
||||
import org.springblade.develop.mapper.DatasourceMapper;
|
||||
import org.springblade.develop.service.IDatasourceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据源配置表 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class DatasourceServiceImpl extends BaseServiceImpl<DatasourceMapper, Datasource> implements IDatasourceService {
|
||||
|
||||
}
|
@ -64,7 +64,7 @@ public class CodeGenerator {
|
||||
/**
|
||||
* 基础业务字段
|
||||
*/
|
||||
public static String[] SUPER_ENTITY_COLUMNS = {"id", "create_time", "create_user", "update_time", "update_user", "status", "is_deleted"};
|
||||
public static String[] SUPER_ENTITY_COLUMNS = {"create_time", "create_user", "update_time", "update_user", "status", "is_deleted"};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>SpringBlade 微服务API集合</description>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blade-service</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>SpringBlade 微服务集合</description>
|
||||
|
||||
|
56
doc/sql/blade-mysql-update.sql
Normal file
56
doc/sql/blade-mysql-update.sql
Normal file
@ -0,0 +1,56 @@
|
||||
-- ----------------------------
|
||||
-- 创建数据源配置表
|
||||
-- ----------------------------
|
||||
CREATE TABLE `blade_datasource` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`name` varchar(100) NULL COMMENT '名称',
|
||||
`driver_class` varchar(100) NULL COMMENT '驱动类',
|
||||
`url` varchar(500) NULL COMMENT '连接地址',
|
||||
`username` varchar(50) NULL COMMENT '用户名',
|
||||
`password` varchar(50) NULL COMMENT '密码',
|
||||
`remark` varchar(255) NULL COMMENT '备注',
|
||||
`create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_dept` bigint(64) NULL DEFAULT NULL COMMENT '创建部门',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
|
||||
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
|
||||
`is_deleted` int(2) NULL DEFAULT NULL COMMENT '是否已删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) COMMENT = '数据源配置表' ;
|
||||
|
||||
-- ----------------------------
|
||||
-- 插入数据源默认数据
|
||||
-- ----------------------------
|
||||
INSERT INTO `blade_datasource`(`id`, `name`, `driver_class`, `url`, `username`, `password`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES (1, 'mysql', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true', 'root', 'root', 'mysql', 1, 1, '2019-08-14 11:43:06', 1, '2019-08-14 11:43:06', 1, 0);
|
||||
INSERT INTO `blade_datasource`(`id`, `name`, `driver_class`, `url`, `username`, `password`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES (2, 'postgresql', 'org.postgresql.Driver', 'jdbc:postgresql://127.0.0.1:5432/blade', 'postgres', '123456', 'postgresql', 1, 1, '2019-08-14 11:43:41', 1, '2019-08-14 11:43:41', 1, 0);
|
||||
INSERT INTO `blade_datasource`(`id`, `name`, `driver_class`, `url`, `username`, `password`, `remark`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES (3, 'oracle', 'oracle.jdbc.OracleDriver', 'jdbc:oracle:thin:@127.0.0.1:49161:orcl', 'BLADE', 'blade', 'oracle', 1, 1, '2019-08-14 11:44:03', 1, '2019-08-14 11:44:03', 1, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- 插入数据源菜单数据
|
||||
-- ----------------------------
|
||||
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES (17, 'datasource', '数据源管理', 'menu', '/tool/datasource', 'iconfont icon-caidanguanli', 2, 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, 'datasource_add', '新增', 'add', '/tool/datasource/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, 'datasource_edit', '修改', 'edit', '/tool/datasource/edit', 'form', 2, 2, 2, 2, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES (@parentid, 'datasource_delete', '删除', 'delete', '/api/blade-develop/datasource/remove', 'delete', 3, 2, 3, 3, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES (@parentid, 'datasource_view', '查看', 'view', '/tool/datasource/view', 'file-text', 4, 2, 2, 2, NULL, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- 代码生成表增加数据源字段
|
||||
-- ----------------------------
|
||||
ALTER TABLE `blade_code`
|
||||
ADD COLUMN `datasource_id` bigint(64) NULL COMMENT '数据源主键' AFTER `id`,
|
||||
ADD COLUMN `base_mode` int(2) NULL COMMENT '基础业务模式' AFTER `package_name`,
|
||||
ADD COLUMN `wrap_mode` int(2) NULL COMMENT '包装器模式' AFTER `base_mode`;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 代码生成记录增加数据源字段
|
||||
-- ----------------------------
|
||||
UPDATE `blade_code` SET `datasource_id` = 1, `base_mode` = 1, `wrap_mode` = 1 WHERE `id` = 1;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
pom.xml
10
pom.xml
@ -5,17 +5,17 @@
|
||||
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<version>2.4.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<blade.tool.version>2.4.0</blade.tool.version>
|
||||
<blade.project.version>2.4.0</blade.project.version>
|
||||
<blade.tool.version>2.4.1</blade.tool.version>
|
||||
<blade.project.version>2.4.1</blade.project.version>
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<swagger.models.version>1.5.21</swagger.models.version>
|
||||
<swagger.bootstrapui.version>1.9.5</swagger.bootstrapui.version>
|
||||
<swagger.bootstrapui.version>1.9.4</swagger.bootstrapui.version>
|
||||
<mybatis.plus.version>3.1.2</mybatis.plus.version>
|
||||
<curator.framework.version>4.0.1</curator.framework.version>
|
||||
<protostuff.version>1.6.0</protostuff.version>
|
||||
@ -23,7 +23,7 @@
|
||||
<alibaba.cloud.version>2.1.0.RELEASE</alibaba.cloud.version>
|
||||
<spring.boot.admin.version>2.1.5</spring.boot.admin.version>
|
||||
|
||||
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
|
||||
<spring.boot.version>2.1.7.RELEASE</spring.boot.version>
|
||||
<spring.cloud.version>Greenwich.SR2</spring.cloud.version>
|
||||
<spring.platform.version>Cairo-SR8</spring.platform.version>
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
REGISTER=192.168.0.157/blade
|
||||
TAG=2.4.0
|
||||
TAG=2.4.1
|
||||
|
Loading…
Reference in New Issue
Block a user