10 changed files with 336 additions and 3 deletions
@ -0,0 +1,113 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
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; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据源配置表 控制器 |
||||||
|
* |
||||||
|
* @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) { |
||||||
|
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.toLongList(ids))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
package org.springblade.develop.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据源配置表实体类 |
||||||
|
* |
||||||
|
* @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 = "驱动类") |
||||||
|
private String driverClass; |
||||||
|
/** |
||||||
|
* 连接地址 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "连接地址") |
||||||
|
private String jdbcUrl; |
||||||
|
/** |
||||||
|
* 用户名 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "用户名") |
||||||
|
private String username; |
||||||
|
/** |
||||||
|
* 密码 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "密码") |
||||||
|
private String password; |
||||||
|
/** |
||||||
|
* 备注 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "备注") |
||||||
|
private String remark; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
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="jdbc_url" property="jdbcUrl"/> |
||||||
|
<result column="username" property="username"/> |
||||||
|
<result column="password" property="password"/> |
||||||
|
<result column="remark" property="remark"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
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> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are met: |
||||||
|
* |
||||||
|
* Redistributions of source code must retain the above copyright notice, |
||||||
|
* this list of conditions and the following disclaimer. |
||||||
|
* Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* Neither the name of the dreamlu.net developer nor the names of its |
||||||
|
* contributors may be used to endorse or promote products derived from |
||||||
|
* this software without specific prior written permission. |
||||||
|
* Author: Chill 庄骞 (smallchill@163.com) |
||||||
|
*/ |
||||||
|
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 { |
||||||
|
|
||||||
|
} |
@ -1,2 +1,41 @@ |
|||||||
ALTER TABLE `blade_user` |
ALTER TABLE `blade_user` |
||||||
ADD COLUMN `avatar` varchar(500) NULL COMMENT '头像' AFTER `real_name`; |
ADD COLUMN `avatar` varchar(500) NULL COMMENT '头像' AFTER `real_name`; |
||||||
|
|
||||||
|
CREATE TABLE `blade_datasource` ( |
||||||
|
`id` bigint(64) NOT NULL COMMENT '主键', |
||||||
|
`driver_class` varchar(100) NULL COMMENT '驱动类', |
||||||
|
`jdbc_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`) |
||||||
|
) COMMENT = '数据源配置表' ; |
||||||
|
|
||||||
|
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||||
|
VALUES ('1161272593873321991', '1123598815738675217', 'datasource', '数据源管理', 'menu', '/tool/datasource', 'iconfont icon-caidanguanli', 2, 1, 0, 1, NULL, 0); |
||||||
|
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||||
|
VALUES ('1161272593873321992', '1161272593873321991', 'datasource_add', '新增', 'add', '/tool/datasource/add', 'plus', 1, 2, 1, 1, NULL, 0); |
||||||
|
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||||
|
VALUES ('1161272593873321993', '1161272593873321991', 'datasource_edit', '修改', 'edit', '/tool/datasource/edit', 'form', 2, 2, 2, 2, NULL, 0); |
||||||
|
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||||
|
VALUES ('1161272593873321994', '1161272593873321991', 'datasource_delete', '删除', 'delete', '/api/blade-develop/datasource/remove', 'delete', 3, 2, 3, 3, NULL, 0); |
||||||
|
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`) |
||||||
|
VALUES ('1161272593873321995', '1161272593873321991', 'datasource_view', '查看', 'view', '/tool/datasource/view', 'file-text', 4, 2, 2, 2, NULL, 0); |
||||||
|
|
||||||
|
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`) |
||||||
|
VALUES ('1161272593873322991', '1161272593873321991', '1123598816738675201'); |
||||||
|
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`) |
||||||
|
VALUES ('1161272593873322992', '1161272593873321992', '1123598816738675201'); |
||||||
|
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`) |
||||||
|
VALUES ('1161272593873322993', '1161272593873321993', '1123598816738675201'); |
||||||
|
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`) |
||||||
|
VALUES ('1161272593873322994', '1161272593873321994', '1123598816738675201'); |
||||||
|
INSERT INTO `blade_role_menu`(`id`,`menu_id`,`role_id`) |
||||||
|
VALUES ('1161272593873322995', '1161272593873321995', '1123598816738675201'); |
||||||
|
Loading…
Reference in new issue