数据资产结构数据库表(mybaits_puls)

master
Saisai Liu 2024-04-22 11:46:42 +08:00
parent dc69c82be1
commit 15032a82ac
13 changed files with 1048 additions and 4 deletions

View File

@ -0,0 +1,210 @@
package com.muyu.etl.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
/**
* structure
*
* @author Saisai
* @date 2024-04-22
*/
public class Structure extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 表id */
@Excel(name = "表id")
private Long tableId;
/** 字段名称 */
@Excel(name = "字段名称")
private String columnName;
/** 字段注释 */
@Excel(name = "字段注释")
private String columnRemark;
/** 是否主键 'Y'是主键 'N'不是主键 */
@Excel(name = "是否主键 'Y'是主键 'N'不是主键")
private String isPrimary;
/** 数据类型 */
@Excel(name = "数据类型")
private String columnType;
/** 映射类型 */
@Excel(name = "映射类型")
private String javaType;
/** 字段长度 */
@Excel(name = "字段长度")
private String columnLength;
/** 小数位数 */
@Excel(name = "小数位数")
private String columnDecimals;
/** 是否为空 'Y'是 'N'不是 */
@Excel(name = "是否为空 'Y'是 'N'不是")
private String isNull;
/** 默认值 */
@Excel(name = "默认值")
private String defaultValue;
/** 是否字典 'Y'是 'N'不是 */
@Excel(name = "是否字典 'Y'是 'N'不是")
private String isDictionary;
/** 映射字典 */
@Excel(name = "映射字典")
private String dictionaryTable;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTableId(Long tableId)
{
this.tableId = tableId;
}
public Long getTableId()
{
return tableId;
}
public void setColumnName(String columnName)
{
this.columnName = columnName;
}
public String getColumnName()
{
return columnName;
}
public void setColumnRemark(String columnRemark)
{
this.columnRemark = columnRemark;
}
public String getColumnRemark()
{
return columnRemark;
}
public void setIsPrimary(String isPrimary)
{
this.isPrimary = isPrimary;
}
public String getIsPrimary()
{
return isPrimary;
}
public void setColumnType(String columnType)
{
this.columnType = columnType;
}
public String getColumnType()
{
return columnType;
}
public void setJavaType(String javaType)
{
this.javaType = javaType;
}
public String getJavaType()
{
return javaType;
}
public void setColumnLength(String columnLength)
{
this.columnLength = columnLength;
}
public String getColumnLength()
{
return columnLength;
}
public void setColumnDecimals(String columnDecimals)
{
this.columnDecimals = columnDecimals;
}
public String getColumnDecimals()
{
return columnDecimals;
}
public void setIsNull(String isNull)
{
this.isNull = isNull;
}
public String getIsNull()
{
return isNull;
}
public void setDefaultValue(String defaultValue)
{
this.defaultValue = defaultValue;
}
public String getDefaultValue()
{
return defaultValue;
}
public void setIsDictionary(String isDictionary)
{
this.isDictionary = isDictionary;
}
public String getIsDictionary()
{
return isDictionary;
}
public void setDictionaryTable(String dictionaryTable)
{
this.dictionaryTable = dictionaryTable;
}
public String getDictionaryTable()
{
return dictionaryTable;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tableId", getTableId())
.append("columnName", getColumnName())
.append("columnRemark", getColumnRemark())
.append("isPrimary", getIsPrimary())
.append("columnType", getColumnType())
.append("javaType", getJavaType())
.append("columnLength", getColumnLength())
.append("columnDecimals", getColumnDecimals())
.append("isNull", getIsNull())
.append("defaultValue", getDefaultValue())
.append("isDictionary", getIsDictionary())
.append("dictionaryTable", getDictionaryTable())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,57 @@
package com.muyu.etl.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.TreeEntity;
/**
* tree_construct
*
* @author Saisai
* @date 2024-04-22
*/
public class TreeConstruct extends TreeEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 树级结构 */
@Excel(name = "树级结构")
private String name;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("parentId", getParentId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -106,4 +106,11 @@ public class BasicConfigInfoController extends BaseController
public Result connectionTest(@RequestBody BasicConfigInfo basicConfigInfo) throws ServletException {
return toAjax(basicConfigInfoService.connectionTest(basicConfigInfo));
}
@RequiresPermissions("etl:info:test")
@Log(title = "获取成功链接中的")
@GetMapping("/dataConstruct")
public Result<TableDataInfo<List>> getData(){
return getDataTable(basicConfigInfoService.getDataByEtl());
}
}

View File

@ -0,0 +1,64 @@
package com.muyu.etl.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.Structure;
import com.muyu.etl.domain.TreeConstruct;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-22
*/
public interface StructureMapper extends BaseMapper<Structure>
{
/**
*
*
* @param id
* @return
*/
public Structure selectStructureById(Long id);
/**
*
*
* @param structure
* @return
*/
public List<Structure> selectStructureList(Structure structure);
/**
*
*
* @param structure
* @return
*/
public int insertStructure(Structure structure);
/**
*
*
* @param structure
* @return
*/
public int updateStructure(Structure structure);
/**
*
*
* @param id
* @return
*/
public int deleteStructureById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteStructureByIds(Long[] ids);
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.etl.domain.TreeConstruct;
/**
* Mapper
*
* @author Saisai
* @date 2024-04-22
*/
public interface TreeConstructMapper extends BaseMapper<TreeConstruct>
{
/**
*
*
* @param id
* @return
*/
public TreeConstruct selectTreeConstructById(Long id);
/**
*
*
* @param treeConstruct
* @return
*/
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct);
/**
*
*
* @param treeConstruct
* @return
*/
public int insertTreeConstruct(TreeConstruct treeConstruct);
/**
*
*
* @param treeConstruct
* @return
*/
public int updateTreeConstruct(TreeConstruct treeConstruct);
/**
*
*
* @param id
* @return
*/
public int deleteTreeConstructById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteTreeConstructByIds(Long[] ids);
}

View File

@ -1,6 +1,7 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.etl.domain.BasicConfigInfo;
import javax.servlet.ServletException;
@ -63,4 +64,6 @@ public interface BasicConfigInfoService extends IService<BasicConfigInfo>
public int deleteBasicConfigInfoById(Long id);
boolean connectionTest(BasicConfigInfo basicConfigInfo) throws ServletException;
List getDataByEtl();
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.Structure;
import java.util.List;
/**
* Service
*
* @author Saisai
* @date 2024-04-22
*/
public interface StructureService extends IService<Structure>
{
/**
*
*
* @param id
* @return
*/
public Structure selectStructureById(Long id);
/**
*
*
* @param structure
* @return
*/
public List<Structure> selectStructureList(Structure structure);
/**
*
*
* @param structure
* @return
*/
public int insertStructure(Structure structure);
/**
*
*
* @param structure
* @return
*/
public int updateStructure(Structure structure);
/**
*
*
* @param ids
* @return
*/
public int deleteStructureByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteStructureById(Long id);
}

View File

@ -0,0 +1,63 @@
package com.muyu.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.etl.domain.TreeConstruct;
import java.util.List;
/**
* Service
*
* @author Saisai
* @date 2024-04-22
*/
public interface TreeConstructService extends IService<TreeConstruct>
{
/**
*
*
* @param id
* @return
*/
public TreeConstruct selectTreeConstructById(Long id);
/**
*
*
* @param treeConstruct
* @return
*/
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct);
/**
*
*
* @param treeConstruct
* @return
*/
public int insertTreeConstruct(TreeConstruct treeConstruct);
/**
*
*
* @param treeConstruct
* @return
*/
public int updateTreeConstruct(TreeConstruct treeConstruct);
/**
*
*
* @param ids
* @return
*/
public int deleteTreeConstructByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteTreeConstructById(Long id);
}

View File

@ -4,15 +4,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.etl.domain.BasicConfigInfo;
import com.muyu.etl.mapper.BasicConfigInfoMapper;
import com.muyu.etl.service.BasicConfigInfoService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Service
@ -21,6 +22,7 @@ import java.util.List;
* @date 2024-04-20
*/
@Service
@Log4j2
public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapper, BasicConfigInfo> implements BasicConfigInfoService
{
@Autowired
@ -119,4 +121,108 @@ public class BasicConfigInfoServiceImpl extends ServiceImpl<BasicConfigInfoMapp
}
return true;
}
//{
// list: [
// {
// (数据库名)testName: null,
// (表名)children: [
// {
// (表名)name: null,
// data: [
// {
// (字段名)name: null,
// val: null,
// type: null,
// 注释null
// ...
// }
// ]
// }
// ]
// }
// ]
//}
@Override
public List getDataByEtl() {
List<BasicConfigInfo> list = this.list();
List<Map<String,List<String>>> mapList = new ArrayList<>();
for (BasicConfigInfo info : list) {
//定义下面需要的对象
String url = "jdbc:" + info.getDatabaseType() + "://" + info.getHost() + ":" + info.getPort() + "/" + info.getDatabaseName() + "";
String user = info.getUsername();
String password = info.getPassword();
Connection conn = null;
try {
conn = DriverManager.getConnection(url, user, password);
DatabaseMetaData metaData = conn.getMetaData();
ResultSet resultSet = metaData.getCatalogs();
while (resultSet.next()){
//库名
String catalogs = resultSet.getString("TABLE_CAT");
log.info(catalogs);
// 获取表名
ResultSet rs = metaData.getTables(catalogs, info.getDatabaseName(), "%", new String[]{"TABLE", "VIEW"});
try {
ArrayList<String> tableName = new ArrayList<>();
while (rs.next()) {
tableName.add( rs.getString("TABLE_NAME"));
}
mapList.add(new HashMap<>(){{
//库名,表名
put(catalogs,tableName);
}});
}catch (Exception exception){
continue;
}
// ResultSet tables = metaData.getTables(
// catalogs,
// info.getDatabaseName(),
// "%",
// new String[]{"TABLE", "VIEW"});
// while (tables.next()) {
// //表名
// String tableName = tables.getString("TABLE_NAME");
// ResultSet rs = metaData.getColumns(catalogs, info.getDatabaseName(), tableName, "%");
// try {
// while (rs.next()) {
//
// HashMap<String, String> map = new HashMap<>();
// // 列明
// map.put("columnName", rs.getString("COLUMN_NAME"));
// // 列类型
// map.put("typeName", rs.getString("TYPE_NAME"));
// // 列备注
// map.put("remarks", rs.getString("REMARKS"));
//// list.add(map);
// //库名
// System.out.println("TABLE_CAT" + "===" + rs.getString("TABLE_CAT"));
//
// System.out.println("TABLE_SCHEM" + "===" + rs.getString("TABLE_SCHEM"));
// System.out.println("TABLE_NAME" + "===" + rs.getString("TABLE_NAME"));
//// System.out.println("NON_UNIQUE" + "===" + rs.getString("NON_UNIQUE"));
// System.out.println("INDEX_QUALIFIER" + "===" + rs.getString("INDEX_QUALIFIER"));
// System.out.println("INDEX_NAME" + "===" + rs.getString("INDEX_NAME"));
// System.out.println("TYPE" + "===" + rs.getString("TYPE"));
// System.out.println("ORDINAL_POSITION" + "===" + rs.getString("ORDINAL_POSITION"));
// System.out.println("COLUMN_NAME" + "===" + rs.getString("COLUMN_NAME"));
// System.out.println("ASC_OR_DESC" + "===" + rs.getString("ASC_OR_DESC"));
// System.out.println("CARDINALITY" + "===" + rs.getString("CARDINALITY"));
// System.out.println("PAGES" + "===" + rs.getString("PAGES"));
// System.out.println("FILTER_CONDITION" + "===" + rs.getString("FILTER_CONDITION"));
//
// }
// }catch (Exception e){
// log.error(e.getMessage());
// continue;
// }
// }
}
} catch (Exception e){
log.error(e.getMessage());
continue;
}
}
return mapList;
}
}

View File

@ -0,0 +1,98 @@
package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.etl.domain.Structure;
import com.muyu.etl.mapper.StructureMapper;
import com.muyu.etl.service.StructureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Saisai
* @date 2024-04-22
*/
@Service
public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> implements StructureService
{
@Autowired
private StructureMapper structureMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Structure selectStructureById(Long id)
{
return structureMapper.selectStructureById(id);
}
/**
*
*
* @param structure
* @return
*/
@Override
public List<Structure> selectStructureList(Structure structure)
{
return structureMapper.selectStructureList(structure);
}
/**
*
*
* @param structure
* @return
*/
@Override
public int insertStructure(Structure structure)
{
structure.setCreateTime(DateUtils.getNowDate());
return structureMapper.insertStructure(structure);
}
/**
*
*
* @param structure
* @return
*/
@Override
public int updateStructure(Structure structure)
{
structure.setUpdateTime(DateUtils.getNowDate());
return structureMapper.updateStructure(structure);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteStructureByIds(Long[] ids)
{
return structureMapper.deleteStructureByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteStructureById(Long id)
{
return structureMapper.deleteStructureById(id);
}
}

View File

@ -0,0 +1,98 @@
package com.muyu.etl.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.etl.domain.TreeConstruct;
import com.muyu.etl.mapper.TreeConstructMapper;
import com.muyu.etl.service.TreeConstructService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Saisai
* @date 2024-04-22
*/
@Service
public class TreeConstructServiceImpl extends ServiceImpl<TreeConstructMapper, TreeConstruct> implements TreeConstructService
{
@Autowired
private TreeConstructMapper treeConstructMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TreeConstruct selectTreeConstructById(Long id)
{
return treeConstructMapper.selectTreeConstructById(id);
}
/**
*
*
* @param treeConstruct
* @return
*/
@Override
public List<TreeConstruct> selectTreeConstructList(TreeConstruct treeConstruct)
{
return treeConstructMapper.selectTreeConstructList(treeConstruct);
}
/**
*
*
* @param treeConstruct
* @return
*/
@Override
public int insertTreeConstruct(TreeConstruct treeConstruct)
{
treeConstruct.setCreateTime(DateUtils.getNowDate());
return treeConstructMapper.insertTreeConstruct(treeConstruct);
}
/**
*
*
* @param treeConstruct
* @return
*/
@Override
public int updateTreeConstruct(TreeConstruct treeConstruct)
{
treeConstruct.setUpdateTime(DateUtils.getNowDate());
return treeConstructMapper.updateTreeConstruct(treeConstruct);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTreeConstructByIds(Long[] ids)
{
return treeConstructMapper.deleteTreeConstructByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTreeConstructById(Long id)
{
return treeConstructMapper.deleteTreeConstructById(id);
}
}

View File

@ -0,0 +1,131 @@
<?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.etl.mapper.StructureMapper">
<resultMap type="com.muyu.etl.domain.Structure" id="StructureResult">
<result property="id" column="id" />
<result property="tableId" column="table_id" />
<result property="columnName" column="column_name" />
<result property="columnRemark" column="column_remark" />
<result property="isPrimary" column="is_primary" />
<result property="columnType" column="column_type" />
<result property="javaType" column="java_type" />
<result property="columnLength" column="column_length" />
<result property="columnDecimals" column="column_decimals" />
<result property="isNull" column="is_null" />
<result property="defaultValue" column="default_value" />
<result property="isDictionary" column="is_dictionary" />
<result property="dictionaryTable" column="dictionary_table" />
<result property="remark" column="remark" />
<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="selectStructureVo">
select id, table_id, column_name, column_remark, is_primary, column_type, java_type, column_length, column_decimals, is_null, default_value, is_dictionary, dictionary_table, remark, create_by, create_time, update_by, update_time from structure
</sql>
<select id="selectStructureList" parameterType="com.muyu.etl.domain.Structure" resultMap="StructureResult">
<include refid="selectStructureVo"/>
<where>
<if test="tableId != null "> and table_id = #{tableId}</if>
<if test="columnName != null and columnName != ''"> and column_name like concat('%', #{columnName}, '%')</if>
<if test="columnRemark != null and columnRemark != ''"> and column_remark = #{columnRemark}</if>
<if test="isPrimary != null and isPrimary != ''"> and is_primary = #{isPrimary}</if>
<if test="columnType != null and columnType != ''"> and column_type = #{columnType}</if>
<if test="javaType != null and javaType != ''"> and java_type = #{javaType}</if>
<if test="columnLength != null and columnLength != ''"> and column_length = #{columnLength}</if>
<if test="columnDecimals != null and columnDecimals != ''"> and column_decimals = #{columnDecimals}</if>
<if test="isNull != null and isNull != ''"> and is_null = #{isNull}</if>
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
<if test="isDictionary != null and isDictionary != ''"> and is_dictionary = #{isDictionary}</if>
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table = #{dictionaryTable}</if>
</where>
</select>
<select id="selectStructureById" parameterType="Long" resultMap="StructureResult">
<include refid="selectStructureVo"/>
where id = #{id}
</select>
<insert id="insertStructure" parameterType="com.muyu.etl.domain.Structure" useGeneratedKeys="true" keyProperty="id">
insert into structure
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
<if test="columnName != null">column_name,</if>
<if test="columnRemark != null">column_remark,</if>
<if test="isPrimary != null and isPrimary != ''">is_primary,</if>
<if test="columnType != null and columnType != ''">column_type,</if>
<if test="javaType != null and javaType != ''">java_type,</if>
<if test="columnLength != null and columnLength != ''">column_length,</if>
<if test="columnDecimals != null and columnDecimals != ''">column_decimals,</if>
<if test="isNull != null">is_null,</if>
<if test="defaultValue != null and defaultValue != ''">default_value,</if>
<if test="isDictionary != null">is_dictionary,</if>
<if test="dictionaryTable != null">dictionary_table,</if>
<if test="remark != null">remark,</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="tableId != null">#{tableId},</if>
<if test="columnName != null">#{columnName},</if>
<if test="columnRemark != null">#{columnRemark},</if>
<if test="isPrimary != null and isPrimary != ''">#{isPrimary},</if>
<if test="columnType != null and columnType != ''">#{columnType},</if>
<if test="javaType != null and javaType != ''">#{javaType},</if>
<if test="columnLength != null and columnLength != ''">#{columnLength},</if>
<if test="columnDecimals != null and columnDecimals != ''">#{columnDecimals},</if>
<if test="isNull != null">#{isNull},</if>
<if test="defaultValue != null and defaultValue != ''">#{defaultValue},</if>
<if test="isDictionary != null">#{isDictionary},</if>
<if test="dictionaryTable != null">#{dictionaryTable},</if>
<if test="remark != null">#{remark},</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="updateStructure" parameterType="com.muyu.etl.domain.Structure">
update structure
<trim prefix="SET" suffixOverrides=",">
<if test="tableId != null">table_id = #{tableId},</if>
<if test="columnName != null">column_name = #{columnName},</if>
<if test="columnRemark != null">column_remark = #{columnRemark},</if>
<if test="isPrimary != null and isPrimary != ''">is_primary = #{isPrimary},</if>
<if test="columnType != null and columnType != ''">column_type = #{columnType},</if>
<if test="javaType != null and javaType != ''">java_type = #{javaType},</if>
<if test="columnLength != null and columnLength != ''">column_length = #{columnLength},</if>
<if test="columnDecimals != null and columnDecimals != ''">column_decimals = #{columnDecimals},</if>
<if test="isNull != null">is_null = #{isNull},</if>
<if test="defaultValue != null and defaultValue != ''">default_value = #{defaultValue},</if>
<if test="isDictionary != null">is_dictionary = #{isDictionary},</if>
<if test="dictionaryTable != null">dictionary_table = #{dictionaryTable},</if>
<if test="remark != null">remark = #{remark},</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="deleteStructureById" parameterType="Long">
delete from structure where id = #{id}
</delete>
<delete id="deleteStructureByIds" parameterType="String">
delete from structure where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,81 @@
<?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.etl.mapper.TreeConstructMapper">
<resultMap type="com.muyu.etl.domain.TreeConstruct" id="TreeConstructResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="parentId" column="parent_id" />
<result property="remark" column="remark" />
<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="selectTreeConstructVo">
select id, name, parent_id, remark, create_by, create_time, update_by, update_time from tree_construct
</sql>
<select id="selectTreeConstructList" parameterType="com.muyu.etl.domain.TreeConstruct" resultMap="TreeConstructResult">
<include refid="selectTreeConstructVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
</where>
</select>
<select id="selectTreeConstructById" parameterType="Long" resultMap="TreeConstructResult">
<include refid="selectTreeConstructVo"/>
where id = #{id}
</select>
<insert id="insertTreeConstruct" parameterType="com.muyu.etl.domain.TreeConstruct" useGeneratedKeys="true" keyProperty="id">
insert into tree_construct
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="parentId != null">parent_id,</if>
<if test="remark != null">remark,</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="name != null">#{name},</if>
<if test="parentId != null">#{parentId},</if>
<if test="remark != null">#{remark},</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="updateTreeConstruct" parameterType="com.muyu.etl.domain.TreeConstruct">
update tree_construct
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="remark != null">remark = #{remark},</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="deleteTreeConstructById" parameterType="Long">
delete from tree_construct where id = #{id}
</delete>
<delete id="deleteTreeConstructByIds" parameterType="String">
delete from tree_construct where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>