编写了数据字典的增删改

master
冷调 2024-08-22 17:20:52 +08:00
parent 64dec29ad1
commit d771ab6505
18 changed files with 293 additions and 28 deletions

View File

@ -24,7 +24,6 @@ import java.util.HashMap;
public class DataSourceConfig { public class DataSourceConfig {
//数据源连接池 //数据源连接池
private static HashMap<Long, DruidDataSource> dataSourceMap = new HashMap<>(); private static HashMap<Long, DruidDataSource> dataSourceMap = new HashMap<>();
//数据源连接池 //数据源连接池
public static void init(DataSource source, DataType dataType) { public static void init(DataSource source, DataType dataType) {
//创建连接池 //创建连接池

View File

@ -21,7 +21,7 @@ import lombok.experimental.SuperBuilder;
@SuperBuilder @SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("asset_accredit") @TableName(value = "asset_accredit", autoResultMap = true)
public class AssetAccredit { public class AssetAccredit {
/** /**
* *
@ -35,7 +35,7 @@ public class AssetAccredit {
@Excel(name = "授权编号") @Excel(name = "授权编号")
private String accreditNo; private String accreditNo;
/** /**
* id *
*/ */
private Long dataId; private Long dataId;
/** /**

View File

@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/** /**
* @author Lenovo * @author Lenovo
@ -20,6 +21,7 @@ import lombok.NoArgsConstructor;
*/ */
@Data @Data
@SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/** /**
* @author Lenovo * @author Lenovo
@ -20,6 +21,7 @@ import lombok.NoArgsConstructor;
*/ */
@Data @Data
@SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.source.domain.req.DataSourceQueryReq; import com.muyu.source.domain.req.DataSourceQueryReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -37,18 +38,21 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "主键") @Excel(name = "主键")
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
/** /**
* *
*/ */
@Excel(name = "接入源名称") @Excel(name = "接入源名称")
@TableField("name") @TableField("name")
private String name; private String name;
/** /**
* *
*/ */
@Excel(name = "数据来源系统名称") @Excel(name = "数据来源系统名称")
@TableField("system_name") @TableField("system_name")
private String systemName; private String systemName;
/** /**
@ -56,6 +60,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "数据库类型") @Excel(name = "数据库类型")
@TableField("data_type") @TableField("data_type")
private String dataType; private String dataType;
/** /**
@ -63,6 +68,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "ip地址") @Excel(name = "ip地址")
@TableField("ip") @TableField("ip")
private String ip; private String ip;
/** /**
@ -70,6 +76,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "端口号") @Excel(name = "端口号")
@TableField("port") @TableField("port")
private String port; private String port;
/** /**
@ -77,6 +84,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "数据库名称") @Excel(name = "数据库名称")
@TableField("database_name") @TableField("database_name")
private String databaseName; private String databaseName;
/** /**
@ -84,6 +92,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "用户名") @Excel(name = "用户名")
@TableField("user_name") @TableField("user_name")
private String userName; private String userName;
/** /**
@ -91,6 +100,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "密码") @Excel(name = "密码")
@TableField("password") @TableField("password")
private String password; private String password;
/** /**
@ -98,6 +108,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "数据连接参数") @Excel(name = "数据连接参数")
@TableField("connection_param") @TableField("connection_param")
private String connectionParam; private String connectionParam;
/** /**
@ -105,6 +116,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "是否初始化") @Excel(name = "是否初始化")
@TableField("is_init") @TableField("is_init")
private String isInit; private String isInit;
/** /**
@ -112,6 +124,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "初始连接数量") @Excel(name = "初始连接数量")
@TableField("init_total") @TableField("init_total")
private Long initNum; private Long initNum;
/** /**
@ -119,6 +132,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "最大连接数量") @Excel(name = "最大连接数量")
@TableField("max_num") @TableField("max_num")
private Long maxNum; private Long maxNum;
/** /**
@ -126,6 +140,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "最大等待时间") @Excel(name = "最大等待时间")
@TableField("max_wait_time") @TableField("max_wait_time")
private Long maxWaitTime; private Long maxWaitTime;
/** /**
@ -133,6 +148,7 @@ public class DataSource extends BaseEntity {
*/ */
@Excel(name = "最大等待次数") @Excel(name = "最大等待次数")
@TableField("max_wait_size") @TableField("max_wait_size")
private Long maxWaitSize; private Long maxWaitSize;

View File

@ -18,10 +18,10 @@ import lombok.experimental.SuperBuilder;
* @ Description * @ Description
*/ */
@Data @Data
@SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@SuperBuilder @TableName(value ="data_type", autoResultMap = true)
@TableName("data_type")
public class DataType { public class DataType {
/** /**
* *

View File

@ -0,0 +1,47 @@
package com.muyu.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.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-16:20
* @ Version1.0
* @ Description
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "dict_data", autoResultMap = true)
public class DictData {
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
@Excel(name = "主键")
private Long id;
/**
*
*/
@Excel(name = "字典标签")
private String dictLabel;
/**
*
*/
@Excel(name = "字典键值")
private String dictValue;
/**
* ID
*/
@Excel(name = "字典类型ID")
private Long dictTypeId;
}

View File

@ -0,0 +1,50 @@
package com.muyu.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.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-16:22
* @ Version1.0
* @ Description
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "dict_type", autoResultMap = true)
public class DictType extends BaseEntity {
/**
*
*/
@Excel(name = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@Excel(name = "字典名称")
private String dictName;
/**
*
*/
@Excel(name = "字典类型")
private String dictType;
/**
* ID
*/
@Excel(name = "数据源ID")
private Integer assetId;
}

View File

@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/** /**
* @author Lenovo * @author Lenovo
@ -19,6 +20,7 @@ import lombok.NoArgsConstructor;
* @ Description * @ Description
*/ */
@Data @Data
@SuperBuilder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,6 +1,7 @@
package com.muyu.source.domain.req; package com.muyu.source.domain.req;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -27,84 +28,84 @@ public class DataSourceEditReq extends BaseEntity {
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "接入源名称",description = "接入源名称")
private String name; private String name;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "数据来源系统",description = "数据来源系统")
private String systemName; private String systemName;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "mysql等",description = "要选择的数据库类型")
private String dataType; private String dataType;
/** /**
* ip * ip
*/ */
@Schema(type = "String",defaultValue = "ip地址",description = "ip地址,要连接的mysql的ip")
private String ip; private String ip;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "3306",description = "端口号")
private String port; private String port;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "t_user",description = "数据库名称")
private String databaseName; private String databaseName;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "root",description = "用户名")
private String userName; private String userName;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "root",description = "密码")
private String password; private String password;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "useUnicode=true&characterEncoding=utf8",description = "数据连接参数")
private String connectionParam; private String connectionParam;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "Y",description = "是否初始化 状态 'Y'/'N'")
private String isInit; private String isInit;
/** /**
* *
*/ */
@Schema(type = "Long",defaultValue = "5",description = "初始化连接数量")
private Long initTotal; private Long initTotal;
/** /**
* *
*/ */
@Schema(type = "Long",defaultValue = "10",description = "最大连接数量")
private Long maxNum; private Long maxNum;
/** /**
* *
*/ */
@Schema(type = "Long",defaultValue = "10",description = "最大等待时间")
private Long maxWaitTime; private Long maxWaitTime;
/** /**
* *
*/ */
@Schema(type = "Long",defaultValue = "3",description = "最大等待次数")
private Long maxWaitSize; private Long maxWaitSize;
} }

View File

@ -1,6 +1,7 @@
package com.muyu.source.domain.req; package com.muyu.source.domain.req;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -29,11 +30,13 @@ public class DataSourceQueryReq extends BaseEntity {
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "接入源名称",description = "接入源名称")
private String name; private String name;
/** /**
* *
*/ */
@Schema(type = "String",defaultValue = "数据来源系统",description = "数据来源系统")
private String systemName; private String systemName;
} }

View File

@ -1,9 +1,12 @@
package com.muyu.source.controller; package com.muyu.source.controller;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.source.domain.Children; import com.muyu.source.domain.Children;
import com.muyu.source.service.ChildrenService; import com.muyu.source.service.ChildrenService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -18,10 +21,14 @@ import org.springframework.web.bind.annotation.RestController;
* @ Description * @ Description
* @author Lenovo * @author Lenovo
*/ */
@Log4j2
@RestController @RestController
@RequestMapping("/children") @RequestMapping("/children")
@Tag(name = "数据库结构控制层",description = "进行数据库结构管理,查看等相关操作") @Tag(name = "数据库结构控制层",description = "进行数据库结构管理,查看等相关操作")
public class ChildrenController { public class ChildrenController {
public ChildrenController() {
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
}
@Autowired @Autowired
private ChildrenService childrenService; private ChildrenService childrenService;
@ -31,6 +38,7 @@ public class ChildrenController {
* @return * @return
*/ */
@GetMapping("/selectChildren/{id}") @GetMapping("/selectChildren/{id}")
@Operation(summary = "查询数据库结构",description = "可以根据数据源的ID查询数据库结构")
public Result<Children> selectChildren(@PathVariable("id") Integer id){ public Result<Children> selectChildren(@PathVariable("id") Integer id){
Children children = childrenService.getById(id); Children children = childrenService.getById(id);
return Result.success(children); return Result.success(children);
@ -42,6 +50,7 @@ public class ChildrenController {
* @return * @return
*/ */
@GetMapping("/getTableDataCount/{id}") @GetMapping("/getTableDataCount/{id}")
@Operation(summary = "查询单个数据库中表的数量",description = "可以根据数据源的ID查询单个数据库中表的数量")
public Result getTableDataCount(@PathVariable("id") Integer id){ public Result getTableDataCount(@PathVariable("id") Integer id){
//TODO 统计资产模型的总数量 //TODO 统计资产模型的总数量
return null; return null;

View File

@ -1,11 +1,13 @@
package com.muyu.source.controller; package com.muyu.source.controller;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.controller.BaseController;
import com.muyu.source.domain.DataSource; import com.muyu.source.domain.DataSource;
import com.muyu.source.domain.req.DataSourceQueryReq; import com.muyu.source.domain.req.DataSourceQueryReq;
import com.muyu.source.service.DataSourceService; import com.muyu.source.service.DataSourceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
@ -28,6 +30,9 @@ import java.util.List;
@RequestMapping("/dataSource") @RequestMapping("/dataSource")
@Tag(name = "数据源控制层",description = "进行数据源管理,查看等相关操作") @Tag(name = "数据源控制层",description = "进行数据源管理,查看等相关操作")
public class DataSourceController extends BaseController { public class DataSourceController extends BaseController {
public DataSourceController() {
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
}
/** /**
* *
@ -35,15 +40,6 @@ public class DataSourceController extends BaseController {
@Autowired @Autowired
private DataSourceService dataSourceService; private DataSourceService dataSourceService;
/**
*
* @return
*/
@GetMapping("/getDataSourceList")
public Result<List<DataSource>> list(){
List<DataSource> list =dataSourceService.list();
return Result.success(list);
}
/** /**
* ID * ID
@ -51,6 +47,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@GetMapping("getDataSourceById/{id}") @GetMapping("getDataSourceById/{id}")
@Operation(summary = "根据ID获取数据",description = "根据ID获取数据")
public Result<DataSource> getDataSourceById(@PathVariable("id") Long id){ public Result<DataSource> getDataSourceById(@PathVariable("id") Long id){
DataSource dataSource = dataSourceService.getById(id); DataSource dataSource = dataSourceService.getById(id);
return Result.success(dataSource); return Result.success(dataSource);
@ -62,6 +59,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "查询数据源列表的全部数据",description = "根据数据源的接入名称,来源系统名称可以进行数据源的筛选")
public Result<List<DataSource>> list(DataSourceQueryReq dataSourceQueryReq){ public Result<List<DataSource>> list(DataSourceQueryReq dataSourceQueryReq){
List<DataSource> list =dataSourceService.list(DataSource.queryBuild(dataSourceQueryReq)); List<DataSource> list =dataSourceService.list(DataSource.queryBuild(dataSourceQueryReq));
return Result.success(list); return Result.success(list);
@ -73,6 +71,7 @@ public class DataSourceController extends BaseController {
* @param response response * @param response response
*/ */
@PostMapping("/export") @PostMapping("/export")
@Operation(summary = "导出数据源",description = "导出数据源为Excel的格式")
public void derive(DataSource dataSource,HttpServletResponse response){ public void derive(DataSource dataSource,HttpServletResponse response){
List<DataSource> list = dataSourceService.list(dataSource); List<DataSource> list = dataSourceService.list(dataSource);
ExcelUtil<DataSource> excelUtil = new ExcelUtil<>(DataSource.class); ExcelUtil<DataSource> excelUtil = new ExcelUtil<>(DataSource.class);
@ -85,6 +84,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@GetMapping("/{id}") @GetMapping("/{id}")
@Operation(summary = "获取数据源详细信息",description = "根据ID获取数据源详细信息")
public Result<DataSource> getById(@PathVariable("id") Long id){ public Result<DataSource> getById(@PathVariable("id") Long id){
return Result.success(dataSourceService.getById(id)); return Result.success(dataSourceService.getById(id));
} }
@ -94,6 +94,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@GetMapping("/selectTableDataCount") @GetMapping("/selectTableDataCount")
@Operation(summary = "查询接入的数据库的总数",description = "查询接入的数据库的总数")
public Result selectTableDataCount() { public Result selectTableDataCount() {
//TODO 统计出数据接入的数量 //TODO 统计出数据接入的数量
return null; return null;
@ -106,6 +107,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@PostMapping("/insert") @PostMapping("/insert")
@Operation(summary = "数据源的添加",description = "数据源的添加")
public Result insert(@RequestBody DataSource dataSource){ public Result insert(@RequestBody DataSource dataSource){
dataSourceService.save(dataSource); dataSourceService.save(dataSource);
return Result.success(); return Result.success();
@ -117,6 +119,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "数据源的修改",description = "数据源的修改")
public Result update(@RequestBody DataSource dataSource){ public Result update(@RequestBody DataSource dataSource){
dataSourceService.updateById(dataSource); dataSourceService.updateById(dataSource);
return Result.success(); return Result.success();
@ -128,6 +131,7 @@ public class DataSourceController extends BaseController {
* @return * @return
*/ */
@DeleteMapping("/delete/{id}") @DeleteMapping("/delete/{id}")
@Operation(summary = "数据源的删除",description = "可以根据数据源的ID删除/批量删除")
public Result delete(@PathVariable("id") List<Long> id){ public Result delete(@PathVariable("id") List<Long> id){
dataSourceService.removeBatchByIds(id); dataSourceService.removeBatchByIds(id);
return Result.success(); return Result.success();

View File

@ -0,0 +1,68 @@
package com.muyu.source.controller;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result;
import com.muyu.source.domain.DictData;
import com.muyu.source.service.DictDataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-17:10
* @ Version1.0
* @ Description
*/
@Log4j2
@RestController
@RequestMapping("/dict_data")
@Tag(name = "数据字典控制层",description = "进行数据字典管理,查看等相关操作")
public class DictDataController {
public DictDataController() {
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
}
@Autowired
private DictDataService dictDataService;
/**
*
* @param dictData
* @return
*/
@PostMapping("addDictData")
@Operation(summary = "添加字典数据",description = "添加字典数据")
public Result addDictData(@RequestBody DictData dictData) {
dictDataService.save(dictData);
return Result.success();
}
/**
*
* @param dictData
* @return
*/
@PostMapping("editDictData")
@Operation(summary = "修改字典数据",description = "修改字典数据")
public Result editDictData(@RequestBody DictData dictData) {
dictDataService.updateById(dictData);
return Result.success();
}
/**
*
* @param id ID
* @return
*/
@GetMapping("/delDictData/{id}")
@Operation(summary = "删除字典数据",description = "根据ID删除字典数据")
public Result delDictData(@PathVariable("id") Long id) {
dictDataService.removeById(id);
return Result.success();
}
}

View File

@ -1,9 +1,12 @@
package com.muyu.source.controller; package com.muyu.source.controller;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result; import com.muyu.common.core.domain.Result;
import com.muyu.source.domain.TableData; import com.muyu.source.domain.TableData;
import com.muyu.source.service.TableDataService; import com.muyu.source.service.TableDataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -18,10 +21,15 @@ import org.springframework.web.bind.annotation.RestController;
* @ Description * @ Description
* @author Lenovo * @author Lenovo
*/ */
@Log4j2
@RestController @RestController
@RequestMapping("/tableData") @RequestMapping("/tableData")
@Tag(name = "表结构控制层",description = "进行表结构管理,查看等相关操作") @Tag(name = "表结构控制层",description = "进行表结构管理,查看等相关操作")
public class TableDataController { public class TableDataController {
public TableDataController() {
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
}
@Autowired @Autowired
private TableDataService tableDataService; private TableDataService tableDataService;
@ -31,6 +39,7 @@ public class TableDataController {
* @return * @return
*/ */
@GetMapping("/selectTableData/{id}") @GetMapping("/selectTableData/{id}")
@Operation(summary = "根据id查询表结构",description = "可以根据根据id查询表结构")
public Result<TableData> selectTableData(@PathVariable("id") Integer id){ public Result<TableData> selectTableData(@PathVariable("id") Integer id){
return Result.success(tableDataService.getById(id)); return Result.success(tableDataService.getById(id));
} }
@ -41,6 +50,7 @@ public class TableDataController {
* @return * @return
*/ */
@GetMapping("/selectTableDataCount/{id}") @GetMapping("/selectTableDataCount/{id}")
@Operation(summary = "统计出一个表中字段的数量",description = "可以根据表的ID统计单个表中中表的数量")
public Result selectTableDataCount(@PathVariable("id") Integer id){ public Result selectTableDataCount(@PathVariable("id") Integer id){
//TODO 统计出数据模型的数量 //TODO 统计出数据模型的数量
return null; return null;

View File

@ -0,0 +1,17 @@
package com.muyu.source.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.source.domain.DictData;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-17:13
* @ Version1.0
* @ Description
*/
@Mapper
public interface DictDataMapper extends BaseMapper<DictData> {
}

View File

@ -0,0 +1,15 @@
package com.muyu.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.source.domain.DictData;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-17:14
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface DictDataService extends IService<DictData> {
}

View File

@ -0,0 +1,20 @@
package com.muyu.source.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.source.domain.DictData;
import com.muyu.source.mapper.DictDataMapper;
import com.muyu.source.service.DictDataService;
import org.springframework.stereotype.Service;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-22-17:15
* @ Version1.0
* @ Description
*/
@Service
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements DictDataService {
}