feat():字典表初始化

ruoyi_test
sunshine7058 2024-04-26 17:00:09 +08:00
parent 54817d5629
commit cf374cfedd
13 changed files with 256 additions and 19 deletions

View File

@ -0,0 +1,48 @@
package com.muyu.data.source.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*
* @author HuFangMing
* @ClassName: DictData
* @createTime: 2024/4/26 16:21
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "dict_data")
public class DictData extends BaseEntity {
/**
*
*/
@TableId(value = "dict_code", type = IdType.AUTO)
private Long dictCode;
/**
*
*/
private String dictLabel;
/**
*
*/
private String dictValue;
/**
*
*/
private String dictType;
/**
* (0 1)
*/
private String status;
}

View File

@ -0,0 +1,44 @@
package com.muyu.data.source.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*
* @author HuFangMing
* @ClassName: DictType
* @createTime: 2024/4/26 16:29
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "dict_type")
public class DictType {
/**
*
*/
@TableId(value = "dict_id", type = IdType.AUTO)
private Long dictId;
/**
*
*/
private String dictName;
/**
*
*/
private String dictType;
/**
* 0 1
*/
private String status;
}

View File

@ -0,0 +1,17 @@
package com.muyu.data.source.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author HuFangMing
* @ClassName: DictDataCpntroller
* @createTime: 2024/4/26 16:36
*/
@RestController
@RequestMapping("/dictData")
public class DictDataCpntroller {
}

View File

@ -0,0 +1,18 @@
package com.muyu.data.source.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author HuFangMing
* @ClassName: DictTypeController
* @createTime: 2024/4/26 16:37
*/
@RestController
@RequestMapping("/dictType")
public class DictTypeController {
}

View File

@ -0,0 +1,17 @@
package com.muyu.data.source.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.data.source.domain.DictData;
/**
* mapper
*
* @author HuFangMing
* @ClassName: DictDataMapper
* @createTime: 2024/4/26 16:48
*/
public interface DictDataMapper extends BaseMapper<DictData> {
}

View File

@ -0,0 +1,18 @@
package com.muyu.data.source.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.data.source.domain.DictType;
/**
* mapper
*
* @author HuFangMing
* @ClassName: DictTypeMapper
* @createTime: 2024/4/26 16:51
*/
public interface DictTypeMapper extends BaseMapper<DictType> {
}

View File

@ -0,0 +1,17 @@
package com.muyu.data.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.data.source.domain.DictData;
/**
*
*
* @author HuFangMing
* @ClassName: DictDataService
* @createTime: 2024/4/26 16:39
*/
public interface DictDataService extends IService<DictData> {
}

View File

@ -0,0 +1,17 @@
package com.muyu.data.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.data.source.domain.DictType;
/**
*
*
* @author HuFangMing
* @ClassName: DictTypeService
* @createTime: 2024/4/26 16:41
*/
public interface DictTypeService extends IService<DictType> {
}

View File

@ -226,24 +226,6 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
}
}
//
//获取表描述的集合
// List<Table> tableList = dataSourceMapper.selectTable(assetDataSource.getDatabaseName());
//判断是否存在
// if (childrenList == null || childrenList.size() == 0) {
// tableList.forEach(table -> {
// Children children = Children.builder()
// .name(table.getTableName())
// .annotation(table.getTableComment())
// .dataTotal(table.getTableRows())
// .type("dataTable")
// .assetId(assetDataSource.getId())
// .build();
// //添加到数据库
// childrenService.save(children);
// });
//返回表描述
return childrenList;
@ -388,7 +370,6 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
} finally {
try {
pst.close();
pst = null;
} catch (SQLException e) {
throw new RuntimeException(e);
}

View File

@ -0,0 +1,20 @@
package com.muyu.data.source.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.data.source.domain.DictData;
import com.muyu.data.source.mapper.DictDataMapper;
import com.muyu.data.source.service.DictDataService;
import org.springframework.stereotype.Service;
/**
*
*
* @author HuFangMing
* @ClassName: DictDataServiceImpl
* @createTime: 2024/4/26 16:44
*/
@Service
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements DictDataService {
}

View File

@ -0,0 +1,18 @@
package com.muyu.data.source.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.data.source.domain.DictType;
import com.muyu.data.source.mapper.DictTypeMapper;
/**
*
*
* @author HuFangMing
* @ClassName: DictTypeService
* @createTime: 2024/4/26 16:45
*/
public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> implements com.muyu.data.source.service.DictTypeService {
}

View File

@ -0,0 +1,11 @@
<?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">
<!--
1.在mybats的开发中namespace有特殊的意思一定要是对应接口的全限定名
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
-->
<mapper namespace="com.muyu.data.source.mapper.DictDataMapper">
</mapper>

View File

@ -0,0 +1,11 @@
<?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">
<!--
1.在mybats的开发中namespace有特殊的意思一定要是对应接口的全限定名
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
-->
<mapper namespace="com.muyu.data.source.mapper.DictTypeMapper">
</mapper>