feat: 资产展示
parent
8a1ffb7da2
commit
fb2cb32004
|
@ -37,4 +37,5 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@PostMapping("/user/register")
|
||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
<artifactId>muyu-common</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
muyu-common通用模块
|
||||
</description>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
@Builder
|
||||
|
||||
public class DictionaryType extends BaseEntity{
|
||||
public class DictionaryType{
|
||||
|
||||
/**
|
||||
* 主鍵
|
||||
|
|
|
@ -21,6 +21,19 @@ public class AssetStructureList {
|
|||
private String databaseName;
|
||||
private Long type;
|
||||
|
||||
/**
|
||||
* 总接口
|
||||
*/
|
||||
private Integer kvtNumber;
|
||||
/**
|
||||
* 总表数
|
||||
*/
|
||||
private Integer tableSum;
|
||||
/**
|
||||
* 总表数中的总数量
|
||||
*/
|
||||
private Integer sum;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package com.muyu.kvt.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 授权 Authorization
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/4/24
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Authorization {
|
||||
private Integer id;
|
||||
private Long uid;
|
||||
private Long kvtId;
|
||||
}
|
|
@ -20,6 +20,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class ChildrenList {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String as;
|
||||
private Integer dataTotal;
|
||||
|
|
|
@ -65,11 +65,12 @@ public class DataStructure {
|
|||
* 是否字典
|
||||
*/
|
||||
private String isDict;
|
||||
|
||||
/**
|
||||
* 映射字典
|
||||
*/
|
||||
private String dictKey;
|
||||
|
||||
|
||||
private String value;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.muyu.kvt.domain.req;
|
||||
|
||||
import com.muyu.kvt.domain.AssetStructureList;
|
||||
import com.muyu.kvt.domain.ChildrenList;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* AssetStructureResponse
|
||||
*
|
||||
* @author LeYang
|
||||
* on 2024/4/21
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
public class AssetStructureResponse {
|
||||
private List<AssetStructureList> assetStructureLists;
|
||||
private List<ChildrenList> childrenLists;
|
||||
}
|
|
@ -16,5 +16,12 @@
|
|||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-system</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -89,6 +89,12 @@
|
|||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-kvt-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
|
@ -20,32 +21,7 @@ import java.sql.*;
|
|||
@SpringBootApplication
|
||||
public class MuyuApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuyuApplication.class);
|
||||
|
||||
// Connection connection=null;
|
||||
// Statement statement=null;
|
||||
// try {
|
||||
// Class.forName("org.postgresql.Driver");
|
||||
//
|
||||
// String url = "jdbc:postgresql://localhost:5432/postgres";
|
||||
// String user = "postgres";
|
||||
// String password = "root";
|
||||
// connection = DriverManager.getConnection(url,user,password);
|
||||
// statement= connection.createStatement();
|
||||
// String sql =" select * from user";
|
||||
// ResultSet resultSet = statement.executeQuery(sql);
|
||||
// while (resultSet.next()){
|
||||
// System.out.println("wfegrth"+resultSet);
|
||||
// }
|
||||
// resultSet.close();
|
||||
// statement.close();
|
||||
// connection.close();
|
||||
//
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// } catch (SQLException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
SpringApplication.run(MuyuApplication.class);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.muyu.kvt.controller;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Dictionary;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
@ -12,9 +11,9 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.kvt.dataStructure.OverallDataStructure;
|
||||
import com.muyu.kvt.datadisplay.DataDisplay;
|
||||
import com.muyu.kvt.dictionary.Diction;
|
||||
import com.muyu.kvt.dictionary.DictionaryType;
|
||||
import com.muyu.kvt.dictionary.Dictionaryy;
|
||||
|
@ -25,7 +24,6 @@ import com.muyu.kvt.domain.req.KvtSaveReq;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.muyu.kvt.service.KvtService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -84,7 +82,6 @@ public class KvtController extends BaseController {
|
|||
|
||||
/**
|
||||
* 新增kvt
|
||||
|
||||
*/
|
||||
@RequiresPermissions("kvt:kvt:add")
|
||||
@Log(title = "kvt ", businessType = BusinessType.INSERT)
|
||||
|
@ -133,6 +130,10 @@ public class KvtController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据库类型
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/dataTypeList")
|
||||
public Result<List<DataType>> dataTypeList(){
|
||||
List<DataType> dataTypeList=kvtService.dataTypeList();
|
||||
|
@ -140,16 +141,11 @@ public class KvtController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
// @PostMapping("/synchronizationAdd")
|
||||
// public Result synchronizationAdd (@RequestBody Kvt kvt) throws SQLException, ClassNotFoundException {
|
||||
//
|
||||
//// //构建当前授权
|
||||
//// Authorization.builder()
|
||||
//// .kvtId(kvt.getId())
|
||||
//// .uid(SecurityUtils.getUserId());
|
||||
// return kvtService.synchronizationAdd(kvt);
|
||||
//
|
||||
// }
|
||||
/**
|
||||
*
|
||||
* @param databaseName 数据库名称
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PostMapping("/selectDataAuthorization")
|
||||
public Result selectDataAuthorization (@RequestParam String databaseName){
|
||||
|
@ -182,26 +178,12 @@ public class KvtController extends BaseController {
|
|||
return Result.success(structureList);
|
||||
}
|
||||
|
||||
// @PostMapping("/selectName")
|
||||
// public Result<List<String>> listResult(@RequestParam String name) throws SQLException, ClassNotFoundException {
|
||||
// Kvt kvt= kvtService.listResult(name);
|
||||
// List<String> list= kvtService.kvtList(kvt);
|
||||
// return Result.success(list);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/assetStructureResponse")
|
||||
// public Result<List<AssetStructureResponse>> assetStructureResponse( ) throws SQLException, ClassNotFoundException {
|
||||
// List<AssetStructureResponse> assetStructureList= kvtService.assetStructureResponse();
|
||||
//
|
||||
// return Result.success(assetStructureList) ;
|
||||
// }
|
||||
|
||||
@PostMapping("/selectChild")
|
||||
public Result<Child> selectChild(@RequestParam String tableName){
|
||||
Child child= kvtService.selectChild(tableName);
|
||||
return Result.success(child);
|
||||
}
|
||||
|
||||
//查询数据结构
|
||||
@PostMapping("/selectChildAll")
|
||||
public Result<List<DataStructure>> selectChildAll(){
|
||||
List<DataStructure> childList=kvtService.selectChildAll();
|
||||
|
@ -224,12 +206,9 @@ public class KvtController extends BaseController {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
//同步数据添加到数据库
|
||||
@PostMapping("/synchronizationAdd")
|
||||
public Result synchronizationAdd(@RequestBody Kvt kvt) throws SQLException, ClassNotFoundException {
|
||||
|
||||
return kvtService.synchronizationAdd(kvt);
|
||||
}
|
||||
//添加字典
|
||||
|
@ -250,12 +229,34 @@ public class KvtController extends BaseController {
|
|||
@PostMapping("/selectDictionaryTypeId")
|
||||
public Result selectDictionaryTypeId(@RequestBody Dictionaryy dictionaryy) {
|
||||
Dictionaryy dictionaryType = kvtService.selectDictionaryTypeId(dictionaryy.getId());
|
||||
if (dictionaryy !=null ){
|
||||
if (dictionaryType !=null ){
|
||||
kvtService.delDictionaryTypeId(dictionaryy);
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
kvtService.dictionaryTypeAdd(dictionaryy);
|
||||
return Result.success("添加成功");
|
||||
|
||||
}
|
||||
/**
|
||||
* 修改数据模型(字典)
|
||||
*/
|
||||
@PostMapping("utilAssetModel")
|
||||
public Result utilAssetModel(@RequestBody DataStructure dataStructure){
|
||||
kvtService.utilAssetModel(dataStructure);
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
//查询数据结构数量
|
||||
@PostMapping("/OverallDataStructure")
|
||||
public Result<OverallDataStructure> selectOver(){
|
||||
return kvtService.OverallDataStructure();
|
||||
}
|
||||
|
||||
|
||||
//查询资产展示
|
||||
@PostMapping("/selectDataDisplay")
|
||||
public Result<List<DataDisplay>> listResult(){
|
||||
List<DataDisplay> list= kvtService.listResult();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.muyu.kvt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.kvt.datadisplay.DataDisplay;
|
||||
import com.muyu.kvt.dept.DataSource;
|
||||
import com.muyu.kvt.dept.DeptUserKvt;
|
||||
import com.muyu.kvt.dictionary.Diction;
|
||||
import com.muyu.kvt.dictionary.DictionaryType;
|
||||
import com.muyu.kvt.dictionary.Dictionaryy;
|
||||
|
@ -75,4 +78,19 @@ public interface KvtMapper extends BaseMapper<Kvt> {
|
|||
Dictionaryy selectDictionaryTypeId(Integer id);
|
||||
|
||||
void updateDictionaryTypeId(Dictionaryy dictionaryy);
|
||||
|
||||
void DeptUserKvtAdd(DeptUserKvt build);
|
||||
|
||||
List<DataSource> selectDataSource(String tableName);
|
||||
|
||||
void utilAssetModel(DataStructure dataStructure);
|
||||
|
||||
List<Synchronization> selectSyn();
|
||||
|
||||
List<Child> list();
|
||||
|
||||
void dataDisplayAdd(@Param("dataDisplays") List<DataDisplay> dataDisplays);
|
||||
|
||||
List<DataDisplay> listResult();
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ package com.muyu.kvt.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.kvt.dataStructure.OverallDataStructure;
|
||||
import com.muyu.kvt.datadisplay.DataDisplay;
|
||||
import com.muyu.kvt.dictionary.Diction;
|
||||
import com.muyu.kvt.dictionary.DictionaryType;
|
||||
import com.muyu.kvt.dictionary.Dictionaryy;
|
||||
import com.muyu.kvt.domain.*;
|
||||
import com.muyu.kvt.domain.req.AssetStructureResponse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
@ -21,15 +22,7 @@ Service接口
|
|||
* @date 2024-04-20
|
||||
*/
|
||||
public interface KvtService extends IService<Kvt> {
|
||||
/**
|
||||
* 查询kvt
|
||||
列表
|
||||
*
|
||||
* @param kvt kvt
|
||||
|
||||
* @return kvt
|
||||
集合
|
||||
*/
|
||||
public List<Kvt> list(Kvt kvt);
|
||||
|
||||
boolean connectionTest(Kvt kvt) throws ClassNotFoundException, SQLException;
|
||||
|
@ -37,16 +30,6 @@ public interface KvtService extends IService<Kvt> {
|
|||
List<DataType> dataTypeList();
|
||||
|
||||
|
||||
Kvt listResult(String name);
|
||||
|
||||
// List<AssetStructureList> assetStructureList() throws ClassNotFoundException, SQLException;
|
||||
|
||||
List<AssetStructureResponse> assetStructureResponse() throws ClassNotFoundException, SQLException;
|
||||
|
||||
// Result synchronizationAdd(Kvt kvt) throws SQLException, ClassNotFoundException;
|
||||
|
||||
|
||||
|
||||
List<AssetStructureList> assetStructureList();
|
||||
|
||||
List<ChildrenList> selectDepartment(String databaseName);
|
||||
|
@ -77,7 +60,11 @@ public interface KvtService extends IService<Kvt> {
|
|||
|
||||
void delDictionaryTypeId(Dictionaryy dictionaryy);
|
||||
|
||||
void utilAssetModel(DataStructure dataStructure);
|
||||
|
||||
// List<String> kvtList(Kvt kvt) throws ClassNotFoundException, SQLException;
|
||||
Result<OverallDataStructure> OverallDataStructure();
|
||||
|
||||
|
||||
List<DataDisplay> listResult();
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE `id` = #{id}
|
||||
|
||||
|
||||
</update>
|
||||
<update id="utilAssetModel">
|
||||
UPDATE `data_basete`.`data_structure`
|
||||
SET `war_name` = #{warName},
|
||||
`table_name` = #{tableName},
|
||||
`name` = #{name},
|
||||
`comment` = #{comment},
|
||||
`isPrimaryKey` = #{isPrimaryKey},
|
||||
`type` = #{type},
|
||||
`mappingType` = #{mappingType},
|
||||
`length` = #{length},
|
||||
`decimalPlaces` = #{decimalPlaces},
|
||||
`isNull` = #{isNull},
|
||||
`defaultValue` = #{defaultValue},
|
||||
`isDict` = #{isDict},
|
||||
`dictKey` = #{dictKey},
|
||||
`value` = #{value}
|
||||
WHERE `id` = #{id};
|
||||
|
||||
|
||||
</update>
|
||||
<delete id="del">
|
||||
truncate table #{tableName}
|
||||
|
@ -104,9 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectChild" resultType="com.muyu.kvt.domain.Child">
|
||||
select * from child where name =#{tableName}
|
||||
</select>
|
||||
<select id="selectChildAll" resultType="com.muyu.kvt.domain.Child">
|
||||
select * from child
|
||||
</select>
|
||||
|
||||
<select id="deptList" resultType="com.muyu.common.system.domain.SysDept">
|
||||
select * from dept
|
||||
</select>
|
||||
|
@ -138,6 +156,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectDictionaryTypeId" resultType="com.muyu.kvt.dictionary.Dictionaryy">
|
||||
select * from dictionary where id =#{id}
|
||||
</select>
|
||||
<select id="selectDataSource" resultType="com.muyu.kvt.dept.DataSource">
|
||||
select * from data_structure where table_name =#{tableName}
|
||||
</select>
|
||||
<select id="selectChildAll" resultType="com.muyu.kvt.domain.DataStructure">
|
||||
select * from child
|
||||
</select>
|
||||
<select id="selectSyn" resultType="com.muyu.kvt.domain.Synchronization">
|
||||
select * from synchronization
|
||||
</select>
|
||||
<select id="list" resultType="com.muyu.kvt.domain.Child">
|
||||
select * from child
|
||||
</select>
|
||||
<select id="listResult" resultType="com.muyu.kvt.datadisplay.DataDisplay">
|
||||
select * from data_display
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="synchronizationAdd">
|
||||
|
@ -197,9 +230,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
<insert id="dictionTypeAdd">
|
||||
INSERT INTO `data_basete`.`dictionary_type`
|
||||
( `name`, `type`, `status`)
|
||||
VALUES (#{name}, #{type}, #{status});
|
||||
(`data_access`, `name`, `type`, `status`)
|
||||
VALUES (#{dataAccess},#{name}, #{type}, #{status});
|
||||
|
||||
|
||||
</insert>
|
||||
<insert id="DeptUserKvtAdd">
|
||||
INSERT INTO `data_basete`.`detp_user_kvt`
|
||||
( `user_id`, `kvt_id`, `dept_id`)
|
||||
VALUES ( #{userId}, #{kvtId}, #{deptId});
|
||||
</insert>
|
||||
<insert id="dictionTypeAd">
|
||||
INSERT INTO `data_basete`.`dictionary`
|
||||
( `dictionary_name`, `dictionary_value`, `type`, `diction_status`
|
||||
)
|
||||
VALUES ( #{dictionaryName}, #{dictionaryValue}, #{type}, 0);
|
||||
|
||||
|
||||
</insert>
|
||||
<insert id="dataDisplayAdd">
|
||||
INSERT INTO `data_basete`.`data_display`
|
||||
(`war_name`, `type`, `value`)
|
||||
VALUES
|
||||
<foreach collection="dataDisplays" item="dataDisplays" separator=",">
|
||||
(#{dataDisplays.warName}, #{dataDisplays.type}, #{dataDisplays.value})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
|
|
|
@ -306,5 +306,12 @@ public class SysUserController extends BaseController {
|
|||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
@PostMapping("/selectUserId")
|
||||
public Result<SysUser> selectUserId(@RequestParam("userId") Long userId){
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
return Result.success(sysUser);
|
||||
}
|
||||
|
||||
// @PostMapping("/updateUserPermissions")
|
||||
// public Result updateUserPermissions(@RequestBody )
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue