feat():字典表初始化
parent
54817d5629
commit
cf374cfedd
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -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> {
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in New Issue