This commit is contained in:
18326186802 2021-07-15 13:32:42 +08:00
parent b369889400
commit 14c18c38e9
20 changed files with 2452 additions and 0 deletions

138
bps-kettle/pom.xml Normal file
View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.6.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bps-kettle</artifactId>
<properties>
<kettle-version>9.0.0.0-423</kettle-version>
<janino-version>2.5.16</janino-version>
<javascript-version>1.7.2</javascript-version>
<jxl-version>2.6.12</jxl-version>
</properties>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<!--丝袜哥-->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
<scope>compile</scope>
</dependency>
<!-- kettle核心依赖 -->
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<version>${kettle-version}</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<version>${kettle-version}</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-dbdialog</artifactId>
<version>${kettle-version}</version>
</dependency>
<dependency>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>kettle-sap-plugin-core</artifactId>
<version>${kettle-version}</version>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-ui-swt</artifactId>
<version>${kettle-version}</version>
</dependency>
<!--kettle执行复杂脚本需要此包如执行js组件-->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>${janino-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
<artifactId>org.mozilla.javascript</artifactId>
<version>${javascript-version}</version>
</dependency>
<!-- kettle plugin excel-->
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>${jxl-version}</version>
</dependency>
<!-- 降低MySQL版本kettle中连接mysql资源库使用的是低版本驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.48</version>
</dependency>
<!-- sqlserver(native)连接方式驱动-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<!-- sqlser连接驱动-->
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>pentaho</id>
<url>https://nexus.pentaho.org/content/groups/omni/</url>
</repository>
</repositories>
<!-- <properties>-->
<!-- <maven.compiler.source>8</maven.compiler.source>-->
<!-- <maven.compiler.target>8</maven.compiler.target>-->
<!-- </properties>-->
</project>

View File

@ -0,0 +1,142 @@
package com.ruoyi.kettle.controller;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.system.service.ISysRoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kettle.domain.KettleTrans;
import com.ruoyi.kettle.service.IKettleTransService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 转换Controller
*
* @author kone
* @date 2021-07-14
*/
@Controller
@RequestMapping("/kettle/trans")
public class KettleTransController extends BaseController
{
private String prefix = "kettle/trans";
@Autowired
private IKettleTransService kettleTransService;
@Autowired
private ISysRoleService roleService;
@RequiresPermissions("kettle:trans:view")
@GetMapping()
public String trans()
{
return prefix + "/trans";
}
/**
* 查询转换列表
*/
@RequiresPermissions("kettle:trans:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(KettleTrans kettleTrans)
{
startPage();
List<KettleTrans> list = kettleTransService.selectKettleTransList(kettleTrans);
return getDataTable(list);
}
/**
* 导出转换列表
*/
@RequiresPermissions("kettle:trans:export")
@Log(title = "转换", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(KettleTrans kettleTrans)
{
List<KettleTrans> list = kettleTransService.selectKettleTransList(kettleTrans);
ExcelUtil<KettleTrans> util = new ExcelUtil<KettleTrans>(KettleTrans.class);
return util.exportExcel(list, "转换数据");
}
/**
* 新增转换
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
List<String> roleKeys=roleService.selectRoleAll().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
mmap.put("allRoles",roleKeys);
return prefix + "/add";
}
/**
* 新增保存转换
*/
@RequiresPermissions("kettle:trans:add")
@Log(title = "转换", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(KettleTrans kettleTrans)
{
return toAjax(kettleTransService.insertKettleTrans(kettleTrans));
}
/**
* 修改转换
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
KettleTrans kettleTrans = kettleTransService.selectKettleTransById(id);
List<String> roleKeys=roleService.selectRoleAll().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
String rks="";
if(kettleTrans!=null && kettleTrans.getRoleKey()!=null){
rks=kettleTrans.getRoleKey();
}
String[] rkArray=rks.split(",");
mmap.put("allRoles",roleKeys);
mmap.put("kettleTrans", kettleTrans);
mmap.put("rkArray",rkArray);
return prefix + "/edit";
}
/**
* 修改保存转换
*/
@RequiresPermissions("kettle:trans:edit")
@Log(title = "转换", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(KettleTrans kettleTrans)
{
return toAjax(kettleTransService.updateKettleTrans(kettleTrans));
}
/**
* 删除转换
*/
@RequiresPermissions("kettle:trans:remove")
@Log(title = "转换", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(kettleTransService.deleteKettleTransByIds(ids));
}
}

View File

@ -0,0 +1,126 @@
package com.ruoyi.kettle.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kettle.domain.XRepository;
import com.ruoyi.kettle.service.IXRepositoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 资源库Controller
*
* @author kone
* @date 2021-07-12
*/
@Controller
@RequestMapping("/kettle/repository")
public class XRepositoryController extends BaseController
{
private String prefix = "kettle/repository";
@Autowired
private IXRepositoryService xRepositoryService;
@RequiresPermissions("kettle:repository:view")
@GetMapping()
public String repository()
{
return prefix + "/repository";
}
/**
* 查询资源库列表
*/
@RequiresPermissions("kettle:repository:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(XRepository xRepository)
{
startPage();
List<XRepository> list = xRepositoryService.selectXRepositoryList(xRepository);
return getDataTable(list);
}
/**
* 导出资源库列表
*/
@RequiresPermissions("kettle:repository:export")
@Log(title = "资源库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(XRepository xRepository)
{
List<XRepository> list = xRepositoryService.selectXRepositoryList(xRepository);
ExcelUtil<XRepository> util = new ExcelUtil<XRepository>(XRepository.class);
return util.exportExcel(list, "资源库数据");
}
/**
* 新增资源库
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存资源库
*/
@RequiresPermissions("kettle:repository:add")
@Log(title = "资源库", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(XRepository xRepository)
{
return toAjax(xRepositoryService.insertXRepository(xRepository));
}
/**
* 修改资源库
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
XRepository xRepository = xRepositoryService.selectXRepositoryById(id);
mmap.put("xRepository", xRepository);
return prefix + "/edit";
}
/**
* 修改保存资源库
*/
@RequiresPermissions("kettle:repository:edit")
@Log(title = "资源库", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(XRepository xRepository)
{
return toAjax(xRepositoryService.updateXRepository(xRepository));
}
/**
* 删除资源库
*/
@RequiresPermissions("kettle:repository:remove")
@Log(title = "资源库", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(xRepositoryService.deleteXRepositoryByIds(ids));
}
}

View File

@ -0,0 +1,220 @@
package com.ruoyi.kettle.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 转换对象 kettle_trans
*
* @author kone
* @date 2021-07-14
*/
public class KettleTrans extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 转换名称 */
@Excel(name = "转换名称")
private String transName;
/** 转换描述 */
@Excel(name = "转换描述")
private String transDescription;
/** */
private Date createdTime;
/** */
private String createdBy;
/** 转换类型(file,ftp,sf) */
private String transType;
/** 路径 */
@Excel(name = "路径")
private String transPath;
/** 所属资源库id */
@Excel(name = "所属资源库id")
private Long transRepositoryId;
/** 日志级别 */
@Excel(name = "日志级别")
private String transLogLevel;
/** 状态 */
@Excel(name = "状态")
private String transStatus;
/** 是否删除 */
@Excel(name = "是否删除")
private Integer isDel;
/** 是否启用 */
@Excel(name = "是否启用")
private Integer isMonitorEnabled;
/** 保留备用 */
private String tplKey;
/** 可执行角色key,用+号拼接 */
@Excel(name = "可执行角色key")
private String roleKey;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTransName(String transName)
{
this.transName = transName;
}
public String getTransName()
{
return transName;
}
public void setTransDescription(String transDescription)
{
this.transDescription = transDescription;
}
public String getTransDescription()
{
return transDescription;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setTransType(String transType)
{
this.transType = transType;
}
public String getTransType()
{
return transType;
}
public void setTransPath(String transPath)
{
this.transPath = transPath;
}
public String getTransPath()
{
return transPath;
}
public void setTransRepositoryId(Long transRepositoryId)
{
this.transRepositoryId = transRepositoryId;
}
public Long getTransRepositoryId()
{
return transRepositoryId;
}
public void setTransLogLevel(String transLogLevel)
{
this.transLogLevel = transLogLevel;
}
public String getTransLogLevel()
{
return transLogLevel;
}
public void setTransStatus(String transStatus)
{
this.transStatus = transStatus;
}
public String getTransStatus()
{
return transStatus;
}
public void setIsDel(Integer isDel)
{
this.isDel = isDel;
}
public Integer getIsDel()
{
return isDel;
}
public void setIsMonitorEnabled(Integer isMonitorEnabled)
{
this.isMonitorEnabled = isMonitorEnabled;
}
public Integer getIsMonitorEnabled()
{
return isMonitorEnabled;
}
public void setTplKey(String tplKey)
{
this.tplKey = tplKey;
}
public String getTplKey()
{
return tplKey;
}
public void setRoleKey(String roleKey)
{
this.roleKey = roleKey;
}
public String getRoleKey()
{
return roleKey;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("transName", getTransName())
.append("transDescription", getTransDescription())
.append("createdTime", getCreatedTime())
.append("updateTime", getUpdateTime())
.append("createdBy", getCreatedBy())
.append("updateBy", getUpdateBy())
.append("transType", getTransType())
.append("transPath", getTransPath())
.append("transRepositoryId", getTransRepositoryId())
.append("transLogLevel", getTransLogLevel())
.append("transStatus", getTransStatus())
.append("isDel", getIsDel())
.append("isMonitorEnabled", getIsMonitorEnabled())
.append("tplKey", getTplKey())
.append("roleKey", getRoleKey())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,256 @@
package com.ruoyi.kettle.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 资源库对象 kettle_repository
*
* @author kone
* @date 2021-07-12
*/
public class XRepository extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** */
@Excel(name = "")
private String repoId;
/** 资源库名称 */
@Excel(name = "资源库名称")
private String repoName;
/** 当资源库类型是db时候的用户名 */
private String repoUsername;
/** 当资源库类型是db时候的密码 */
private String repoPassword;
/** db类型 */
private String repoType;
/** 当资源库类型是db时候的连接类型 */
private String dbAccess;
/** 当资源库类型是db时候的ip */
private String dbHost;
/** 当资源库类型是db时候的端口 */
private String dbPort;
/** 当资源库类型是db时候的db库名 */
private String dbName;
/** 当资源库类型是db时候的db用户名 */
private String dbUsername;
/** 当资源库类型是db时候的db用户密码 */
private String dbPassword;
/** 软删除 */
private int isDel;
/** */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
/** */
@Excel(name = "")
private String createdBy;
/** 资源库类型 */
@Excel(name = "资源库类型")
private String type;
/** 基础路径 */
@Excel(name = "基础路径")
private String baseDir;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setRepoId(String repoId)
{
this.repoId = repoId;
}
public String getRepoId()
{
return repoId;
}
public void setRepoName(String repoName)
{
this.repoName = repoName;
}
public String getRepoName()
{
return repoName;
}
public void setRepoUsername(String repoUsername)
{
this.repoUsername = repoUsername;
}
public String getRepoUsername()
{
return repoUsername;
}
public void setRepoPassword(String repoPassword)
{
this.repoPassword = repoPassword;
}
public String getRepoPassword()
{
return repoPassword;
}
public void setRepoType(String repoType)
{
this.repoType = repoType;
}
public String getRepoType()
{
return repoType;
}
public void setDbAccess(String dbAccess)
{
this.dbAccess = dbAccess;
}
public String getDbAccess()
{
return dbAccess;
}
public void setDbHost(String dbHost)
{
this.dbHost = dbHost;
}
public String getDbHost()
{
return dbHost;
}
public void setDbPort(String dbPort)
{
this.dbPort = dbPort;
}
public String getDbPort()
{
return dbPort;
}
public void setDbName(String dbName)
{
this.dbName = dbName;
}
public String getDbName()
{
return dbName;
}
public void setDbUsername(String dbUsername)
{
this.dbUsername = dbUsername;
}
public String getDbUsername()
{
return dbUsername;
}
public void setDbPassword(String dbPassword)
{
this.dbPassword = dbPassword;
}
public String getDbPassword()
{
return dbPassword;
}
public void setIsDel(int isDel)
{
this.isDel = isDel;
}
public int getIsDel()
{
return isDel;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setBaseDir(String baseDir)
{
this.baseDir = baseDir;
}
public String getBaseDir()
{
return baseDir;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("repoId", getRepoId())
.append("repoName", getRepoName())
.append("repoUsername", getRepoUsername())
.append("repoPassword", getRepoPassword())
.append("repoType", getRepoType())
.append("dbAccess", getDbAccess())
.append("dbHost", getDbHost())
.append("dbPort", getDbPort())
.append("dbName", getDbName())
.append("dbUsername", getDbUsername())
.append("dbPassword", getDbPassword())
.append("isDel", getIsDel())
.append("createdTime", getCreatedTime())
.append("updateTime", getUpdateTime())
.append("createdBy", getCreatedBy())
.append("updateBy", getUpdateBy())
.append("type", getType())
.append("baseDir", getBaseDir())
.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.kettle.mapper;
import java.util.List;
import com.ruoyi.kettle.domain.KettleTrans;
import org.apache.ibatis.annotations.Param;
/**
* 转换Mapper接口
*
* @author kone
* @date 2021-07-14
*/
public interface KettleTransMapper
{
/**
* 查询转换
*
* @param id 转换ID
* @return 转换
*/
public KettleTrans selectKettleTransById(Long id);
/**
* 查询转换列表
*
* @param kettleTrans 转换
* @param roleKey
* @return 转换集合
*/
public List<KettleTrans> selectKettleTransList(@Param("KettleTrans") KettleTrans kettleTrans,@Param("roleKey") List<String> roleKey);
/**
* 新增转换
*
* @param kettleTrans 转换
* @return 结果
*/
public int insertKettleTrans(KettleTrans kettleTrans);
/**
* 修改转换
*
* @param kettleTrans 转换
* @return 结果
*/
public int updateKettleTrans(KettleTrans kettleTrans);
/**
* 删除转换
*
* @param id 转换ID
* @return 结果
*/
public int deleteKettleTransById(Long id);
/**
* 批量删除转换
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteKettleTransByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.kettle.mapper;
import java.util.List;
import com.ruoyi.kettle.domain.XRepository;
/**
* 资源库Mapper接口
*
* @author kone
* @date 2021-07-12
*/
public interface XRepositoryMapper
{
/**
* 查询资源库
*
* @param id 资源库ID
* @return 资源库
*/
public XRepository selectXRepositoryById(Long id);
/**
* 查询资源库列表
*
* @param xRepository 资源库
* @return 资源库集合
*/
public List<XRepository> selectXRepositoryList(XRepository xRepository);
/**
* 新增资源库
*
* @param xRepository 资源库
* @return 结果
*/
public int insertXRepository(XRepository xRepository);
/**
* 修改资源库
*
* @param xRepository 资源库
* @return 结果
*/
public int updateXRepository(XRepository xRepository);
/**
* 删除资源库
*
* @param id 资源库ID
* @return 结果
*/
public int deleteXRepositoryById(Long id);
/**
* 批量删除资源库
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteXRepositoryByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.kettle.service;
import java.util.List;
import com.ruoyi.kettle.domain.KettleTrans;
/**
* 转换Service接口
*
* @author kone
* @date 2021-07-14
*/
public interface IKettleTransService
{
/**
* 查询转换
*
* @param id 转换ID
* @return 转换
*/
public KettleTrans selectKettleTransById(Long id);
/**
* 查询转换列表
*
* @param kettleTrans 转换
* @return 转换集合
*/
public List<KettleTrans> selectKettleTransList(KettleTrans kettleTrans);
/**
* 新增转换
*
* @param kettleTrans 转换
* @return 结果
*/
public int insertKettleTrans(KettleTrans kettleTrans);
/**
* 修改转换
*
* @param kettleTrans 转换
* @return 结果
*/
public int updateKettleTrans(KettleTrans kettleTrans);
/**
* 批量删除转换
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteKettleTransByIds(String ids);
/**
* 删除转换信息
*
* @param id 转换ID
* @return 结果
*/
public int deleteKettleTransById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.kettle.service;
import java.util.List;
import com.ruoyi.kettle.domain.XRepository;
/**
* 资源库Service接口
*
* @author kone
* @date 2021-07-12
*/
public interface IXRepositoryService
{
/**
* 查询资源库
*
* @param id 资源库ID
* @return 资源库
*/
public XRepository selectXRepositoryById(Long id);
/**
* 查询资源库列表
*
* @param xRepository 资源库
* @return 资源库集合
*/
public List<XRepository> selectXRepositoryList(XRepository xRepository);
/**
* 新增资源库
*
* @param xRepository 资源库
* @return 结果
*/
public int insertXRepository(XRepository xRepository);
/**
* 修改资源库
*
* @param xRepository 资源库
* @return 结果
*/
public int updateXRepository(XRepository xRepository);
/**
* 批量删除资源库
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteXRepositoryByIds(String ids);
/**
* 删除资源库信息
*
* @param id 资源库ID
* @return 结果
*/
public int deleteXRepositoryById(Long id);
}

View File

@ -0,0 +1,124 @@
package com.ruoyi.kettle.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.security.PermissionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kettle.mapper.KettleTransMapper;
import com.ruoyi.kettle.domain.KettleTrans;
import com.ruoyi.kettle.service.IKettleTransService;
import com.ruoyi.common.core.text.Convert;
/**
* 转换Service业务层处理
*
* @author kone
* @date 2021-07-14
*/
@Service
public class KettleTransServiceImpl implements IKettleTransService
{
@Autowired
private KettleTransMapper kettleTransMapper;
/**
* 查询转换
*
* @param id 转换ID
* @return 转换
*/
@Override
public KettleTrans selectKettleTransById(Long id)
{
return kettleTransMapper.selectKettleTransById(id);
}
/**
* 查询转换列表
*
* @param kettleTrans 转换
* @return 转换
*/
@Override
public List<KettleTrans> selectKettleTransList(KettleTrans kettleTrans)
{
List<SysRole> roleList = (List<SysRole>) PermissionUtils.getPrincipalProperty("roles");
//当前用户的roleKey
List<String> roleKeys=roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toList());
return kettleTransMapper.selectKettleTransList(kettleTrans,roleKeys);
}
/**
* 新增转换
*
* @param kettleTrans 转换
* @return 结果
*/
@Override
public int insertKettleTrans(KettleTrans kettleTrans)
{
String userName = (String) PermissionUtils.getPrincipalProperty("userName");
if(kettleTrans.getRoleKey()==null){
kettleTrans.setRoleKey("admin");
}else{
if(!kettleTrans.getRoleKey().contains("admin")){
kettleTrans.setRoleKey(kettleTrans.getRoleKey().concat(",admin"));
}
}
kettleTrans.setCreatedBy(userName);
kettleTrans.setUpdateBy(userName);
kettleTrans.setTransType("File");
return kettleTransMapper.insertKettleTrans(kettleTrans);
}
/**
* 修改转换
*
* @param kettleTrans 转换
* @return 结果
*/
@Override
public int updateKettleTrans(KettleTrans kettleTrans)
{
String userName = (String) PermissionUtils.getPrincipalProperty("userName");
kettleTrans.setUpdateBy(userName);
kettleTrans.setUpdateTime(DateUtils.getNowDate());
kettleTrans.setTransType("File");
if(kettleTrans.getRoleKey()==null){
kettleTrans.setRoleKey("admin");
}else{
if(!kettleTrans.getRoleKey().contains("admin")){
kettleTrans.setRoleKey(kettleTrans.getRoleKey().concat(",admin"));
}
} return kettleTransMapper.updateKettleTrans(kettleTrans);
}
/**
* 删除转换对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteKettleTransByIds(String ids)
{
return kettleTransMapper.deleteKettleTransByIds(Convert.toStrArray(ids));
}
/**
* 删除转换信息
*
* @param id 转换ID
* @return 结果
*/
@Override
public int deleteKettleTransById(Long id)
{
return kettleTransMapper.deleteKettleTransById(id);
}
}

View File

@ -0,0 +1,104 @@
package com.ruoyi.kettle.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.security.PermissionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kettle.mapper.XRepositoryMapper;
import com.ruoyi.kettle.domain.XRepository;
import com.ruoyi.kettle.service.IXRepositoryService;
import com.ruoyi.common.core.text.Convert;
/**
* 资源库Service业务层处理
*
* @author kone
* @date 2021-07-12
*/
@Service
public class XRepositoryServiceImpl implements IXRepositoryService
{
@Autowired
private XRepositoryMapper xRepositoryMapper;
/**
* 查询资源库
*
* @param id 资源库ID
* @return 资源库
*/
@Override
public XRepository selectXRepositoryById(Long id)
{
return xRepositoryMapper.selectXRepositoryById(id);
}
/**
* 查询资源库列表
*
* @param xRepository 资源库
* @return 资源库
*/
@Override
public List<XRepository> selectXRepositoryList(XRepository xRepository)
{
return xRepositoryMapper.selectXRepositoryList(xRepository);
}
/**
* 新增资源库
*
* @param xRepository 资源库
* @return 结果
*/
@Override
public int insertXRepository(XRepository xRepository)
{
String userName = (String) PermissionUtils.getPrincipalProperty("userName");
xRepository.setCreatedBy(userName);
xRepository.setUpdateBy(userName);
xRepository.setType("File");
return xRepositoryMapper.insertXRepository(xRepository);
}
/**
* 修改资源库
*
* @param xRepository 资源库
* @return 结果
*/
@Override
public int updateXRepository(XRepository xRepository)
{
String userName = (String) PermissionUtils.getPrincipalProperty("userName");
xRepository.setUpdateTime(DateUtils.getNowDate());
xRepository.setUpdateBy(userName);
return xRepositoryMapper.updateXRepository(xRepository);
}
/**
* 删除资源库对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteXRepositoryByIds(String ids)
{
return xRepositoryMapper.deleteXRepositoryByIds(Convert.toStrArray(ids));
}
/**
* 删除资源库信息
*
* @param id 资源库ID
* @return 结果
*/
@Override
public int deleteXRepositoryById(Long id)
{
return xRepositoryMapper.deleteXRepositoryById(id);
}
}

View File

@ -0,0 +1,73 @@
package com.ruoyi.kettle.tools;
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.job.Job;
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.util.Iterator;
import java.util.Map;
public class KettleUtils {
/**
* 执行ktr文件
*
* @param filename
* @param params
* @return
*/
public static void runKtr(String filename, Map<String, String> params, String dirPath) {
try {
KettleEnvironment.init();
TransMeta tm = new TransMeta(dirPath + File.separator + filename);
Trans trans = new Trans(tm);
if (params != null) {
Iterator<Map.Entry<String, String>> entries = params.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, String> entry = entries.next();
trans.setParameterValue(entry.getKey(), entry.getValue());
}
}
trans.execute(null);
trans.waitUntilFinished();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 执行kjb文件
*
* @param filename
* @param params
* @return
*/
public static void runKjb(String filename, Map<String, String> params, String dirPath) {
try {
KettleEnvironment.init();
JobMeta jm = new JobMeta(dirPath + File.separator + filename, null);
Job job = new Job(null, jm);
if (params != null) {
Iterator<Map.Entry<String, String>> entries = params.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, String> entry = entries.next();
job.setVariable(entry.getKey(), entry.getValue());
}
}
job.start();
job.waitUntilFinished();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
ClassPathResource classPathResource = new ClassPathResource("kettle");
System.out.println("classPathResource:" + classPathResource.getFile().getPath());
runKtr("D:\\etl\\kone.ktr", null, classPathResource.getFile().getPath());
}
}

View File

@ -0,0 +1,132 @@
<?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.ruoyi.kettle.mapper.KettleTransMapper">
<resultMap type="KettleTrans" id="KettleTransResult">
<result property="id" column="id" />
<result property="transName" column="trans_name" />
<result property="transDescription" column="trans_description" />
<result property="createdTime" column="created_time" />
<result property="updateTime" column="update_time" />
<result property="createdBy" column="created_by" />
<result property="updateBy" column="update_by" />
<result property="transType" column="trans_type" />
<result property="transPath" column="trans_path" />
<result property="transRepositoryId" column="trans_repository_id" />
<result property="transLogLevel" column="trans_log_level" />
<result property="transStatus" column="trans_status" />
<result property="isDel" column="is_del" />
<result property="isMonitorEnabled" column="is_monitor_enabled" />
<result property="tplKey" column="tpl_key" />
<result property="roleKey" column="role_key" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectKettleTransVo">
select id, trans_name, trans_description, created_time, update_time, created_by, update_by, trans_type, trans_path, trans_repository_id, trans_log_level, trans_status, is_del, is_monitor_enabled, tpl_key, role_key, remark from kettle_trans
</sql>
<select id="selectKettleTransList" parameterType="KettleTrans" resultMap="KettleTransResult">
<include refid="selectKettleTransVo"/>
<where>
<if test="KettleTrans.transName != null and KettleTrans.transName != ''"> and trans_name like concat('%', #{KettleTrans.transName}, '%')</if>
<if test="KettleTrans.transDescription != null and KettleTrans.transDescription != ''"> and trans_description = #{KettleTrans.transDescription}</if>
<if test="KettleTrans.transPath != null and KettleTrans.transPath != ''"> and trans_path = #{KettleTrans.transPath}</if>
<if test="KettleTrans.transRepositoryId != null "> and trans_repository_id = #{KettleTrans.transRepositoryId}</if>
<if test="KettleTrans.transLogLevel != null and KettleTrans.transLogLevel != ''"> and trans_log_level = #{KettleTrans.transLogLevel}</if>
<if test="KettleTrans.transStatus != null and KettleTrans.transStatus != ''"> and trans_status = #{KettleTrans.transStatus}</if>
<if test="KettleTrans.isMonitorEnabled != null "> and is_monitor_enabled = #{KettleTrans.isMonitorEnabled}</if>
<if test="roleKey != null ">
and
<foreach collection="roleKey" item="item" open="(" close=")" separator=" or " >
role_key like concat('%',#{item}, '%')
</foreach>
</if>
and is_del != 1
</where>
</select>
<select id="selectKettleTransById" parameterType="Long" resultMap="KettleTransResult">
<include refid="selectKettleTransVo"/>
where id = #{id}
</select>
<insert id="insertKettleTrans" parameterType="KettleTrans" useGeneratedKeys="true" keyProperty="id">
insert into kettle_trans
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="transName != null and transName != ''">trans_name,</if>
<if test="transDescription != null">trans_description,</if>
<if test="createdTime != null">created_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createdBy != null">created_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="transType != null">trans_type,</if>
<if test="transPath != null">trans_path,</if>
<if test="transRepositoryId != null">trans_repository_id,</if>
<if test="transLogLevel != null">trans_log_level,</if>
<if test="transStatus != null">trans_status,</if>
<if test="isDel != null">is_del,</if>
<if test="isMonitorEnabled != null">is_monitor_enabled,</if>
<if test="tplKey != null">tpl_key,</if>
<if test="roleKey != null">role_key,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="transName != null and transName != ''">#{transName},</if>
<if test="transDescription != null">#{transDescription},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="transType != null">#{transType},</if>
<if test="transPath != null">#{transPath},</if>
<if test="transRepositoryId != null">#{transRepositoryId},</if>
<if test="transLogLevel != null">#{transLogLevel},</if>
<if test="transStatus != null">#{transStatus},</if>
<if test="isDel != null">#{isDel},</if>
<if test="isMonitorEnabled != null">#{isMonitorEnabled},</if>
<if test="tplKey != null">#{tplKey},</if>
<if test="roleKey != null">#{roleKey},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateKettleTrans" parameterType="KettleTrans">
update kettle_trans
<trim prefix="SET" suffixOverrides=",">
<if test="transName != null and transName != ''">trans_name = #{transName},</if>
<if test="transDescription != null">trans_description = #{transDescription},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="transType != null">trans_type = #{transType},</if>
<if test="transPath != null">trans_path = #{transPath},</if>
<if test="transRepositoryId != null">trans_repository_id = #{transRepositoryId},</if>
<if test="transLogLevel != null">trans_log_level = #{transLogLevel},</if>
<if test="transStatus != null">trans_status = #{transStatus},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="isMonitorEnabled != null">is_monitor_enabled = #{isMonitorEnabled},</if>
<if test="tplKey != null">tpl_key = #{tplKey},</if>
<if test="roleKey != null">role_key = #{roleKey},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteKettleTransById" parameterType="Long">
delete from kettle_trans where id = #{id}
</delete>
<delete id="deleteKettleTransByIds" parameterType="String">
delete from kettle_trans where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,140 @@
<?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.ruoyi.kettle.mapper.XRepositoryMapper">
<resultMap type="XRepository" id="XRepositoryResult">
<result property="id" column="id" />
<result property="repoId" column="repo_id" />
<result property="repoName" column="repo_name" />
<result property="repoUsername" column="repo_username" />
<result property="repoPassword" column="repo_password" />
<result property="repoType" column="repo_type" />
<result property="dbAccess" column="db_access" />
<result property="dbHost" column="db_host" />
<result property="dbPort" column="db_port" />
<result property="dbName" column="db_name" />
<result property="dbUsername" column="db_username" />
<result property="dbPassword" column="db_password" />
<result property="isDel" column="is_del" />
<result property="createdTime" column="created_time" />
<result property="updateTime" column="update_time" />
<result property="createdBy" column="created_by" />
<result property="updateBy" column="update_by" />
<result property="type" column="type" />
<result property="baseDir" column="base_dir" />
</resultMap>
<sql id="selectXRepositoryVo">
select id, repo_id, repo_name, repo_username, repo_password, repo_type, db_access, db_host, db_port, db_name, db_username, db_password, is_del, created_time, update_time, created_by, update_by, type, base_dir from kettle_repository
</sql>
<select id="selectXRepositoryList" parameterType="XRepository" resultMap="XRepositoryResult">
<include refid="selectXRepositoryVo"/>
<where>
<if test="repoId != null and repoId != ''"> and repo_id = #{repoId}</if>
<if test="repoName != null and repoName != ''"> and repo_name like concat('%', #{repoName}, '%')</if>
<if test="repoUsername != null and repoUsername != ''"> and repo_username like concat('%', #{repoUsername}, '%')</if>
<if test="repoPassword != null and repoPassword != ''"> and repo_password = #{repoPassword}</if>
<if test="repoType != null and repoType != ''"> and repo_type = #{repoType}</if>
<if test="dbAccess != null and dbAccess != ''"> and db_access = #{dbAccess}</if>
<if test="dbHost != null and dbHost != ''"> and db_host = #{dbHost}</if>
<if test="dbPort != null and dbPort != ''"> and db_port = #{dbPort}</if>
<if test="dbName != null and dbName != ''"> and db_name like concat('%', #{dbName}, '%')</if>
<if test="dbUsername != null and dbUsername != ''"> and db_username like concat('%', #{dbUsername}, '%')</if>
<if test="dbPassword != null and dbPassword != ''"> and db_password = #{dbPassword}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="baseDir != null and baseDir != ''"> and base_dir = #{baseDir}</if>
</where>
</select>
<select id="selectXRepositoryById" parameterType="Long" resultMap="XRepositoryResult">
<include refid="selectXRepositoryVo"/>
where id = #{id}
</select>
<insert id="insertXRepository" parameterType="XRepository" useGeneratedKeys="true" keyProperty="id">
insert into kettle_repository
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="repoId != null and repoId != ''">repo_id,</if>
<if test="repoName != null">repo_name,</if>
<if test="repoUsername != null">repo_username,</if>
<if test="repoPassword != null">repo_password,</if>
<if test="repoType != null">repo_type,</if>
<if test="dbAccess != null">db_access,</if>
<if test="dbHost != null">db_host,</if>
<if test="dbPort != null">db_port,</if>
<if test="dbName != null">db_name,</if>
<if test="dbUsername != null">db_username,</if>
<if test="dbPassword != null">db_password,</if>
<if test="isDel != null">is_del,</if>
<if test="createdTime != null">created_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createdBy != null">created_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="type != null">type,</if>
<if test="baseDir != null">base_dir,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="repoId != null and repoId != ''">#{repoId},</if>
<if test="repoName != null">#{repoName},</if>
<if test="repoUsername != null">#{repoUsername},</if>
<if test="repoPassword != null">#{repoPassword},</if>
<if test="repoType != null">#{repoType},</if>
<if test="dbAccess != null">#{dbAccess},</if>
<if test="dbHost != null">#{dbHost},</if>
<if test="dbPort != null">#{dbPort},</if>
<if test="dbName != null">#{dbName},</if>
<if test="dbUsername != null">#{dbUsername},</if>
<if test="dbPassword != null">#{dbPassword},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="type != null">#{type},</if>
<if test="baseDir != null">#{baseDir},</if>
</trim>
</insert>
<update id="updateXRepository" parameterType="XRepository">
update kettle_repository
<trim prefix="SET" suffixOverrides=",">
<if test="repoId != null and repoId != ''">repo_id = #{repoId},</if>
<if test="repoName != null">repo_name = #{repoName},</if>
<if test="repoUsername != null">repo_username = #{repoUsername},</if>
<if test="repoPassword != null">repo_password = #{repoPassword},</if>
<if test="repoType != null">repo_type = #{repoType},</if>
<if test="dbAccess != null">db_access = #{dbAccess},</if>
<if test="dbHost != null">db_host = #{dbHost},</if>
<if test="dbPort != null">db_port = #{dbPort},</if>
<if test="dbName != null">db_name = #{dbName},</if>
<if test="dbUsername != null">db_username = #{dbUsername},</if>
<if test="dbPassword != null">db_password = #{dbPassword},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="type != null">type = #{type},</if>
<if test="baseDir != null">base_dir = #{baseDir},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteXRepositoryById" parameterType="Long">
delete from kettle_repository where id = #{id}
</delete>
<delete id="deleteXRepositoryByIds" parameterType="String">
delete from kettle_repository where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增资源库')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-repository-add">
<div class="form-group">
<label class="col-sm-3 control-label">资源库名称:</label>
<div class="col-sm-8">
<input name="repoName" class="form-control" type="text">
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的用户名</label>
<div class="col-sm-8">
<input name="repoUsername" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的密码</label>
<div class="col-sm-8">
<input name="repoPassword" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">db类型</label>
<div class="col-sm-8">
<select name="repoType" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的连接类型</label>
<div class="col-sm-8">
<input name="dbAccess" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的ip</label>
<div class="col-sm-8">
<input name="dbHost" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的端口</label>
<div class="col-sm-8">
<input name="dbPort" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db库名</label>
<div class="col-sm-8">
<input name="dbName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db用户名</label>
<div class="col-sm-8">
<input name="dbUsername" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db用户密码</label>
<div class="col-sm-8">
<input name="dbPassword" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">软删除:</label>
<div class="col-sm-8">
<input name="isDel" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<div class="input-group date">
<input name="createdTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="createdBy" class="form-control" type="text">
</div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">资源库类型:</label>
<div class="col-sm-8">
<!-- <select name="type" class="form-control m-b">
<option value="">所有</option>
</select>-->
<select class="form-control" name="type" th:with="type=${@dict.getType('repository_type')}" disabled="disabled">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">基础路径:</label>
<div class="col-sm-8">
<input name="baseDir" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "kettle/repository"
$("#form-repository-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-repository-add').serialize());
}
}
// $("input[name='createdTime']").datetimepicker({
// format: "yyyy-mm-dd",
// minView: "month",
// autoclose: true
// });
</script>
</body>
</html>

View File

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改资源库')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-repository-edit" th:object="${xRepository}">
<input name="repoName" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">资源库名称:</label>
<div class="col-sm-8">
<input name="repoName" th:field="*{repoName}" class="form-control" type="text">
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的用户名</label>
<div class="col-sm-8">
<input name="repoUsername" th:field="*{repoUsername}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的密码</label>
<div class="col-sm-8">
<input name="repoPassword" th:field="*{repoPassword}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">db类型</label>
<div class="col-sm-8">
<select name="repoType" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的连接类型</label>
<div class="col-sm-8">
<input name="dbAccess" th:field="*{dbAccess}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的ip</label>
<div class="col-sm-8">
<input name="dbHost" th:field="*{dbHost}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的端口</label>
<div class="col-sm-8">
<input name="dbPort" th:field="*{dbPort}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db库名</label>
<div class="col-sm-8">
<input name="dbName" th:field="*{dbName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db用户名</label>
<div class="col-sm-8">
<input name="dbUsername" th:field="*{dbUsername}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">当资源库类型是db时候的db用户密码</label>
<div class="col-sm-8">
<input name="dbPassword" th:field="*{dbPassword}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">软删除:</label>
<div class="col-sm-8">
<input name="isDel" th:field="*{isDel}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<div class="input-group date">
<input name="createdTime" th:value="${#dates.format(xRepository.createdTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-8">
<input name="createdBy" th:field="*{createdBy}" class="form-control" type="text">
</div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">资源库类型:</label>
<div class="col-sm-8">
<select class="form-control" name="type" th:with="type=${@dict.getType('repository_type')}" disabled="disabled">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">基础路径:</label>
<div class="col-sm-8">
<input name="baseDir" th:field="*{baseDir}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "kettle/repository";
$("#form-repository-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-repository-edit').serialize());
}
}
$("input[name='createdTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('资源库列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>名称:</label>
<input type="text" name="repoName" placeholder="资源库名称" />
</li>
<!-- <li>
<label>资源库类型:</label>
<select name="type">
<option value="">所有</option>
<option value="-1">代码生成请选择字典属性</option>
</select>
</li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="kettle:repository:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="kettle:repository:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="kettle:repository:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="kettle:repository:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('kettle:repository:edit')}]];
var removeFlag = [[${@permission.hasPermi('kettle:repository:remove')}]];
var prefix = ctx + "kettle/repository";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "资源库",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'repoName',
title: '资源库名称'
},
// {
// field: 'isDel',
// title: '是否删除'
// },
{
field: 'createdTime',
title: '创建时间'
},
{
field: 'createdBy',
title: '创建人'
},
{
field: 'updateTime',
title: '最后修改时间'
},
{
field: 'updateBy',
title: '修改人'
},
/*{
field: 'type',
title: '资源库类型'
},*/
{
field: 'baseDir',
title: '基础路径'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增转换')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trans-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">转换名称:</label>
<div class="col-sm-8">
<input name="transName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">转换描述:</label>
<div class="col-sm-8">
<textarea name="transDescription" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">转换类型(file,ftp,sftp)</label>
<div class="col-sm-8">
<select name="transType" class="form-control m-b" th:with="type=${@dict.getType('repository_type')}" disabled="disabled">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">路径:</label>
<div class="col-sm-8">
<input name="transPath" class="form-control" type="text">
</div>
</div>
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">所属资源库id</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="transRepositoryId" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">日志级别:</label>
<div class="col-sm-8">
<select name="transLogLevel" class="form-control m-b" th:with="type=${@dict.getType('kettle_log_level')}" >
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="transStatus" value="">
<label th:for="transStatus" th:text="未知"></label>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<label class="radio-box">
<input type="radio" checked="" value=1 id="optionsRadios1" name="isMonitorEnabled"></label>
<label class="radio-box">
<input type="radio" value=0 id="optionsRadios2" name="isMonitorEnabled"></label>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">角色key</label>-->
<!-- <div class="col-sm-8">-->
<!-- <textarea name="roleKey" class="form-control" placeholder="可以执行该转换的角色组合,用','连接,如:admin,guest,表示admin角色和guest角色都可以执行该转换"></textarea>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">角色key:</label>
<div class="col-sm-8">
<select class="form-control noselect2 selectpicker m-b" name="roleKey" data-none-selected-text="可以执行该转换的角色组合" multiple >
<option th:each="allRoles:${allRoles}" th:value="${allRoles}" th:text="${allRoles}" ></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
$.fn.selectpicker.Constructor.DEFAULTS.liveSearch=true
var prefix = ctx + "kettle/trans"
$("#form-trans-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-trans-add').serialize());
}
}
$("input[name='createdTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改转换')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-trans-edit" th:object="${kettleTrans}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">转换名称:</label>
<div class="col-sm-8">
<input name="transName" th:field="*{transName}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">转换描述:</label>
<div class="col-sm-8">
<textarea name="transDescription" class="form-control">[[*{transDescription}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">路径:</label>
<div class="col-sm-8">
<input name="transPath" th:field="*{transPath}" class="form-control" type="text">
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">所属资源库id</label>
<div class="col-sm-8">
<input name="transRepositoryId" th:field="*{transRepositoryId}" class="form-control" type="text">
</div>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">日志级别:</label>
<div class="col-sm-8">
<select name="transLogLevel" class="form-control m-b" th:with="type=${@dict.getType('kettle_log_level')}" th:field="*{transLogLevel}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<!-- <label class="toggle-switch switch-solid">
<input name="isMonitorEnabled" type="checkbox" id="status" th:checked="${kettleTrans.isMonitorEnabled == 1 ? true : false}">
<span></span>
</label>-->
<label class="radio-box">
<input type="radio" checked="" value=1 id="optionsRadios1" name="isMonitorEnabled" th:checked="${kettleTrans.isMonitorEnabled == 1 ? true : false}"></label>
<label class="radio-box">
<input type="radio" value=0 id="optionsRadios2" name="isMonitorEnabled" th:checked="${kettleTrans.isMonitorEnabled == 0 ? true : false}"></label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">角色key:</label>
<div class="col-sm-8">
<select class="form-control noselect2 selectpicker m-b " name="roleKey" data-none-selected-text="可以执行该转换的角色组合" multiple >
<option th:each="allRoles:${allRoles}" th:value="${allRoles}" th:text="${allRoles}" ></option>
</select>
</div>
</div>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">可执行角色:</label>
<div class="col-sm-8">
<textarea name="roleKey" class="form-control" placeholder="可以执行该转换的角色组合,用','连接,如:admin,guest,表示admin角色和guest角色都可以执行该转换">[[*{roleKey}]]</textarea>
</div>
<div class="col-sm-8">
<select class="form-control noselect2 selectpicker m-b" name="roleKey" data-none-selected-text="可以执行该转换的角色组合" multiple >
<option th:each="allRoles:${allRoles}" th:value="${allRoles}" th:text="${allRoles}" ></option>
</select>
</div>
</div>-->
<!-- <div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
var rkArray = [[${rkArray}]];
$('.selectpicker').selectpicker('val',rkArray);
var prefix = ctx + "kettle/trans";
$("#form-trans-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-trans-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('转换列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>转换名称:</label>
<input type="text" name="transName"/>
</li>
<li>
<label>状态:</label>
<select name="transStatus" th:with="type=${@dict.getType('kettle_trans_status')}" >
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="kettle:trans:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="kettle:trans:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="kettle:trans:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="kettle:trans:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('kettle:trans:edit')}]];
var removeFlag = [[${@permission.hasPermi('kettle:trans:remove')}]];
var transTypeDatas = [[${@dict.getType('repository_type')}]];
var prefix = ctx + "kettle/trans";
var logLevel = [[${@dict.getType('kettle_log_level')}]];
var transStatus = [[${@dict.getType('kettle_trans_status')}]];
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "转换",
columns: [{
checkbox: true
},
{
field: 'id',
title: '',
visible: false
},
{
field: 'transName',
title: '转换名称'
},
{
field: 'transDescription',
title: '转换描述'
},
{
field: 'transPath',
title: '路径'
},
{
field: 'transRepositoryId',
title: '所属资源库id'
},
{
field: 'transLogLevel',
title: '日志级别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(logLevel, value);
}
},
{
field: 'transStatus',
title: '状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(transStatus, value);
}
},
// {
// field: 'isDel',
// title: '是否删除'
// },
{
field: 'isMonitorEnabled',
title: '是否启用',
formatter: function(value, row, index) {
return value==1?"是":"否";
}
},
// {
// field: 'tplKey',
// title: '保留备用'
// },
{
field: 'roleKey',
title: '可执行角色'
},
// {
// field: 'remark',
// title: '备注'
// },
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>运行</a>');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>