feat(dictServiceImpl)资产模型字典表的关联,编辑
parent
596a557ca1
commit
43fec1afd3
|
@ -5,6 +5,7 @@ import com.muyu.common.core.web.controller.BaseController;
|
|||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.vo.DeptVO;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
|
@ -14,6 +15,7 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -33,9 +35,9 @@ public class AccreditController extends BaseController {
|
|||
* 获取表名
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/tableNameList")
|
||||
public Result<List<TableList>> tableNameList(){
|
||||
List<TableList> list = service.tableNameList();
|
||||
@PostMapping("/tableNameList/{databaseName}")
|
||||
public Result<List<TableList>> tableNameList(@PathVariable String databaseName){
|
||||
List<TableList> list = service.tableNameList(databaseName);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
@ -55,8 +57,8 @@ public class AccreditController extends BaseController {
|
|||
* @throws SQLException
|
||||
*/
|
||||
@GetMapping("/listSqlJdbc")
|
||||
public Result listSqlJdbc(@RequestParam String tableName) throws SQLException {
|
||||
return service.listSqlJdbc(tableName);
|
||||
public Result listSqlJdbc(@RequestBody Connection connection, String tableName) throws SQLException {
|
||||
return service.listSqlJdbc(connection,tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,9 +122,9 @@ public class AccreditController extends BaseController {
|
|||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selNameTableList/{name}")
|
||||
public Result<TableList> selNameTableList(@PathVariable String name){
|
||||
TableList tableList = service.selNameTableList(name);
|
||||
@PostMapping("/selNameTableList")
|
||||
public Result<TableList> selNameTableList(@RequestParam String databaseName,@RequestParam String name){
|
||||
TableList tableList = service.selNameTableList(databaseName,name);
|
||||
return success(tableList);
|
||||
}
|
||||
|
||||
|
@ -137,16 +139,6 @@ public class AccreditController extends BaseController {
|
|||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectDictionaryMajor")
|
||||
public Result<List<DictionaryMajor>> selectDictionaryMajor(){
|
||||
List<DictionaryMajor> list = service.selectDictionaryMajor();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态/添加字典
|
||||
* @param listStructure
|
||||
|
@ -162,4 +154,25 @@ public class AccreditController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看父表
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectFrimary")
|
||||
public Result<List<FrimaryVo>> selectFrimary(){
|
||||
List<FrimaryVo> list = service.selectFrimary();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listMiddle")
|
||||
public Result<List<Middle>> listMiddle(@RequestParam String name){
|
||||
List<Middle> middleList = service.listMiddle(name);
|
||||
return success(middleList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -102,13 +102,22 @@ public class DataAccessController extends BaseController
|
|||
return toAjax(dataAccessService.deleteDataAccessByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/oneDataAccess")
|
||||
public Result<DataAccess> oneDataAccess(){
|
||||
DataAccess dataAccess = dataAccessService.oneDataAccess();
|
||||
return success(dataAccess);
|
||||
}
|
||||
/**
|
||||
* 同步
|
||||
* @param dataAccess
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/synchronization")
|
||||
public Result synchronization(@RequestBody DataAccess dataAccess) throws SQLException {
|
||||
public Result synchronization(@RequestBody DataAccess dataAccess) throws Exception {
|
||||
Integer id = dataAccessService.synchronization(dataAccess);
|
||||
if (id>0){
|
||||
return success("成功同步");
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.domain.DataSource;
|
||||
import com.muyu.system.service.IDataSourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取信息Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/source")
|
||||
public class DataSourceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDataSourceService dataSourceService;
|
||||
|
||||
/**
|
||||
* 查询获取信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:source:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<DataSource>> list(DataSource dataSource)
|
||||
{
|
||||
startPage();
|
||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出获取信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:source:export")
|
||||
@Log(title = "获取信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DataSource dataSource)
|
||||
{
|
||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
||||
ExcelUtil<DataSource> util = new ExcelUtil<DataSource>(DataSource.class);
|
||||
util.exportExcel(response, list, "获取信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取获取信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:source:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(dataSourceService.selectDataSourceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增获取信息
|
||||
*/
|
||||
@RequiresPermissions("system:source:add")
|
||||
@Log(title = "获取信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return toAjax(dataSourceService.insertDataSource(dataSource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改获取信息
|
||||
*/
|
||||
@RequiresPermissions("system:source:edit")
|
||||
@Log(title = "获取信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody DataSource dataSource)
|
||||
{
|
||||
return toAjax(dataSourceService.updateDataSource(dataSource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除获取信息
|
||||
*/
|
||||
@RequiresPermissions("system:source:remove")
|
||||
@Log(title = "获取信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import com.muyu.system.service.DictService;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dicts")
|
||||
public class DictController extends BaseController {
|
||||
@Autowired
|
||||
private DictService service;
|
||||
|
||||
/**
|
||||
* 查看字典
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("listDictType")
|
||||
public Result<List<DictType>> listDictType(){
|
||||
List<DictType> list = service.listDictType();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看字典的值
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selDictData/{dictType}")
|
||||
public Result<List<DictData>> selDictData(@PathVariable String dictType){
|
||||
List<DictData> list = service.selDictData(dictType);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
* 新增字典
|
||||
*/
|
||||
@PostMapping("indexDictType/{dictType}")
|
||||
public Result indexDictType(@PathVariable String dictType){
|
||||
Integer id = service.indexDictType(dictType);
|
||||
if (id>0){
|
||||
return success("字典添加成功");
|
||||
}else{
|
||||
return error("字典添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("selectDictData")
|
||||
public Result<DictData> selectDictData(@RequestBody DictData dictData){
|
||||
DictData dictData1 = service.selectDictData(dictData);
|
||||
return success(dictData1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典字段添加
|
||||
* @param dictData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("indexDictData")
|
||||
public Result indexDictData(@RequestBody DictData dictData){
|
||||
Integer id = service.indexDictData(dictData);
|
||||
if (id>0){
|
||||
return success("成功");
|
||||
}else{
|
||||
return error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典属性
|
||||
* @param dictData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("deleteDictData")
|
||||
public Result deleteDictData(@RequestBody DictData dictData){
|
||||
Integer id = service.deleteDictData(dictData);
|
||||
if (id>0){
|
||||
return success("成功");
|
||||
}else{
|
||||
return error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
* 数据接入对象 data_access
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
* @date 2024-04-25
|
||||
*/
|
||||
public class DataAccess extends BaseEntity
|
||||
{
|
||||
|
@ -38,6 +38,14 @@ public class DataAccess extends BaseEntity
|
|||
@Excel(name = "端口号")
|
||||
private String port;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String username;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String password;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
@ -48,19 +56,19 @@ public class DataAccess extends BaseEntity
|
|||
|
||||
/** 初始连接数量 */
|
||||
@Excel(name = "初始连接数量")
|
||||
private Integer initNum;
|
||||
private Long initNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Integer maxNum;
|
||||
private Long maxNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Integer maxWaitTime;
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Integer maxWaitSize;
|
||||
private Long maxWaitSize;
|
||||
|
||||
/** 介绍 */
|
||||
@Excel(name = "介绍")
|
||||
|
@ -120,6 +128,24 @@ public class DataAccess extends BaseEntity
|
|||
{
|
||||
return port;
|
||||
}
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
public void setDatabaseName(String databaseName)
|
||||
{
|
||||
this.databaseName = databaseName;
|
||||
|
@ -138,39 +164,39 @@ public class DataAccess extends BaseEntity
|
|||
{
|
||||
return connectionParam;
|
||||
}
|
||||
public void setInitNum(Integer initNum)
|
||||
public void setInitNum(Long initNum)
|
||||
{
|
||||
this.initNum = initNum;
|
||||
}
|
||||
|
||||
public Integer getInitNum()
|
||||
public Long getInitNum()
|
||||
{
|
||||
return initNum;
|
||||
}
|
||||
public void setMaxNum(Integer maxNum)
|
||||
public void setMaxNum(Long maxNum)
|
||||
{
|
||||
this.maxNum = maxNum;
|
||||
}
|
||||
|
||||
public Integer getMaxNum()
|
||||
public Long getMaxNum()
|
||||
{
|
||||
return maxNum;
|
||||
}
|
||||
public void setMaxWaitTime(Integer maxWaitTime)
|
||||
public void setMaxWaitTime(Long maxWaitTime)
|
||||
{
|
||||
this.maxWaitTime = maxWaitTime;
|
||||
}
|
||||
|
||||
public Integer getMaxWaitTime()
|
||||
public Long getMaxWaitTime()
|
||||
{
|
||||
return maxWaitTime;
|
||||
}
|
||||
public void setMaxWaitSize(Integer maxWaitSize)
|
||||
public void setMaxWaitSize(Long maxWaitSize)
|
||||
{
|
||||
this.maxWaitSize = maxWaitSize;
|
||||
}
|
||||
|
||||
public Integer getMaxWaitSize()
|
||||
public Long getMaxWaitSize()
|
||||
{
|
||||
return maxWaitSize;
|
||||
}
|
||||
|
@ -187,19 +213,21 @@ public class DataAccess extends BaseEntity
|
|||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("systemName", getSystemName())
|
||||
.append("type", getType())
|
||||
.append("host", getHost())
|
||||
.append("port", getPort())
|
||||
.append("databaseName", getDatabaseName())
|
||||
.append("connectionParam", getConnectionParam())
|
||||
.append("initNum", getInitNum())
|
||||
.append("maxNum", getMaxNum())
|
||||
.append("maxWaitTime", getMaxWaitTime())
|
||||
.append("maxWaitSize", getMaxWaitSize())
|
||||
.append("intor", getIntor())
|
||||
.toString();
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("systemName", getSystemName())
|
||||
.append("type", getType())
|
||||
.append("host", getHost())
|
||||
.append("port", getPort())
|
||||
.append("username", getUsername())
|
||||
.append("password", getPassword())
|
||||
.append("databaseName", getDatabaseName())
|
||||
.append("connectionParam", getConnectionParam())
|
||||
.append("initNum", getInitNum())
|
||||
.append("maxNum", getMaxNum())
|
||||
.append("maxWaitTime", getMaxWaitTime())
|
||||
.append("maxWaitSize", getMaxWaitSize())
|
||||
.append("intor", getIntor())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 获取信息对象 data_source
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public class DataSource extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
private Long id;
|
||||
|
||||
/** 链接名 */
|
||||
@Excel(name = "链接名")
|
||||
private String dataSourceName;
|
||||
|
||||
/** 数据库来源系统名称 */
|
||||
@Excel(name = "数据库来源系统名称")
|
||||
private String dataSourceSystemName;
|
||||
|
||||
/** 数据库类型 */
|
||||
@Excel(name = "数据库类型")
|
||||
private Long databaseType;
|
||||
|
||||
/** ip地址 */
|
||||
@Excel(name = "ip地址")
|
||||
private String ip;
|
||||
|
||||
/** 端口号 */
|
||||
@Excel(name = "端口号")
|
||||
private String port;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String username;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String password;
|
||||
|
||||
/** 类型 '查询'/'存储' */
|
||||
@Excel(name = "类型 '查询'/'存储'")
|
||||
private String type;
|
||||
|
||||
/** ','拼接的连接参数 */
|
||||
@Excel(name = "','拼接的连接参数")
|
||||
private String connectionParameter;
|
||||
|
||||
/** ','拼接的连接配置 */
|
||||
@Excel(name = "','拼接的连接配置")
|
||||
private String connectionConfig;
|
||||
|
||||
/** 状态 'Y'/'N' */
|
||||
@Excel(name = "状态 'Y'/'N'")
|
||||
private String status;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setDataSourceName(String dataSourceName)
|
||||
{
|
||||
this.dataSourceName = dataSourceName;
|
||||
}
|
||||
|
||||
public String getDataSourceName()
|
||||
{
|
||||
return dataSourceName;
|
||||
}
|
||||
public void setDataSourceSystemName(String dataSourceSystemName)
|
||||
{
|
||||
this.dataSourceSystemName = dataSourceSystemName;
|
||||
}
|
||||
|
||||
public String getDataSourceSystemName()
|
||||
{
|
||||
return dataSourceSystemName;
|
||||
}
|
||||
public void setDatabaseType(Long databaseType)
|
||||
{
|
||||
this.databaseType = databaseType;
|
||||
}
|
||||
|
||||
public Long getDatabaseType()
|
||||
{
|
||||
return databaseType;
|
||||
}
|
||||
public void setIp(String ip)
|
||||
{
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getIp()
|
||||
{
|
||||
return ip;
|
||||
}
|
||||
public void setPort(String port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setConnectionParameter(String connectionParameter)
|
||||
{
|
||||
this.connectionParameter = connectionParameter;
|
||||
}
|
||||
|
||||
public String getConnectionParameter()
|
||||
{
|
||||
return connectionParameter;
|
||||
}
|
||||
public void setConnectionConfig(String connectionConfig)
|
||||
{
|
||||
this.connectionConfig = connectionConfig;
|
||||
}
|
||||
|
||||
public String getConnectionConfig()
|
||||
{
|
||||
return connectionConfig;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("dataSourceName", getDataSourceName())
|
||||
.append("dataSourceSystemName", getDataSourceSystemName())
|
||||
.append("databaseType", getDatabaseType())
|
||||
.append("ip", getIp())
|
||||
.append("port", getPort())
|
||||
.append("username", getUsername())
|
||||
.append("password", getPassword())
|
||||
.append("type", getType())
|
||||
.append("connectionParameter", getConnectionParameter())
|
||||
.append("connectionConfig", getConnectionConfig())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DictData {
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private Long dictDode;
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
private String dictLabel;
|
||||
/**
|
||||
* 字典键值
|
||||
*/
|
||||
private String dictValue;
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
/**
|
||||
* 样式属性(其他样式扩展)
|
||||
*/
|
||||
private String cssClass;
|
||||
/**
|
||||
* 表格回显样式
|
||||
*/
|
||||
private String listClass;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Boolean isEdit=false;
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DictType {
|
||||
/**
|
||||
* 字典主键
|
||||
*/
|
||||
private Long dictId;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String dictName;
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<DictData> dictDataList;
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DictionaryMajor {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String dictionaryName;
|
||||
/**
|
||||
* 展示
|
||||
*/
|
||||
private String dictionaryExpression;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Frimary {
|
||||
/**
|
||||
* 对接主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String systemName;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String type;
|
||||
}
|
|
@ -1,10 +1,14 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
@ -19,11 +23,65 @@ public class Middle {
|
|||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 部门主键
|
||||
* 对应数据库名
|
||||
*/
|
||||
private Integer deptId;
|
||||
private String databaseName;
|
||||
/**
|
||||
* 对应表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private Integer statusId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 父部门名称
|
||||
*/
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class TableList {
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableName {
|
||||
private String tableName;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserMiddle {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer mid;
|
||||
/**
|
||||
* 接入主键
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 对应数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 对应表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 用户名主键
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer statusId;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.system.domain.TableList;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FrimaryVo {
|
||||
/**
|
||||
* 对接主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String systemName;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 子表
|
||||
*/
|
||||
private List<TableList> tableLists;
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.annotation.Excels;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.system.domain.UserMiddle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserVo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
@Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
private List<SysRole> roles;
|
||||
|
||||
/**
|
||||
* 角色组
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
/**
|
||||
* 岗位组
|
||||
*/
|
||||
private Long[] postIds;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
private String DeptName;
|
||||
|
||||
private List<UserMiddle> userMiddleList;
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccreditMapper {
|
||||
List<TableList> tableNameList();
|
||||
List<TableList> tableNameList(@Param("databaseName") String databaseName);
|
||||
|
||||
|
||||
String database();
|
||||
|
@ -18,25 +19,32 @@ public interface AccreditMapper {
|
|||
|
||||
int getNameSelTable(@Param("s") String s);
|
||||
|
||||
void indexTableName(@Param("s") String s);
|
||||
void indexTableName(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
|
||||
void insertListStructure(ListStructure listStructure);
|
||||
|
||||
void inserttableList(@Param("s") String s);
|
||||
void inserttableList(@Param("databaseName") String databaseName,@Param("s") String s);
|
||||
|
||||
List<ListStructure> listListstructure();
|
||||
|
||||
TableList selNameTableList(@Param("name") String name);
|
||||
TableList selNameTableList(@Param("databaseName") String databaseName, @Param("name") String name);
|
||||
|
||||
List<ListStructure> selNameListStructure(@Param("tableName") String tableName);
|
||||
|
||||
int selectOneTableList(@Param("s") String s);
|
||||
int selectOneTableList(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
int selectOneSqlJdbc(@Param("s") String s);
|
||||
|
||||
List<DictionaryMajor> selectDictionaryMajor();
|
||||
int selectOneSqlJdbc(@Param("databaseName") String databaseName,@Param("s") String s);
|
||||
|
||||
Integer updateListStructure(ListStructure listStructure);
|
||||
|
||||
List<FrimaryVo> selectFrimary();
|
||||
|
||||
Integer selectOneListStructure(ListStructure listStructure);
|
||||
|
||||
void delListStructure(@Param("databaseName") String databaseName);
|
||||
|
||||
void delOneTableList(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
List<Middle> listMiddle(@Param("name") String name);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.system.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
import net.sf.jsqlparser.schema.Database;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,23 @@ public interface DataAccessMapper
|
|||
*/
|
||||
public int deleteDataAccessByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
DataAccess oneDataAccess();
|
||||
|
||||
void insertMiddle(@Param("deptId") Long deptId, @Param("id") Long id);
|
||||
void insertMiddle(@Param("deptId") Long deptId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
void indexFrimary(DataAccess dataAccess);
|
||||
|
||||
Integer oneSelFrimary(DataAccess dataAccess);
|
||||
|
||||
void insertUserMiddle(@Param("userId") Long userId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
Integer selectOneMiddel(@Param("deptId") Long deptId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
Integer selectOneUserMiddel(@Param("userId") Long userId, @Param("id") Long id, @Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
void deleteFrimary(DataAccess dataAccess);
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.muyu.system.domain.DataSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取信息Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface DataSourceMapper
|
||||
{
|
||||
/**
|
||||
* 查询获取信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 获取信息
|
||||
*/
|
||||
public DataSource selectDataSourceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询获取信息列表
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 获取信息集合
|
||||
*/
|
||||
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 新增获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataSource(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 修改获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataSource(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 删除获取信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataSourceById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除获取信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataSourceByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictMapper {
|
||||
|
||||
List<DictType> listDictType();
|
||||
|
||||
List<DictData> selDictData(@Param("dictType") String dictType);
|
||||
|
||||
Integer indexDictType(@Param("dictType") String dictType);
|
||||
|
||||
Integer indexDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictData(DictData dictData);
|
||||
|
||||
DictData selectDictData(DictData dictData);
|
||||
}
|
|
@ -2,29 +2,34 @@ package com.muyu.system.service;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public interface AccreditService {
|
||||
List<TableList> tableNameList();
|
||||
List<TableList> tableNameList(String databaseName);
|
||||
|
||||
List<TableVo> selectTableXml(String tableName);
|
||||
|
||||
List<String> tableNameList2() throws SQLException;
|
||||
|
||||
Result listSqlJdbc(String tableName) throws SQLException;
|
||||
Result listSqlJdbc(Connection connection,String tableName) throws SQLException;
|
||||
|
||||
List<ListStructure> listListstructure();
|
||||
|
||||
TableList selNameTableList(String name);
|
||||
TableList selNameTableList(String databaseName,String name);
|
||||
|
||||
List<ListStructure> selNameListStructure(String tableName);
|
||||
|
||||
List<DictionaryMajor> selectDictionaryMajor();
|
||||
|
||||
Integer updateListStructure(ListStructure listStructure);
|
||||
|
||||
Integer selJDBCStream(DataAccess dataAccess);
|
||||
|
||||
|
||||
List<FrimaryVo> selectFrimary();
|
||||
|
||||
List<Middle> listMiddle(String name);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictService {
|
||||
List<DictType> listDictType();
|
||||
|
||||
List<DictData> selDictData(String dictType);
|
||||
|
||||
Integer indexDictType(String dictType);
|
||||
|
||||
Integer indexDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictData(DictData dictData);
|
||||
|
||||
DictData selectDictData(DictData dictData);
|
||||
}
|
|
@ -60,5 +60,9 @@ public interface IDataAccessService
|
|||
*/
|
||||
public int deleteDataAccessById(Long id);
|
||||
|
||||
Integer synchronization(DataAccess dataAccess) throws SQLException;
|
||||
DataAccess oneDataAccess();
|
||||
|
||||
Integer synchronization(DataAccess dataAccess);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.system.domain.DataSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取信息Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface IDataSourceService
|
||||
{
|
||||
/**
|
||||
* 查询获取信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 获取信息
|
||||
*/
|
||||
public DataSource selectDataSourceById(Long id);
|
||||
|
||||
/**
|
||||
* 查询获取信息列表
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 获取信息集合
|
||||
*/
|
||||
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 新增获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataSource(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 修改获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataSource(DataSource dataSource);
|
||||
|
||||
/**
|
||||
* 批量删除获取信息
|
||||
*
|
||||
* @param ids 需要删除的获取信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataSourceByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除获取信息信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataSourceById(Long id);
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.system.service.impl;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import com.muyu.system.mapper.AccreditMapper;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
|
@ -19,8 +20,8 @@ public class AccreditServiceImpl implements AccreditService {
|
|||
@Autowired
|
||||
private AccreditMapper mapper;
|
||||
@Override
|
||||
public List<TableList> tableNameList() {
|
||||
List<TableList> list = mapper.tableNameList();
|
||||
public List<TableList> tableNameList(String databaseName) {
|
||||
List<TableList> list = mapper.tableNameList(databaseName);
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
@ -36,33 +37,28 @@ public class AccreditServiceImpl implements AccreditService {
|
|||
@Override
|
||||
public List<String> tableNameList2() throws SQLException {
|
||||
List<String> list = mapper.tableNameList2();
|
||||
for (String s : list) {
|
||||
int i = mapper.selectOneTableList(s);
|
||||
if (i>0){
|
||||
}else{
|
||||
mapper.inserttableList(s);
|
||||
}
|
||||
int i1 = mapper.selectOneSqlJdbc(s);
|
||||
if (i1>0){
|
||||
}else{
|
||||
listSqlJdbc(s);
|
||||
}
|
||||
}
|
||||
// for (String s : list) {
|
||||
// int i = mapper.selectOneTableList(s);
|
||||
// if (i>0){
|
||||
// }else{
|
||||
// mapper.inserttableList(s);
|
||||
// }
|
||||
// int i1 = mapper.selectOneSqlJdbc(s);
|
||||
// if (i1>0){
|
||||
// }else{
|
||||
// listSqlJdbc(s);
|
||||
// }
|
||||
// }
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result listSqlJdbc(String tableName) throws SQLException {
|
||||
PreparedStatement pst = null;
|
||||
Connection conn = null;
|
||||
String database = mapper.database();
|
||||
conn = DriverManager.getConnection("jdbc:mysql://129.211.23.219:3306/"+ database +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8","root","Qq4152637");
|
||||
public Result listSqlJdbc(Connection connection,String tableName) throws SQLException {
|
||||
try {
|
||||
pst = conn.prepareCall("select * from " + tableName);
|
||||
// ResultSetMetaData rsd = pst.executeQuery().getMetaData();
|
||||
PreparedStatement pst = connection.prepareCall("select * from " + tableName);
|
||||
ResultSetMetaData rsd = pst.getMetaData();
|
||||
//获取元数据
|
||||
DatabaseMetaData metaData = conn.getMetaData();
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
Map<String,String> columnComments =getColumnComments(metaData,tableName);
|
||||
for (int i = 0; i < rsd.getColumnCount(); i++) {
|
||||
System.out.println("java类型"+rsd.getColumnClassName(i+1));
|
||||
|
@ -122,8 +118,8 @@ public class AccreditServiceImpl implements AccreditService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TableList selNameTableList(String name) {
|
||||
return mapper.selNameTableList(name);
|
||||
public TableList selNameTableList(String databaseName,String name) {
|
||||
return mapper.selNameTableList(databaseName,name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,10 +127,6 @@ public class AccreditServiceImpl implements AccreditService {
|
|||
return mapper.selNameListStructure(tableName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictionaryMajor> selectDictionaryMajor() {
|
||||
return mapper.selectDictionaryMajor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateListStructure(ListStructure listStructure) {
|
||||
|
@ -150,27 +142,40 @@ public class AccreditServiceImpl implements AccreditService {
|
|||
@Override
|
||||
public Integer selJDBCStream(DataAccess dataAccess) {
|
||||
Integer id = 0;
|
||||
|
||||
try {
|
||||
//加载数据库驱动
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
System.out.println(driver);
|
||||
|
||||
//获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://129.211.23.219:3306/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8","root","Qq4152637");
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?serverTimezone=UTC",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
System.out.println(driver);
|
||||
System.out.println(connection);
|
||||
id = 1;
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (Exception e) {
|
||||
id = 0;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println();
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FrimaryVo> selectFrimary() {
|
||||
List<FrimaryVo> list = mapper.selectFrimary();
|
||||
for (FrimaryVo frimaryVo : list) {
|
||||
List<TableList> tableLists = mapper.tableNameList(frimaryVo.getDatabaseName());
|
||||
frimaryVo.setTableLists(tableLists);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Middle> listMiddle(String name) {
|
||||
return mapper.listMiddle(name);
|
||||
}
|
||||
|
||||
//获取字段注解
|
||||
private Map<String,String> getColumnComments(DatabaseMetaData metaData,String typeName){
|
||||
Map<String,String> columnComents = new HashMap<>();
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.controller.AccreditController;
|
||||
import com.muyu.system.domain.ListStructure;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import com.muyu.system.mapper.AccreditMapper;
|
||||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.mapper.SysUserMapper;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.DataAccessMapper;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
import com.muyu.system.service.IDataAccessService;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
||||
|
||||
/**
|
||||
* 数据接入Service业务层处理
|
||||
|
@ -28,6 +39,11 @@ public class DataAccessServiceImpl implements IDataAccessService
|
|||
private SysDeptMapper sysDeptMapper;
|
||||
@Autowired
|
||||
private AccreditService accreditService;
|
||||
@Autowired
|
||||
private AccreditMapper accreditMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据接入
|
||||
|
@ -101,22 +117,155 @@ public class DataAccessServiceImpl implements IDataAccessService
|
|||
return dataAccessMapper.deleteDataAccessById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer synchronization(DataAccess dataAccess) throws SQLException {
|
||||
public DataAccess oneDataAccess() {
|
||||
return dataAccessMapper.oneDataAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer synchronization(DataAccess dataAccess) {
|
||||
Integer id = 0;
|
||||
/**
|
||||
* 获取所有的部门
|
||||
*/
|
||||
List<SysDept> list = sysDeptMapper.listDeptList();
|
||||
for (SysDept sysDept : list) {
|
||||
//添加中间件
|
||||
dataAccessMapper.insertMiddle(sysDept.getDeptId(),dataAccess.getId());
|
||||
List<String> stringList = new ArrayList<>();
|
||||
//获取连接
|
||||
//加载数据库驱动
|
||||
try {
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
System.out.println(driver);
|
||||
//获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
//获取数据库名
|
||||
//获取数据库的元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
System.out.println(metaData);
|
||||
//获取全部表名
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet rs = statement.executeQuery("SHOW TABLES");
|
||||
while (rs.next()){
|
||||
stringList.add(rs.getString(1));
|
||||
}
|
||||
System.out.println(stringList);
|
||||
accreditMapper.delListStructure(dataAccess.getDatabaseName());
|
||||
//处理表名
|
||||
for (String s : stringList) {
|
||||
int i1 = accreditMapper.selectOneSqlJdbc(dataAccess.getDatabaseName(),s);
|
||||
if (i1>0){
|
||||
}else{
|
||||
PreparedStatement pst = connection.prepareCall("select * from " + s);
|
||||
ResultSetMetaData rsd = pst.getMetaData();
|
||||
//获取元数据
|
||||
DatabaseMetaData metaData1 = connection.getMetaData();
|
||||
Map<String,String> columnComments =getColumnComments(metaData,s);
|
||||
//添加数据结构
|
||||
for (int i = 0; i < rsd.getColumnCount(); i++) {
|
||||
System.out.println("java类型" + rsd.getColumnClassName(i + 1));
|
||||
System.out.println("数据库类型" + rsd.getColumnTypeName(i + 1));
|
||||
System.out.println("字段名称" + rsd.getColumnName(i + 1));
|
||||
System.out.println("表名" + rsd.getTableName(i + 1));
|
||||
System.out.println("数据库名" + rsd.getCatalogName(i + 1));
|
||||
System.out.println("模式名" + rsd.getSchemaName(i + 1));
|
||||
System.out.println("列数" + rsd.getColumnCount());
|
||||
System.out.println("列类型" + rsd.getColumnType(i + 1));
|
||||
System.out.println("列标签" + rsd.getColumnLabel(i + 1));
|
||||
System.out.println("列显示大小" + rsd.getColumnDisplaySize(i + 1));
|
||||
System.out.println("精度" + rsd.getPrecision(i + 1));
|
||||
System.out.println("规模" + rsd.getScale(i + 1));
|
||||
System.out.println("自增" + rsd.isAutoIncrement(i + 1));
|
||||
System.out.println("是否为空" + rsd.isNullable(i + 1));
|
||||
System.out.println("区分大小写" + rsd.isCaseSensitive(i + 1));
|
||||
System.out.println("是否是货币" + rsd.isCurrency(i + 1));
|
||||
System.out.println("可搜索" + rsd.isSearchable(i + 1));
|
||||
System.out.println("签署" + rsd.isSigned(i + 1));
|
||||
System.out.println("绝对可以写" + rsd.isDefinitelyWritable(i + 1));
|
||||
System.out.println("只读" + rsd.isReadOnly(i + 1));
|
||||
System.out.println("是可写的" + rsd.isWritable(i + 1));
|
||||
System.out.println("注解" + columnComments.get(rsd.getColumnName(i + 1)));
|
||||
ListStructure listStructure = new ListStructure();
|
||||
//获取数据库名
|
||||
listStructure.setCatalogName(rsd.getCatalogName(i + 1));
|
||||
//获取表名
|
||||
listStructure.setTableName(rsd.getTableName(i + 1));
|
||||
//获取java类型
|
||||
listStructure.setColumnLassName(rsd.getColumnClassName(i + 1));
|
||||
//获取映射类型
|
||||
listStructure.setColumnTypeName(rsd.getColumnTypeName(i + 1));
|
||||
//获取字段名称
|
||||
listStructure.setColumnName(rsd.getColumnName(i + 1));
|
||||
//获取长度
|
||||
listStructure.setPrecisions(rsd.getPrecision(i + 1));
|
||||
//获取小数
|
||||
listStructure.setScale(rsd.getScale(i + 1));
|
||||
//获取非空
|
||||
listStructure.setIsNull(rsd.isNullable(i + 1));
|
||||
//获取默认
|
||||
listStructure.setSchemaName(rsd.getSchemaName(i + 1));
|
||||
//获取注解
|
||||
listStructure.setColumnComments(columnComments.get(rsd.getColumnName(i + 1)));
|
||||
accreditMapper.insertListStructure(listStructure);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取所有的部门
|
||||
*/
|
||||
List<SysDept> list = sysDeptMapper.listDeptList();
|
||||
for (SysDept sysDept : list) {
|
||||
Integer sysDeptIds = dataAccessMapper.selectOneMiddel(sysDept.getDeptId(),dataAccess.getId(),dataAccess.getDatabaseName(),s);
|
||||
if (sysDeptIds == 0){
|
||||
//添加中间件
|
||||
dataAccessMapper.insertMiddle(sysDept.getDeptId(),dataAccess.getId(),dataAccess.getDatabaseName(),s);
|
||||
}
|
||||
}
|
||||
//获取所有用户
|
||||
List<SysUserVo> sysUserVos = sysUserMapper.listSelectSysUser();
|
||||
for (SysUserVo sysUserVo : sysUserVos) {
|
||||
Integer sysUserVoIds = dataAccessMapper.selectOneUserMiddel(sysUserVo.getUserId(),dataAccess.getId(),dataAccess.getDatabaseName(),s);
|
||||
if (sysUserVoIds == 0){
|
||||
//添加中间件
|
||||
dataAccessMapper.insertUserMiddle(sysUserVo.getUserId(),dataAccess.getId(),dataAccess.getDatabaseName(),s);
|
||||
}
|
||||
}
|
||||
//框架子类
|
||||
int i = accreditMapper.selectOneTableList(dataAccess.getDatabaseName(), s);
|
||||
if (i>0){
|
||||
accreditMapper.delOneTableList(dataAccess.getDatabaseName(), s);
|
||||
accreditMapper.inserttableList(dataAccess.getDatabaseName(),s);
|
||||
}else{
|
||||
accreditMapper.inserttableList(dataAccess.getDatabaseName(),s);
|
||||
}
|
||||
}
|
||||
//关闭连接
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//获取结构父类比表
|
||||
Integer in = dataAccessMapper.oneSelFrimary(dataAccess);
|
||||
if (in<=0){
|
||||
dataAccessMapper.indexFrimary(dataAccess);
|
||||
}else{
|
||||
dataAccessMapper.deleteFrimary(dataAccess);
|
||||
dataAccessMapper.indexFrimary(dataAccess);
|
||||
}
|
||||
/**
|
||||
* 添加表名
|
||||
*/
|
||||
accreditService.tableNameList2();
|
||||
id = 1;
|
||||
return id;
|
||||
}
|
||||
|
||||
//获取字段注解
|
||||
private Map<String,String> getColumnComments(DatabaseMetaData metaData,String typeName){
|
||||
Map<String,String> columnComents = new HashMap<>();
|
||||
try (ResultSet colums = metaData.getColumns(null,null,typeName,null)){
|
||||
while (colums.next()){
|
||||
String columsName = colums.getString("COLUMN_NAME");
|
||||
String columsComment = colums.getString("REMARKS");
|
||||
columnComents.put(columsName,columsComment);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return columnComents;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.system.domain.DataSource;
|
||||
import com.muyu.system.mapper.DataSourceMapper;
|
||||
import com.muyu.system.service.IDataSourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取信息Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@Service
|
||||
public class DataSourceServiceImpl implements IDataSourceService
|
||||
{
|
||||
@Autowired
|
||||
private DataSourceMapper dataSourceMapper;
|
||||
|
||||
/**
|
||||
* 查询获取信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 获取信息
|
||||
*/
|
||||
@Override
|
||||
public DataSource selectDataSourceById(Long id)
|
||||
{
|
||||
return dataSourceMapper.selectDataSourceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询获取信息列表
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 获取信息
|
||||
*/
|
||||
@Override
|
||||
public List<DataSource> selectDataSourceList(DataSource dataSource)
|
||||
{
|
||||
return dataSourceMapper.selectDataSourceList(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDataSource(DataSource dataSource)
|
||||
{
|
||||
dataSource.setCreateTime(DateUtils.getNowDate());
|
||||
return dataSourceMapper.insertDataSource(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改获取信息
|
||||
*
|
||||
* @param dataSource 获取信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDataSource(DataSource dataSource)
|
||||
{
|
||||
dataSource.setUpdateTime(DateUtils.getNowDate());
|
||||
return dataSourceMapper.updateDataSource(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除获取信息
|
||||
*
|
||||
* @param ids 需要删除的获取信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataSourceByIds(Long[] ids)
|
||||
{
|
||||
return dataSourceMapper.deleteDataSourceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除获取信息信息
|
||||
*
|
||||
* @param id 获取信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataSourceById(Long id)
|
||||
{
|
||||
return dataSourceMapper.deleteDataSourceById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import com.muyu.system.mapper.DictMapper;
|
||||
import com.muyu.system.service.DictService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DictServiceImpl implements DictService {
|
||||
@Autowired
|
||||
private DictMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DictType> listDictType() {
|
||||
List<DictType> list = mapper.listDictType();
|
||||
for (DictType dictType : list) {
|
||||
List<DictData> list1 = selDictData(dictType.getDictType());
|
||||
dictType.setDictDataList(list1);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictData> selDictData(String dictType) {
|
||||
return mapper.selDictData(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer indexDictType(String dictType) {
|
||||
Integer id = mapper.indexDictType(dictType);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer indexDictData(DictData dictData) {
|
||||
return mapper.indexDictData(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictData(DictData dictData) {
|
||||
return mapper.deleteDictData(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData selectDictData(DictData dictData) {
|
||||
return mapper.selectDictData(dictData);
|
||||
}
|
||||
}
|
|
@ -4,16 +4,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.system.mapper.AccreditMapper">
|
||||
<insert id="indexTableName">
|
||||
insert into table_name (table_name)
|
||||
values (#{s});
|
||||
insert into table_name (database_name,table_name)
|
||||
values (,#{databaseName}#{s});
|
||||
</insert>
|
||||
<insert id="insertListStructure">
|
||||
insert into list_structure (catalog_name,table_name,column_lass_name,column_type_name,column_name,precisions,scale,is_null,schema_name,column_comments)
|
||||
values (#{catalogName},#{tableName},#{columnLassName},#{columnTypeName},#{columnName},#{precisions},#{scale},#{isNull},#{schemaName},#{columnComments});
|
||||
</insert>
|
||||
<insert id="inserttableList">
|
||||
insert into tableList (name)
|
||||
values (#{s});
|
||||
insert into tableList (database_name,name)
|
||||
values (#{databaseName},#{s});
|
||||
</insert>
|
||||
<update id="updateListStructure">
|
||||
update list_structure
|
||||
|
@ -30,6 +30,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
schema_name = #{schemaName} and
|
||||
column_comments = #{columnComments}
|
||||
</update>
|
||||
<delete id="delListStructure">
|
||||
delete
|
||||
from list_structure
|
||||
where catalog_name = #{databaseName};
|
||||
</delete>
|
||||
<delete id="delOneTableList">
|
||||
delete
|
||||
from tableList
|
||||
where name = #{s} and database_name = #{databaseName};
|
||||
</delete>
|
||||
<select id="selectTableXml" resultType="com.muyu.system.domain.vo.TableVo">
|
||||
SELECT *
|
||||
FROM information_schema.columns
|
||||
|
@ -47,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="tableNameList" resultType="com.muyu.system.domain.TableList">
|
||||
select *
|
||||
from tableList
|
||||
from tableList where database_name = #{databaseName}
|
||||
</select>
|
||||
<select id="listListstructure" resultType="com.muyu.system.domain.ListStructure">
|
||||
select *
|
||||
|
@ -55,28 +65,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="selNameTableList" resultType="com.muyu.system.domain.TableList">
|
||||
select *
|
||||
from tableList where name = #{name}
|
||||
from tableList where name = #{name} and database_name = #{databaseName}
|
||||
</select>
|
||||
<select id="selNameListStructure" resultType="com.muyu.system.domain.ListStructure">
|
||||
select *
|
||||
from list_structure
|
||||
<where>
|
||||
<if test="tableName!=null and tableName!=''">
|
||||
table_name = #{tableName}
|
||||
</if>
|
||||
</where>
|
||||
where table_name = #{tableName} or catalog_name = #{tableName}
|
||||
</select>
|
||||
<select id="selectOneTableList" resultType="java.lang.Integer">
|
||||
select count(name)
|
||||
from tableList where name = #{s};
|
||||
from tableList where name = #{s} and database_name = #{databaseName};
|
||||
</select>
|
||||
<select id="selectOneSqlJdbc" resultType="java.lang.Integer">
|
||||
select count(table_name)
|
||||
from list_structure where table_name = #{s};
|
||||
</select>
|
||||
<select id="selectDictionaryMajor" resultType="com.muyu.system.domain.DictionaryMajor">
|
||||
<select id="selectFrimary" resultType="com.muyu.system.domain.vo.FrimaryVo">
|
||||
select *
|
||||
from dictionary_major
|
||||
from frimary
|
||||
</select>
|
||||
<select id="selectOneListStructure" resultType="java.lang.Integer">
|
||||
select count(table_name)
|
||||
from list_structure where catalog_name = #{catalogName} and table_name = #{tableName} and column_name = #{columnName};
|
||||
</select>
|
||||
<select id="listMiddle" resultType="com.muyu.system.domain.Middle">
|
||||
select *
|
||||
from middle
|
||||
where database_name = #{name} or table_name = #{name};
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="type" column="type" />
|
||||
<result property="host" column="host" />
|
||||
<result property="port" column="port" />
|
||||
<result property="username" column="username" />
|
||||
<result property="password" column="password" />
|
||||
<result property="databaseName" column="databaseName" />
|
||||
<result property="connectionParam" column="connectionParam" />
|
||||
<result property="initNum" column="initNum" />
|
||||
|
@ -21,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectDataAccessVo">
|
||||
select id, name, systemName, type, host, port, databaseName, connectionParam, initNum, maxNum, maxWaitTime, maxWaitSize, intor from data_access
|
||||
select id, name, systemName, type, host, port, username, password, databaseName, connectionParam, initNum, maxNum, maxWaitTime, maxWaitSize, intor from data_access
|
||||
</sql>
|
||||
|
||||
<select id="selectDataAccessList" parameterType="com.muyu.system.domain.DataAccess" resultMap="DataAccessResult">
|
||||
|
@ -45,6 +47,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectDataAccessVo"/>
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
<select id="indexFrimary">
|
||||
insert into frimary (id,name,systemName,databaseName)
|
||||
values (#{id},#{name},#{systemName},#{databaseName});
|
||||
</select>
|
||||
<select id="oneSelFrimary" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from frimary where id = #{id} and databaseName = #{databaseName}
|
||||
</select>
|
||||
<select id="selectOneMiddel" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from middle where dept_id = #{deptId} and id = #{id} and database_name = #{databaseName} and table_name = #{tableName}
|
||||
</select>
|
||||
<select id="selectOneUserMiddel" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from user_maiddle where id = #{id} and user_id = #{userId} and database_name = #{databaseName} and table_name = #{tableName}
|
||||
</select>
|
||||
|
||||
<insert id="insertDataAccess" parameterType="com.muyu.system.domain.DataAccess" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into data_access
|
||||
|
@ -54,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="host != null and host != ''">host,</if>
|
||||
<if test="port != null and port != ''">port,</if>
|
||||
<if test="username != null and username != ''">username,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="databaseName != null and databaseName != ''">databaseName,</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">connectionParam,</if>
|
||||
<if test="initNum != null">initNum,</if>
|
||||
|
@ -68,6 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="host != null and host != ''">#{host},</if>
|
||||
<if test="port != null and port != ''">#{port},</if>
|
||||
<if test="username != null and username != ''">#{username},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="databaseName != null and databaseName != ''">#{databaseName},</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">#{connectionParam},</if>
|
||||
<if test="initNum != null">#{initNum},</if>
|
||||
|
@ -78,8 +100,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
<insert id="insertMiddle">
|
||||
insert into middle (id,dept_id,status_id)
|
||||
values (#{id},#{deptId},0);
|
||||
insert into middle (id,dept_id,database_name,table_name,status_id)
|
||||
values (#{id},#{deptId},#{databaseName},#{tableName},0);
|
||||
</insert>
|
||||
<insert id="insertUserMiddle">
|
||||
insert into user_maiddle (id,user_id,database_name,table_name,status_id)
|
||||
values (#{id},#{userId},#{databaseName},#{tableName},0);
|
||||
</insert>
|
||||
|
||||
<update id="updateDataAccess" parameterType="com.muyu.system.domain.DataAccess">
|
||||
|
@ -90,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="host != null and host != ''">host = #{host},</if>
|
||||
<if test="port != null and port != ''">port = #{port},</if>
|
||||
<if test="username != null and username != ''">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="databaseName != null and databaseName != ''">databaseName = #{databaseName},</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">connectionParam = #{connectionParam},</if>
|
||||
<if test="initNum != null">initNum = #{initNum},</if>
|
||||
|
@ -111,4 +139,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteFrimary">
|
||||
delete
|
||||
from frimary
|
||||
where id = #{id} and databaseName = #{databaseName}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
<?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="com.muyu.system.mapper.DataSourceMapper">
|
||||
|
||||
<resultMap type="com.muyu.system.domain.DataSource" id="DataSourceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dataSourceName" column="data_source_name" />
|
||||
<result property="dataSourceSystemName" column="data_source_system_name" />
|
||||
<result property="databaseType" column="database_type" />
|
||||
<result property="ip" column="ip" />
|
||||
<result property="port" column="port" />
|
||||
<result property="username" column="username" />
|
||||
<result property="password" column="password" />
|
||||
<result property="type" column="type" />
|
||||
<result property="connectionParameter" column="connection_parameter" />
|
||||
<result property="connectionConfig" column="connection_config" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDataSourceVo">
|
||||
select id, data_source_name, data_source_system_name, database_type, ip, port, username, password, type, connection_parameter, connection_config, status, create_by, create_time, update_by, update_time from data_source
|
||||
</sql>
|
||||
|
||||
<select id="selectDataSourceList" parameterType="com.muyu.system.domain.DataSource" resultMap="DataSourceResult">
|
||||
<include refid="selectDataSourceVo"/>
|
||||
<where>
|
||||
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
|
||||
<if test="dataSourceSystemName != null and dataSourceSystemName != ''"> and data_source_system_name like concat('%', #{dataSourceSystemName}, '%')</if>
|
||||
<if test="databaseType != null "> and database_type = #{databaseType}</if>
|
||||
<if test="ip != null and ip != ''"> and ip = #{ip}</if>
|
||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
|
||||
<include refid="selectDataSourceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDataSource" parameterType="com.muyu.system.domain.DataSource" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into data_source
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceName != null and dataSourceName != ''">data_source_name,</if>
|
||||
<if test="dataSourceSystemName != null and dataSourceSystemName != ''">data_source_system_name,</if>
|
||||
<if test="databaseType != null">database_type,</if>
|
||||
<if test="ip != null and ip != ''">ip,</if>
|
||||
<if test="port != null and port != ''">port,</if>
|
||||
<if test="username != null and username != ''">username,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="connectionParameter != null">connection_parameter,</if>
|
||||
<if test="connectionConfig != null">connection_config,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataSourceName != null and dataSourceName != ''">#{dataSourceName},</if>
|
||||
<if test="dataSourceSystemName != null and dataSourceSystemName != ''">#{dataSourceSystemName},</if>
|
||||
<if test="databaseType != null">#{databaseType},</if>
|
||||
<if test="ip != null and ip != ''">#{ip},</if>
|
||||
<if test="port != null and port != ''">#{port},</if>
|
||||
<if test="username != null and username != ''">#{username},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="connectionParameter != null">#{connectionParameter},</if>
|
||||
<if test="connectionConfig != null">#{connectionConfig},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDataSource" parameterType="com.muyu.system.domain.DataSource">
|
||||
update data_source
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dataSourceName != null and dataSourceName != ''">data_source_name = #{dataSourceName},</if>
|
||||
<if test="dataSourceSystemName != null and dataSourceSystemName != ''">data_source_system_name = #{dataSourceSystemName},</if>
|
||||
<if test="databaseType != null">database_type = #{databaseType},</if>
|
||||
<if test="ip != null and ip != ''">ip = #{ip},</if>
|
||||
<if test="port != null and port != ''">port = #{port},</if>
|
||||
<if test="username != null and username != ''">username = #{username},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="connectionParameter != null">connection_parameter = #{connectionParameter},</if>
|
||||
<if test="connectionConfig != null">connection_config = #{connectionConfig},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDataSourceById" parameterType="Long">
|
||||
delete from data_source where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDataSourceByIds" parameterType="String">
|
||||
delete from data_source where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,32 @@
|
|||
<?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="com.muyu.system.mapper.DictMapper">
|
||||
<insert id="indexDictType">
|
||||
insert into dict_type (dict_type)
|
||||
values (#{dictType});
|
||||
</insert>
|
||||
<insert id="indexDictData">
|
||||
insert into dict_data (dict_label,dict_value,dict_type)
|
||||
values (#{dictLabel},#{dictValue},#{dictType});
|
||||
</insert>
|
||||
<delete id="deleteDictData">
|
||||
delete
|
||||
from dict_data
|
||||
where dict_label = #{dictLabel} and dict_value = #{dictValue} and dict_type=#{dictType};
|
||||
</delete>
|
||||
|
||||
<select id="listDictType" resultType="com.muyu.system.domain.DictType">
|
||||
select *
|
||||
from dict_type
|
||||
</select>
|
||||
<select id="selDictData" resultType="com.muyu.system.domain.DictData">
|
||||
select *
|
||||
from dict_data where dict_type = #{dictType}
|
||||
</select>
|
||||
<select id="selectDictData" resultType="com.muyu.system.domain.DictData">
|
||||
select *
|
||||
from dict_data where dict_label=#{dictLabel} and dict_value=#{dictValue} and dict_type=#{dictType}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue