Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
|
f6c40ea666 | |
|
8ea31f9805 | |
|
f0ef7133ea | |
|
7d880faa7f | |
|
3bb6b71a99 | |
|
43feb93e6a | |
|
c647dbf7fe | |
|
50b273c1fc | |
|
43fec1afd3 | |
|
596a557ca1 | |
|
8e2250f874 | |
|
0324d7c70d | |
|
72caf426a7 |
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-common-goods</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- MuYu Common Core-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.common.redis.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.BoundSetOperations;
|
||||
import org.springframework.data.redis.core.HashOperations;
|
||||
|
@ -143,7 +144,7 @@ public class RedisService {
|
|||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> List<T> getCacheList (final String key) {
|
||||
return redisTemplate.opsForList().range(key, 0, -1);
|
||||
return (List<T>) redisTemplate.opsForList().range(key, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,10 +191,9 @@ public class RedisService {
|
|||
* 获得缓存的Map
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public <T> Map<String, T> getCacheMap (final String key) {
|
||||
public <T> Map<Object, Object> getCacheMap (final String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ public class TokenService {
|
|||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
rspMap.put("expires_in", expireTime);
|
||||
System.out.println(token);
|
||||
return rspMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户身份信息
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<module>muyu-common-datascope</module>
|
||||
<module>muyu-common-datasource</module>
|
||||
<module>muyu-common-system</module>
|
||||
<module>muyu-common-goods</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-common</artifactId>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
||||
select column_name,
|
||||
(case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required,
|
||||
(case when (is_nullable = 'stream' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required,
|
||||
(case when column_key = 'PRI' then '1' else '0' end) as is_pk,
|
||||
ordinal_position as sort,
|
||||
column_comment,
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods-test</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>muyu-goods</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.goods;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MuYuGoodsApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MuYuGoodsApplication.class,args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.goods.constant;
|
||||
|
||||
/**
|
||||
* 配置编码常量
|
||||
* @ClassName ConfigCodeConstants
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/4 15:28
|
||||
*/
|
||||
public class ConfigCodeConstants {
|
||||
/**
|
||||
* 文件基础路径
|
||||
*/
|
||||
// public final static String BASE_FILE_PATH="D:/workspace/gtl-ruoyi-server/ruoyi-modules/ruoyi-rule_engine/ruoyi-rule_engine-server/src/main/java/com/ruoyi/ruleEngine/scope/";
|
||||
public final static String BASE_FILE_PATH="D:\\woster\\gs1\\assets-ser\\muyu-modules\\muyu-goods\\src\\main\\java\\com\\muyu\\goods\\scope\\";
|
||||
/**
|
||||
* 配置文件名数组
|
||||
*/
|
||||
public final static String[] CONFIG_FILE_NAME_ARRAY=new String[]{"TestClass.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||
public final static String[] CONFIG_FILE_NAME_CODE=new String[]{"ToCode.txt","TaskContextHolder.java","DataSetContextHolder.java","RecordContextHolder.java","DataModelContextHolder.java"};
|
||||
/**
|
||||
* 配置文件类型数组
|
||||
*/
|
||||
public final static String[] CONFIG_FILE_TYPE_ARRAY=new String[]{"测试模版","任务","数据集","资产记录","资产模型"};
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.goods.constant;
|
||||
|
||||
/**
|
||||
* 规则运行常量
|
||||
* @ClassName RuleOperationConstants
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/4 16:12
|
||||
*/
|
||||
public class RuleOperationConstants {
|
||||
/**
|
||||
* 运行类型
|
||||
*/
|
||||
public final static String CLASS_NAME="TestClass";
|
||||
/**
|
||||
* 文件后缀
|
||||
*/
|
||||
public final static String FILE_SUFFIX=".java";
|
||||
/**
|
||||
* 运行方法
|
||||
*/
|
||||
public final static String METHOD_NAME="ruleTest";
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.goods.domain.model.TextData;
|
||||
import com.muyu.goods.domain.resp.EngineConfigResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.goods.domain.Config;
|
||||
import com.muyu.goods.service.IConfigService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 引擎Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class ConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*/
|
||||
@RequiresPermissions("system:config:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Config>> list(Config config)
|
||||
{
|
||||
startPage();
|
||||
List<Config> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listConfigEs/{ruleId}")
|
||||
public Result<List<Config>> listConfigEs(@PathVariable Long ruleId){
|
||||
List<Config> list = configService.listConfigEs(ruleId);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出引擎列表
|
||||
*/
|
||||
@RequiresPermissions("system:config:export")
|
||||
@Log(title = "引擎", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Config config)
|
||||
{
|
||||
List<Config> list = configService.selectConfigList(config);
|
||||
ExcelUtil<Config> util = new ExcelUtil<Config>(Config.class);
|
||||
util.exportExcel(response, list, "引擎数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取引擎详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:config:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(configService.selectConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增引擎
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "引擎", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Config config)
|
||||
{
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改引擎
|
||||
*/
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "引擎", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Config config)
|
||||
{
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除引擎
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "引擎", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(configService.deleteConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 引擎测试
|
||||
* @param textData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/testData")
|
||||
public Result<Object> ruleText(@RequestBody TextData textData){
|
||||
return success(configService.testData(textData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getScopeInfo/{id}")
|
||||
public Result<EngineConfigResp> getScopeInfo(@PathVariable Integer id) {
|
||||
return success(configService.getScopeInfo(id));
|
||||
}
|
||||
|
||||
@PostMapping("queryConfigInfo/{ruleId}")
|
||||
public Result<List<Config>> queryConfigInfo(@PathVariable Long ruleId){
|
||||
return success(configService.queryConfigInfo(ruleId));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.goods.domain.Cope;
|
||||
import com.muyu.goods.service.CopeService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cope")
|
||||
public class CopeController extends BaseController {
|
||||
@Autowired
|
||||
private CopeService service;
|
||||
|
||||
@PostMapping("/list")
|
||||
public Result<List<Cope>> list() {
|
||||
return success(service.list());
|
||||
}
|
||||
|
||||
@PostMapping("/list2")
|
||||
public Result<List<Cope>> list2() {
|
||||
return success(service.list2());
|
||||
}
|
||||
|
||||
@PostMapping("selType/{name}")
|
||||
public Result<List<Cope>> selType(@PathVariable String name){
|
||||
return success(service.selType(name));
|
||||
}
|
||||
|
||||
@PostMapping("selObject")
|
||||
public Result<List<Cope>> selObject(@RequestBody Cope cope){
|
||||
return success(service.selObject(cope));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.goods.domain.Edition;
|
||||
import com.muyu.goods.service.IEditionService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 规则引擎版本Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/edition")
|
||||
public class EditionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEditionService editionService;
|
||||
|
||||
/**
|
||||
* 查询规则引擎版本列表
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Edition>> list()
|
||||
{
|
||||
startPage();
|
||||
List<Edition> list = editionService.selectEditionList();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相应的规则引擎版本
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectListRuleId/{ruleId}")
|
||||
public Result<List<Edition>> selectListRuleId(@PathVariable Long ruleId){
|
||||
return success(editionService.selectListRuleId(ruleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出规则引擎版本列表
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:export")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Edition edition)
|
||||
{
|
||||
List<Edition> list = editionService.selectEditionList();
|
||||
ExcelUtil<Edition> util = new ExcelUtil<Edition>(Edition.class);
|
||||
util.exportExcel(response, list, "规则引擎版本数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规则引擎版本详细信息
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(editionService.selectEditionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则引擎版本
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:add")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Edition edition)
|
||||
{
|
||||
return toAjax(editionService.insertEdition(edition));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则引擎版本
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:edit")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Edition edition)
|
||||
{
|
||||
return toAjax(editionService.updateEdition(edition));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则引擎版本
|
||||
*/
|
||||
@RequiresPermissions("goods:edition:remove")
|
||||
@Log(title = "规则引擎版本", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(editionService.deleteEditionByIds(ids));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.goods.domain.RuleEngine;
|
||||
import com.muyu.goods.service.IRuleEngineService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 规则引擎Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/engine")
|
||||
public class RuleEngineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRuleEngineService ruleEngineService;
|
||||
|
||||
/**
|
||||
* 查询规则引擎列表
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine)
|
||||
{
|
||||
startPage();
|
||||
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出规则引擎列表
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:export")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RuleEngine ruleEngine)
|
||||
{
|
||||
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
|
||||
ExcelUtil<RuleEngine> util = new ExcelUtil<RuleEngine>(RuleEngine.class);
|
||||
util.exportExcel(response, list, "规则引擎数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取规则引擎详细信息
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:query")
|
||||
@GetMapping(value = "/{ruleId}")
|
||||
public Result getInfo(@PathVariable("ruleId") Long ruleId)
|
||||
{
|
||||
return success(ruleEngineService.selectRuleEngineByRuleId(ruleId));
|
||||
}
|
||||
|
||||
@PostMapping("selectRuleEngineOne/{ruleId}")
|
||||
public Result selectRuleEngineOne(@PathVariable Long ruleId){
|
||||
return success(ruleEngineService.selectRuleEngineOne(ruleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则引擎
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:add")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody RuleEngine ruleEngine)
|
||||
{
|
||||
return toAjax(ruleEngineService.insertRuleEngine(ruleEngine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则引擎
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:edit")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody RuleEngine ruleEngine)
|
||||
{
|
||||
return toAjax(ruleEngineService.updateRuleEngine(ruleEngine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则引擎
|
||||
*/
|
||||
@RequiresPermissions("goods:engine:remove")
|
||||
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ruleIds}")
|
||||
public Result remove(@PathVariable Long[] ruleIds)
|
||||
{
|
||||
return toAjax(ruleEngineService.deleteRuleEngineByRuleIds(ruleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/description/{ruleId}")
|
||||
public Result<String> description(@PathVariable Integer ruleId){
|
||||
return success(ruleEngineService.description(ruleId));
|
||||
}
|
||||
|
||||
@PutMapping("/updateRuleIsActivate")
|
||||
public Result updateRuleIsActivate(@RequestBody RuleEngine ruleEngine){
|
||||
ruleEngineService.updateRuleIsActivate(ruleEngine);
|
||||
return success("改变激活状态");
|
||||
}
|
||||
@PutMapping("/updateRuleStatus")
|
||||
public Result updateRuleStatus(@RequestBody RuleEngine ruleEngine){
|
||||
ruleEngineService.updateRuleStatus(ruleEngine);
|
||||
return success("改变规则状态");
|
||||
}
|
||||
|
||||
@PostMapping("/spliceNameToCode")
|
||||
public Result spliceNameToCode(@RequestParam String name, @RequestParam String code,@RequestParam Integer level){
|
||||
return ruleEngineService.spliceNameToCode(name,code,level);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.goods.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 com.muyu.goods.domain.resp.AnduserIndexResp;
|
||||
import com.muyu.goods.domain.resp.AnduserQueryResp;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("engine_config")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Anduser", description = "测试项目")
|
||||
public class Anduser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
*主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableId(value = "name")
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@TableId(value = "sex")
|
||||
@ApiModelProperty(name = "性别", value = "性别")
|
||||
private String sex;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@TableId(value = "age")
|
||||
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
public static Anduser query(AnduserQueryResp anduserQueryResp){
|
||||
return Anduser.builder()
|
||||
.name(anduserQueryResp.getName())
|
||||
.sex(anduserQueryResp.getSex())
|
||||
.age(anduserQueryResp.getAge())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
public static Anduser index(AnduserIndexResp anduserIndexResp){
|
||||
return Anduser.builder()
|
||||
.name(anduserIndexResp.getName())
|
||||
.sex(anduserIndexResp.getSex())
|
||||
.age(anduserIndexResp.getAge())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.muyu.goods.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;
|
||||
|
||||
/**
|
||||
* 引擎对象 config
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public class Config extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
private Long id;
|
||||
|
||||
/** 版本编码 */
|
||||
@Excel(name = "版本编码")
|
||||
private String versionCode;
|
||||
|
||||
/** 规则内容 */
|
||||
@Excel(name = "规则内容")
|
||||
private String ruleContent;
|
||||
|
||||
/** 注释 */
|
||||
@Excel(name = "注释")
|
||||
private String remark;
|
||||
|
||||
/** 维护编号 */
|
||||
@Excel(name = "维护编号")
|
||||
private Long ruleId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setVersionCode(String versionCode)
|
||||
{
|
||||
this.versionCode = versionCode;
|
||||
}
|
||||
|
||||
public String getVersionCode()
|
||||
{
|
||||
return versionCode;
|
||||
}
|
||||
public void setRuleContent(String ruleContent)
|
||||
{
|
||||
this.ruleContent = ruleContent;
|
||||
}
|
||||
|
||||
public String getRuleContent()
|
||||
{
|
||||
return ruleContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("ruleContent", getRuleContent())
|
||||
.append("remark", getRemark())
|
||||
.append("ruleId", getRuleId())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.goods.domain;
|
||||
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Cope extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
*命名
|
||||
*/
|
||||
private String val;
|
||||
/**
|
||||
*内容
|
||||
*/
|
||||
private String code;
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.muyu.goods.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;
|
||||
|
||||
/**
|
||||
* 规则引擎版本对象 edition
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public class Edition extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 规则序号 */
|
||||
@Excel(name = "规则序号")
|
||||
private Long ruleId;
|
||||
|
||||
/** 版本类 */
|
||||
@Excel(name = "版本类")
|
||||
private String versionClass;
|
||||
|
||||
/** 版本名称 */
|
||||
@Excel(name = "版本名称")
|
||||
private String name;
|
||||
|
||||
/** 版本编码 */
|
||||
@Excel(name = "版本编码")
|
||||
private String versionCode;
|
||||
|
||||
/** 版本状态 */
|
||||
@Excel(name = "是否发布")
|
||||
private Integer editionStatus;
|
||||
|
||||
/** 引擎状态 */
|
||||
@Excel(name = "是否激活")
|
||||
private String ruleStatus;
|
||||
|
||||
@Excel(name = "是否测试")
|
||||
private Integer ruleIsTest;
|
||||
|
||||
/** 内容 */
|
||||
@Excel(name = "内容描述")
|
||||
private String editionContent;
|
||||
|
||||
@Excel(name = "规则内容")
|
||||
private String ruleContent;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public String getVersionClass() {
|
||||
return versionClass;
|
||||
}
|
||||
|
||||
public void setVersionClass(String versionClass) {
|
||||
this.versionClass = versionClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersionCode() {
|
||||
return versionCode;
|
||||
}
|
||||
|
||||
public void setVersionCode(String versionCode) {
|
||||
this.versionCode = versionCode;
|
||||
}
|
||||
|
||||
public Integer getEditionStatus() {
|
||||
return editionStatus;
|
||||
}
|
||||
|
||||
public void setEditionStatus(Integer editionStatus) {
|
||||
this.editionStatus = editionStatus;
|
||||
}
|
||||
|
||||
public String getRuleStatus() {
|
||||
return ruleStatus;
|
||||
}
|
||||
|
||||
public void setRuleStatus(String ruleStatus) {
|
||||
this.ruleStatus = ruleStatus;
|
||||
}
|
||||
|
||||
public Integer getRuleIsTest() {
|
||||
return ruleIsTest;
|
||||
}
|
||||
|
||||
public void setRuleIsTest(Integer ruleIsTest) {
|
||||
this.ruleIsTest = ruleIsTest;
|
||||
}
|
||||
|
||||
public String getEditionContent() {
|
||||
return editionContent;
|
||||
}
|
||||
|
||||
public void setEditionContent(String editionContent) {
|
||||
this.editionContent = editionContent;
|
||||
}
|
||||
|
||||
public String getRuleContent() {
|
||||
return ruleContent;
|
||||
}
|
||||
|
||||
public void setRuleContent(String ruleContent) {
|
||||
this.ruleContent = ruleContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("ruleId", getRuleId())
|
||||
.append("versionClass", getVersionClass())
|
||||
.append("name", getName())
|
||||
.append("versionCode", getVersionCode())
|
||||
.append("editionStatus", getEditionStatus())
|
||||
.append("ruleStatus", getRuleStatus())
|
||||
.append("ruleIsTest",getRuleIsTest())
|
||||
.append("ruleContent",getRuleContent())
|
||||
.append("editionContent", getEditionContent())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package com.muyu.goods.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;
|
||||
|
||||
/**
|
||||
* 规则引擎对象 rule_engine
|
||||
*
|
||||
* @author goods
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public class RuleEngine extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long ruleId;
|
||||
|
||||
/** 规则名称 */
|
||||
@Excel(name = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/** 引擎编码 */
|
||||
@Excel(name = "引擎编码")
|
||||
private String ruleCode;
|
||||
|
||||
/** 规则级别 */
|
||||
@Excel(name = "规则级别")
|
||||
private Integer ruleLevel;
|
||||
|
||||
/** 规则类型 */
|
||||
@Excel(name = "规则类型")
|
||||
private Integer ruleType;
|
||||
|
||||
/** 是否激活 */
|
||||
@Excel(name = "是否激活")
|
||||
private String ruleIsActivate;
|
||||
|
||||
/** 规则状态 */
|
||||
@Excel(name = "规则状态")
|
||||
private String ruleStatus;
|
||||
|
||||
/** 规则描述 */
|
||||
@Excel(name = "规则描述")
|
||||
private String description;
|
||||
|
||||
public void setRuleId(Long ruleId)
|
||||
{
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId()
|
||||
{
|
||||
return ruleId;
|
||||
}
|
||||
public void setRuleName(String ruleName)
|
||||
{
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
public String getRuleName()
|
||||
{
|
||||
return ruleName;
|
||||
}
|
||||
public void setRuleCode(String ruleCode)
|
||||
{
|
||||
this.ruleCode = ruleCode;
|
||||
}
|
||||
|
||||
public String getRuleCode()
|
||||
{
|
||||
return ruleCode;
|
||||
}
|
||||
public void setRuleLevel(Integer ruleLevel)
|
||||
{
|
||||
this.ruleLevel = ruleLevel;
|
||||
}
|
||||
|
||||
public Integer getRuleLevel()
|
||||
{
|
||||
return ruleLevel;
|
||||
}
|
||||
public void setRuleType(Integer ruleType)
|
||||
{
|
||||
this.ruleType = ruleType;
|
||||
}
|
||||
|
||||
public Integer getRuleType()
|
||||
{
|
||||
return ruleType;
|
||||
}
|
||||
public void setRuleIsActivate(String ruleIsActivate)
|
||||
{
|
||||
this.ruleIsActivate = ruleIsActivate;
|
||||
}
|
||||
|
||||
public String getRuleIsActivate()
|
||||
{
|
||||
return ruleIsActivate;
|
||||
}
|
||||
public void setRuleStatus(String ruleStatus)
|
||||
{
|
||||
this.ruleStatus = ruleStatus;
|
||||
}
|
||||
|
||||
public String getRuleStatus()
|
||||
{
|
||||
return ruleStatus;
|
||||
}
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("ruleId", getRuleId())
|
||||
.append("ruleName", getRuleName())
|
||||
.append("ruleCode", getRuleCode())
|
||||
.append("ruleLevel", getRuleLevel())
|
||||
.append("ruleType", getRuleType())
|
||||
.append("ruleIsActivate", getRuleIsActivate())
|
||||
.append("ruleStatus", getRuleStatus())
|
||||
.append("description", getDescription())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.goods.domain.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TextData {
|
||||
|
||||
/**
|
||||
* 引擎编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 测试数据
|
||||
*/
|
||||
private List<String> list;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.goods.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RuleEditionReq {
|
||||
private String val;
|
||||
private String code;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.muyu.goods.domain.req;
|
||||
|
||||
public class SpliceRep {
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.goods.domain.resp;
|
||||
|
||||
import com.muyu.goods.domain.Anduser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "AnduserIndexResp", description = "测试添加")
|
||||
public class AnduserIndexResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@ApiModelProperty(name = "性别", value = "性别")
|
||||
private String sex;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.goods.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "AnduserQueryResp", description = "测试查询")
|
||||
public class AnduserQueryResp extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@ApiModelProperty(name = "性别", value = "性别")
|
||||
private String sex;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||
private Integer age;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.goods.domain.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "AnduserQueryResp", description = "测试查询")
|
||||
public class AnduserUpdateResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private String id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(name = "名称", value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@ApiModelProperty(name = "性别", value = "性别")
|
||||
private String sex;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@ApiModelProperty(name = "年龄", value = "年龄")
|
||||
private Integer age;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.goods.domain.resp;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
public class EngineConfigResp {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 类型 */
|
||||
private String type;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 代码 */
|
||||
private String code;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.muyu.goods.dymamicLoad;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
import javax.tools.ToolProvider;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName DynamicLoader
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/1 20:37
|
||||
*/
|
||||
public class DynamicLoader {
|
||||
/**
|
||||
* 通过类名和其代码(Java代码字符串),编译得到字节码,返回类名及其对应类的字节码,封装于Map中,值得注意的是,
|
||||
* 平常类中就编译出来的字节码只有一个类,但是考虑到内部类的情况, 会出现很多个类名及其字节码,所以用Map封装方便。
|
||||
*
|
||||
* @param javaName 类名
|
||||
* @return map
|
||||
*/
|
||||
public static Map<String, byte[]> compile(String javaName, String javaSrc) {
|
||||
// 调用java编译器接口
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
StandardJavaFileManager stdManager = compiler
|
||||
.getStandardFileManager(null, null, null);
|
||||
|
||||
try (MemoryJavaFileManager manager = new MemoryJavaFileManager(
|
||||
stdManager)) {
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
JavaFileObject javaFileObject = manager.makeStringSource(javaName,
|
||||
javaSrc);
|
||||
JavaCompiler.CompilationTask task = compiler.getTask(null, manager,
|
||||
null, null, null, Arrays.asList(javaFileObject));
|
||||
if (task.call()) {
|
||||
return manager.getClassBytes();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 先根据类名在内存中查找是否已存在该类,若不存在则调用 URLClassLoader的 defineClass方法加载该类
|
||||
* URLClassLoader的具体作用就是将class文件加载到jvm虚拟机中去
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public static class MemoryClassLoader extends URLClassLoader {
|
||||
Map<String, byte[]> classBytes = new HashMap<String, byte[]>();
|
||||
|
||||
public MemoryClassLoader(Map<String, byte[]> classBytes) {
|
||||
super(new URL[0], MemoryClassLoader.class.getClassLoader());
|
||||
this.classBytes.putAll(classBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> findClass(String name)
|
||||
throws ClassNotFoundException {
|
||||
byte[] buf = classBytes.get(name);
|
||||
if (buf == null) {
|
||||
return super.findClass(name);
|
||||
}
|
||||
classBytes.remove(name);
|
||||
return defineClass(name, buf, 0, buf.length);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
package com.muyu.goods.dymamicLoad;
|
||||
|
||||
import javax.tools.*;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.nio.CharBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 将编译好的.class文件保存到内存当中,这里的内存也就是map映射当中
|
||||
* @ClassName MemoryJavaFileManager
|
||||
* @Author 森静若林
|
||||
* @Date 2024/5/1 20:38
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final class MemoryJavaFileManager extends ForwardingJavaFileManager {
|
||||
|
||||
private final static String EXT = ".java";// Java源文件的扩展名
|
||||
private Map<String, byte[]> classBytes;// 用于存放.class文件的内存
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MemoryJavaFileManager(JavaFileManager fileManager) {
|
||||
super(fileManager);
|
||||
classBytes = new HashMap<String, byte[]>();
|
||||
}
|
||||
|
||||
public Map<String, byte[]> getClassBytes() {
|
||||
return classBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
classBytes = new HashMap<String, byte[]>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* 一个文件对象,用来表示从string中获取到的source,一下类容是按照jkd给出的例子写的
|
||||
*/
|
||||
private static class StringInputBuffer extends SimpleJavaFileObject {
|
||||
// The source code of this "file".
|
||||
final String code;
|
||||
|
||||
/**
|
||||
* Constructs a new JavaSourceFromString.
|
||||
*
|
||||
* @param name 此文件对象表示的编译单元的name
|
||||
* @param code 此文件对象表示的编译单元source的code
|
||||
*/
|
||||
StringInputBuffer(String name, String code) {
|
||||
super(toURI(name), Kind.SOURCE);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) {
|
||||
return CharBuffer.wrap(code);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Reader openReader() {
|
||||
return new StringReader(code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Java字节码存储到classBytes映射中的文件对象
|
||||
*/
|
||||
private class ClassOutputBuffer extends SimpleJavaFileObject {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @param name className
|
||||
*/
|
||||
ClassOutputBuffer(String name) {
|
||||
super(toURI(name), Kind.CLASS);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream openOutputStream() {
|
||||
return new FilterOutputStream(new ByteArrayOutputStream()) {
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
out.close();
|
||||
ByteArrayOutputStream bos = (ByteArrayOutputStream) out;
|
||||
|
||||
// 这里需要修改
|
||||
classBytes.put(name, bos.toByteArray());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaFileObject getJavaFileForOutput(
|
||||
Location location, String className,
|
||||
JavaFileObject.Kind kind, FileObject sibling) throws IOException {
|
||||
if (kind == JavaFileObject.Kind.CLASS) {
|
||||
return new ClassOutputBuffer(className);
|
||||
} else {
|
||||
return super.getJavaFileForOutput(location, className, kind,
|
||||
sibling);
|
||||
}
|
||||
}
|
||||
|
||||
static JavaFileObject makeStringSource(String name, String code) {
|
||||
return new StringInputBuffer(name, code);
|
||||
}
|
||||
|
||||
static URI toURI(String name) {
|
||||
File file = new File(name);
|
||||
if (file.exists()) {// 如果文件存在,返回他的URI
|
||||
return file.toURI();
|
||||
} else {
|
||||
try {
|
||||
final StringBuilder newUri = new StringBuilder();
|
||||
newUri.append("mfm:///");
|
||||
newUri.append(name.replace('.', '/'));
|
||||
if (name.endsWith(EXT)) {
|
||||
newUri.replace(newUri.length() - EXT.length(),
|
||||
newUri.length(), EXT);
|
||||
}
|
||||
return URI.create(newUri.toString());
|
||||
} catch (Exception exp) {
|
||||
return URI.create("mfm:///com/sun/script/java/java_source");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.goods.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.goods.domain.Config;
|
||||
|
||||
/**
|
||||
* 引擎Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public interface ConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 引擎
|
||||
*/
|
||||
public Config selectConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 引擎集合
|
||||
*/
|
||||
public List<Config> selectConfigList(Config config);
|
||||
|
||||
/**
|
||||
* 新增引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConfig(Config config);
|
||||
|
||||
/**
|
||||
* 修改引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConfig(Config config);
|
||||
|
||||
/**
|
||||
* 删除引擎
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除引擎
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigByIds(Long[] ids);
|
||||
|
||||
List<Config> listConfigEs(Long ruleId);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.muyu.goods.mapper;
|
||||
|
||||
import com.muyu.goods.domain.Cope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CopeMapper {
|
||||
List<Cope> list();
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.goods.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.goods.domain.Edition;
|
||||
|
||||
/**
|
||||
* 规则引擎版本Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface EditionMapper
|
||||
{
|
||||
/**
|
||||
* 查询规则引擎版本
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 规则引擎版本
|
||||
*/
|
||||
public Edition selectEditionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询规则引擎版本列表
|
||||
*
|
||||
* @return 规则引擎版本集合
|
||||
*/
|
||||
public List<Edition> selectEditionList();
|
||||
|
||||
/**
|
||||
* 新增规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEdition(Edition edition);
|
||||
|
||||
/**
|
||||
* 修改规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEdition(Edition edition);
|
||||
|
||||
/**
|
||||
* 删除规则引擎版本
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEditionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎版本
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEditionByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.goods.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.goods.domain.RuleEngine;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 规则引擎Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public interface RuleEngineMapper
|
||||
{
|
||||
/**
|
||||
* 查询规则引擎
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 规则引擎
|
||||
*/
|
||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId);
|
||||
|
||||
/**
|
||||
* 查询规则引擎列表
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 规则引擎集合
|
||||
*/
|
||||
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 新增规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRuleEngine(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 修改规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRuleEngine(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 删除规则引擎
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineByRuleId(Long ruleId);
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎
|
||||
*
|
||||
* @param ruleIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds);
|
||||
|
||||
String description(@Param("ruleId") Integer ruleId);
|
||||
|
||||
void updateRuleIsActivate(@Param("ruleId") Long ruleId, @Param("ruleIsActivate") String ruleIsActivate);
|
||||
|
||||
void updateRuleStatus(@Param("ruleId") Long ruleId, @Param("ruleStatus") String ruleStatus);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.goods.scope;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据模型上下文
|
||||
* @ClassName DataModelContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DataModelContextHolder {
|
||||
|
||||
private final RecordContextHolder recordContextHolder;
|
||||
|
||||
public static DataModelContextHolder build(RecordContextHolder recordContextHolder){
|
||||
return new DataModelContextHolder(recordContextHolder);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.goods.scope;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据集上下文
|
||||
* @ClassName DataSetContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DataSetContextHolder {
|
||||
|
||||
private final TaskContextHolder taskContextHolder;
|
||||
|
||||
public static DataSetContextHolder build(TaskContextHolder taskContextHolder){
|
||||
return new DataSetContextHolder(taskContextHolder);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.goods.scope;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 记录上下文
|
||||
* @ClassName RecordContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class RecordContextHolder {
|
||||
|
||||
private final DataSetContextHolder dataSetContextHolder;
|
||||
|
||||
public static RecordContextHolder build(DataSetContextHolder dataSetContextHolder){
|
||||
return new RecordContextHolder(dataSetContextHolder);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.goods.scope;
|
||||
|
||||
/**
|
||||
* 任务上下文
|
||||
* @ClassName TaskContextHolder
|
||||
* @Author 森静若林
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TaskContextHolder {
|
||||
|
||||
public static TaskContextHolder build(){
|
||||
return new TaskContextHolder();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import java.util.List;
|
||||
|
||||
public class TestClass {
|
||||
public static String ruleTest(List<String> list) {
|
||||
return "1";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
let packageName = "com.muyu.rule.goods";
|
||||
let customName = "custom";
|
||||
let templateName = "template";
|
||||
let parentClass = "DataModelEngine";
|
||||
let ruleContent = `package ${packageName}.${customName};
|
||||
|
||||
import com.muyu.engine.action.ActionDiscard;
|
||||
import com.muyu.engine.scope.parentClass;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/5/6
|
||||
* @Description: this.form.name-this.form.versionCode
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class this.form.versionCode extends parentClass {
|
||||
@Override
|
||||
public void execution () {
|
||||
Object value = getValue();
|
||||
|
||||
if (value == null || "".equals(value) || "null".equals(value)) {
|
||||
throw new ActionDiscard();
|
||||
}
|
||||
}
|
||||
}`;
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import com.muyu.goods.domain.Cope;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CopeService {
|
||||
List<Cope> list();
|
||||
|
||||
List<Cope> list2();
|
||||
|
||||
List<Cope> selType(String name);
|
||||
|
||||
List<Cope> selObject(Cope cope);
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.goods.domain.Config;
|
||||
import com.muyu.goods.domain.model.TextData;
|
||||
import com.muyu.goods.domain.resp.EngineConfigResp;
|
||||
|
||||
/**
|
||||
* 引擎Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
public interface IConfigService
|
||||
{
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 引擎
|
||||
*/
|
||||
public Config selectConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 引擎集合
|
||||
*/
|
||||
public List<Config> selectConfigList(Config config);
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
List<Config> listConfigEs(Long ruleId);
|
||||
|
||||
/**
|
||||
* 新增引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertConfig(Config config);
|
||||
|
||||
/**
|
||||
* 修改引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateConfig(Config config);
|
||||
|
||||
/**
|
||||
* 批量删除引擎
|
||||
*
|
||||
* @param ids 需要删除的引擎主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除引擎信息
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteConfigById(Long id);
|
||||
|
||||
Object testData(TextData textData);
|
||||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
EngineConfigResp getScopeInfo(Integer id);
|
||||
|
||||
List<Config> queryConfigInfo(Long ruleId);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.goods.domain.Edition;
|
||||
|
||||
/**
|
||||
* 规则引擎版本Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
public interface IEditionService
|
||||
{
|
||||
/**
|
||||
* 查询规则引擎版本
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 规则引擎版本
|
||||
*/
|
||||
public Edition selectEditionById(Long id);
|
||||
|
||||
/**
|
||||
* 获取相应的规则引擎版本
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
List<Edition> selectListRuleId(Long ruleId);
|
||||
/**
|
||||
* 查询规则引擎版本列表
|
||||
*
|
||||
* @return 规则引擎版本集合
|
||||
*/
|
||||
public List<Edition> selectEditionList();
|
||||
|
||||
/**
|
||||
* 新增规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEdition(Edition edition);
|
||||
|
||||
/**
|
||||
* 修改规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEdition(Edition edition);
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎版本
|
||||
*
|
||||
* @param ids 需要删除的规则引擎版本主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEditionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除规则引擎版本信息
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEditionById(Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.goods.domain.RuleEngine;
|
||||
|
||||
/**
|
||||
* 规则引擎Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
public interface IRuleEngineService
|
||||
{
|
||||
/**
|
||||
* 查询规则引擎
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 规则引擎
|
||||
*/
|
||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId);
|
||||
|
||||
/**
|
||||
* 规则详情
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
RuleEngine selectRuleEngineOne(Long ruleId);
|
||||
/**
|
||||
* 查询规则引擎列表
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 规则引擎集合
|
||||
*/
|
||||
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 新增规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRuleEngine(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 修改规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRuleEngine(RuleEngine ruleEngine);
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎
|
||||
*
|
||||
* @param ruleIds 需要删除的规则引擎主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds);
|
||||
|
||||
/**
|
||||
* 删除规则引擎信息
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRuleEngineByRuleId(Long ruleId);
|
||||
|
||||
String description(Integer ruleId);
|
||||
|
||||
void updateRuleIsActivate(RuleEngine ruleEngine);
|
||||
|
||||
void updateRuleStatus(RuleEngine ruleEngine);
|
||||
|
||||
Result spliceNameToCode(String name, String code, Integer level);
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.goods.constant.ConfigCodeConstants;
|
||||
import com.muyu.goods.constant.RuleOperationConstants;
|
||||
import com.muyu.goods.domain.model.TextData;
|
||||
import com.muyu.goods.domain.resp.EngineConfigResp;
|
||||
import com.muyu.goods.dymamicLoad.DynamicLoader;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.goods.mapper.ConfigMapper;
|
||||
import com.muyu.goods.domain.Config;
|
||||
import com.muyu.goods.service.IConfigService;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
|
||||
/**
|
||||
* 引擎Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-04
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceImpl implements IConfigService
|
||||
{
|
||||
@Autowired
|
||||
private ConfigMapper configMapper;
|
||||
|
||||
/**
|
||||
* 查询引擎
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 引擎
|
||||
*/
|
||||
@Override
|
||||
public Config selectConfigById(Long id)
|
||||
{
|
||||
return configMapper.selectConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询引擎列表
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 引擎
|
||||
*/
|
||||
@Override
|
||||
public List<Config> selectConfigList(Config config)
|
||||
{
|
||||
return configMapper.selectConfigList(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* y引擎列表
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Config> listConfigEs(Long ruleId) {
|
||||
return configMapper.listConfigEs(ruleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertConfig(Config config)
|
||||
{
|
||||
return configMapper.insertConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改引擎
|
||||
*
|
||||
* @param config 引擎
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateConfig(Config config)
|
||||
{
|
||||
return configMapper.updateConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除引擎
|
||||
*
|
||||
* @param ids 需要删除的引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConfigByIds(Long[] ids)
|
||||
{
|
||||
return configMapper.deleteConfigByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除引擎信息
|
||||
*
|
||||
* @param id 引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteConfigById(Long id)
|
||||
{
|
||||
return configMapper.deleteConfigById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object testData(TextData textData) {
|
||||
Object invoke = null;
|
||||
try {
|
||||
Config config = configMapper.selectConfigById(textData.getId());
|
||||
String content = config.getRuleContent().replaceAll("\r\n", "");
|
||||
// 对source进行编译生成class文件存放在Map中这里用bytecode接收,
|
||||
Map<String, byte[]> bytecode = DynamicLoader.compile(RuleOperationConstants.CLASS_NAME + RuleOperationConstants.FILE_SUFFIX,content );
|
||||
|
||||
// 加载class文件到虚拟机中,然后通过反射执行
|
||||
@SuppressWarnings("resource")
|
||||
DynamicLoader.MemoryClassLoader classLoader = new DynamicLoader.MemoryClassLoader(
|
||||
bytecode);
|
||||
Class<?> clazz = classLoader.loadClass(RuleOperationConstants.CLASS_NAME);
|
||||
|
||||
// 调用ruleTest方法
|
||||
Method mainMethod = clazz.getDeclaredMethod(RuleOperationConstants.METHOD_NAME, List.class);
|
||||
invoke = mainMethod.invoke(null, textData.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("测试失败");
|
||||
}
|
||||
return invoke;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过引擎作用域获取引擎配置作用域信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public EngineConfigResp getScopeInfo(Integer id) {
|
||||
String scope = ConfigCodeConstants.CONFIG_FILE_NAME_ARRAY[id];
|
||||
String type = ConfigCodeConstants.CONFIG_FILE_TYPE_ARRAY[id];
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH+scope;
|
||||
String code = null;
|
||||
try {
|
||||
code = Files.readString(Paths.get(path));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return EngineConfigResp.builder()
|
||||
.type(type)
|
||||
.name(scope)
|
||||
.code(code)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Config> queryConfigInfo(Long ruleId) {
|
||||
return selectConfigList(null).stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList())
|
||||
;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import com.muyu.goods.domain.Cope;
|
||||
import com.muyu.goods.mapper.CopeMapper;
|
||||
import com.muyu.goods.service.CopeService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
public class CopeServiceImpl implements CopeService {
|
||||
@Autowired
|
||||
private CopeMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<Cope> list() {
|
||||
return mapper.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cope> list2() {
|
||||
return list().stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cope> selType(String name) {
|
||||
Stream<Cope> copeStream = list().stream().filter(c -> c.getType().equals(name));
|
||||
return copeStream.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cope> selObject(Cope cope) {
|
||||
System.out.println(cope);
|
||||
List<Cope> collect = new ArrayList<>();
|
||||
List<Cope> collect1 = new ArrayList<>();
|
||||
if (cope.getType()!=null && cope.getType()!=""){
|
||||
collect = list().stream().filter(c -> c.getType().equals(cope.getType())).collect(Collectors.toList());
|
||||
}else {
|
||||
collect = list();
|
||||
}
|
||||
if (cope.getVal()!=null && cope.getVal()!=""){
|
||||
collect1 = list().stream().filter(c -> c.getVal().contains(cope.getVal())).collect(Collectors.toList());
|
||||
}else {
|
||||
collect1 = list();
|
||||
}
|
||||
List<Cope> copes = new ArrayList<>();
|
||||
for (Cope cope1 : collect) {
|
||||
for (Cope cope2 : collect1) {
|
||||
if (cope1.equals(cope2)){
|
||||
copes.add(cope1);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println(copes);
|
||||
return copes;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.goods.mapper.EditionMapper;
|
||||
import com.muyu.goods.domain.Edition;
|
||||
import com.muyu.goods.service.IEditionService;
|
||||
|
||||
/**
|
||||
* 规则引擎版本Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-06
|
||||
*/
|
||||
@Service
|
||||
public class EditionServiceImpl implements IEditionService
|
||||
{
|
||||
@Autowired
|
||||
private EditionMapper editionMapper;
|
||||
|
||||
/**
|
||||
* 查询规则引擎版本
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 规则引擎版本
|
||||
*/
|
||||
@Override
|
||||
public Edition selectEditionById(Long id)
|
||||
{
|
||||
return editionMapper.selectEditionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相应的规则引擎版本
|
||||
*
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Edition> selectListRuleId(Long ruleId) {
|
||||
return selectEditionList().stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则引擎版本列表
|
||||
*
|
||||
* @return 规则引擎版本
|
||||
*/
|
||||
@Override
|
||||
public List<Edition> selectEditionList()
|
||||
{
|
||||
return editionMapper.selectEditionList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEdition(Edition edition)
|
||||
{
|
||||
return editionMapper.insertEdition(edition);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则引擎版本
|
||||
*
|
||||
* @param edition 规则引擎版本
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEdition(Edition edition)
|
||||
{
|
||||
return editionMapper.updateEdition(edition);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎版本
|
||||
*
|
||||
* @param ids 需要删除的规则引擎版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEditionByIds(Long[] ids)
|
||||
{
|
||||
return editionMapper.deleteEditionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则引擎版本信息
|
||||
*
|
||||
* @param id 规则引擎版本主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEditionById(Long id)
|
||||
{
|
||||
return editionMapper.deleteEditionById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
package com.muyu.goods.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.goods.constant.ConfigCodeConstants;
|
||||
import com.muyu.goods.domain.req.RuleEditionReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.goods.mapper.RuleEngineMapper;
|
||||
import com.muyu.goods.domain.RuleEngine;
|
||||
import com.muyu.goods.service.IRuleEngineService;
|
||||
|
||||
/**
|
||||
* 规则引擎Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-02
|
||||
*/
|
||||
@Service
|
||||
public class RuleEngineServiceImpl implements IRuleEngineService
|
||||
{
|
||||
@Autowired
|
||||
private RuleEngineMapper ruleEngineMapper;
|
||||
|
||||
/**
|
||||
* 查询规则引擎
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 规则引擎
|
||||
*/
|
||||
@Override
|
||||
public RuleEngine selectRuleEngineByRuleId(Long ruleId)
|
||||
{
|
||||
return ruleEngineMapper.selectRuleEngineByRuleId(ruleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则引擎详情
|
||||
* @param ruleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RuleEngine selectRuleEngineOne(Long ruleId) {
|
||||
List<RuleEngine> ruleEngines = selectRuleEngineList(null);
|
||||
List<RuleEngine> collect = ruleEngines.stream().filter(c -> c.getRuleId().equals(ruleId)).collect(Collectors.toList());
|
||||
return collect.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询规则引擎列表
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 规则引擎
|
||||
*/
|
||||
@Override
|
||||
public List<RuleEngine> selectRuleEngineList(RuleEngine ruleEngine)
|
||||
{
|
||||
return ruleEngineMapper.selectRuleEngineList(ruleEngine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRuleEngine(RuleEngine ruleEngine)
|
||||
{
|
||||
return ruleEngineMapper.insertRuleEngine(ruleEngine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规则引擎
|
||||
*
|
||||
* @param ruleEngine 规则引擎
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRuleEngine(RuleEngine ruleEngine)
|
||||
{
|
||||
return ruleEngineMapper.updateRuleEngine(ruleEngine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除规则引擎
|
||||
*
|
||||
* @param ruleIds 需要删除的规则引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineByRuleIds(Long[] ruleIds)
|
||||
{
|
||||
return ruleEngineMapper.deleteRuleEngineByRuleIds(ruleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除规则引擎信息
|
||||
*
|
||||
* @param ruleId 规则引擎主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRuleEngineByRuleId(Long ruleId)
|
||||
{
|
||||
return ruleEngineMapper.deleteRuleEngineByRuleId(ruleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description(Integer ruleId) {
|
||||
return ruleEngineMapper.description(ruleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRuleIsActivate(RuleEngine ruleEngine) {
|
||||
if (ruleEngine.getRuleIsActivate().equals("Y")){
|
||||
ruleEngine.setRuleIsActivate("N");
|
||||
}else{
|
||||
ruleEngine.setRuleIsActivate("Y");
|
||||
}
|
||||
ruleEngineMapper.updateRuleIsActivate(ruleEngine.getRuleId(),ruleEngine.getRuleIsActivate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRuleStatus(RuleEngine ruleEngine) {
|
||||
if (ruleEngine.getRuleStatus().equals("Y")){
|
||||
ruleEngine.setRuleStatus("N");
|
||||
}else{
|
||||
ruleEngine.setRuleStatus("Y");
|
||||
}
|
||||
ruleEngineMapper.updateRuleStatus(ruleEngine.getRuleId(),ruleEngine.getRuleStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result spliceNameToCode(String name, String code, Integer level) {
|
||||
List<String> stringList = List.of(new String[]{"questEngine", "dataSetEngine", "recordsEngine", "fieldEngine"});
|
||||
RuleEditionReq ruleEditionReq = new RuleEditionReq();
|
||||
String val = name + "_" + code;
|
||||
String scope = ConfigCodeConstants.CONFIG_FILE_NAME_CODE[0];
|
||||
String path = ConfigCodeConstants.BASE_FILE_PATH+scope;
|
||||
String cod = null;
|
||||
try {
|
||||
cod = Files.readString(Paths.get(path));
|
||||
String s1 = Pattern.compile("this.form.name").matcher(cod).replaceAll(name);
|
||||
String s2 = Pattern.compile("this.form.versionCode").matcher(s1).replaceAll(code);
|
||||
String s3 = Pattern.compile("parentClass").matcher(s2).replaceAll(stringList.get(level-1));
|
||||
ruleEditionReq.setVal(val);
|
||||
ruleEditionReq.setCode(s3);
|
||||
System.out.println(cod);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Result.success(ruleEditionReq);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class strasd {
|
||||
public static void main(String[] args) {
|
||||
java.lang.String sss = "sabacdeaces";
|
||||
Pattern es = Pattern.compile("es");
|
||||
Matcher matcher = es.matcher(sss);
|
||||
String s = matcher.replaceAll("a1");
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
import com.muyu.goods.domain.Cope;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class stream {
|
||||
public static void main(String[] args) throws IOException {
|
||||
// stream 获取list
|
||||
List<Integer> list = Arrays.asList(1,2,3);
|
||||
System.out.println(list);
|
||||
Stream<Integer> integerStream = list.stream();
|
||||
List<Integer> collect1 = integerStream.collect(Collectors.toList());
|
||||
System.out.println(collect1);
|
||||
// stream 获取数组
|
||||
Integer[] array = {1, 2, 3};
|
||||
Stream<Integer> arrStream = Arrays.stream(array);
|
||||
List<Integer> collect = arrStream.collect(Collectors.toList());
|
||||
System.out.println(collect);
|
||||
//中间处理
|
||||
List<String> stringList = new ArrayList<>();
|
||||
stringList.add("123456789@163.com");
|
||||
stringList.add("2596325@163.com");
|
||||
stringList.add("157492533@qq.com");
|
||||
stringList.add("1547859633@qq.com");
|
||||
stringList.add("1547859633@qq.com");
|
||||
//filter 筛选操作
|
||||
stringList.stream().filter(c -> c.contains("@163")).forEach(System.out::println);
|
||||
//map 映射 map(表::展示字段)
|
||||
System.out.println("筛选操作");
|
||||
stringList.stream().map(String::new).forEach(System.out::println);
|
||||
//flatMap 将每个元素映射为一个Stream对象,并将所有的Stream对象的元素合并为一个steam对象
|
||||
System.out.println("将所有的Stream对象的元素合并为一个steam对象");
|
||||
stringList.stream().flatMap(c -> Arrays.asList(c).stream()).forEach(System.out::println);
|
||||
// distinct 去除重复元素
|
||||
System.out.println("去除重复元素");
|
||||
stringList.stream().distinct().forEach(System.out::println);
|
||||
// sorted 对元素进行排序
|
||||
System.out.println("排序");
|
||||
stringList.stream().sorted((a,b) -> a.length() - b.length()).forEach(System.out::println);
|
||||
// peek 对每个元素进行特定操作
|
||||
System.out.println("对每个元素进行特定操作");
|
||||
stringList.stream().peek(c -> System.out.println(c.length())).map(p -> p.length() % 2 == 0).forEach(System.out::println);
|
||||
// limit 限制stream中的元素数量
|
||||
System.out.println("限制stream中的元素数量");
|
||||
stringList.stream().limit(1).forEach(System.out::println);
|
||||
//结束
|
||||
// forEach 对每个元素进行指定操作,无返回值
|
||||
//toArray 将流中的元素转为数组
|
||||
System.out.println("将流中的元素转为数组");
|
||||
String[] array1 = stringList.stream().toArray(String[]::new);
|
||||
for (String s : array1) {
|
||||
System.out.println(s);
|
||||
}
|
||||
//reduce 将流中的元素按照指定的操作进行归约,返回一个值
|
||||
// identity是初始值,accumulator是一个二次元操作符,通常用于与流中的元素进行聚合操作
|
||||
System.out.println("归约");
|
||||
Optional<Integer> reduce = list.stream().map(Integer::bitCount).reduce(Integer::compare);
|
||||
System.out.println(reduce.get());
|
||||
// collect 将流中的元素收集到一个集合中
|
||||
System.out.println("将流中的元素收集到一个集合中");
|
||||
Set<Integer> collect2 = list.stream().collect(Collectors.toSet());
|
||||
for (Integer i : collect2) {
|
||||
System.out.println(i);
|
||||
}
|
||||
//min 返回最小值 max返回最大值
|
||||
//count 返回流中的个数
|
||||
//allMatch 判断流中的所有元素是否满足给定的条件
|
||||
//noneMatch 判断流中所有的元素是否不满足给定条件
|
||||
//findFirst 返回流的第一个元素
|
||||
System.out.println("返回流的第一个元素");
|
||||
Optional<String> first = stringList.stream().findFirst();
|
||||
System.out.println(first.stream().collect(Collectors.toSet()));
|
||||
//findAny 返回流的任意一个元素
|
||||
|
||||
// peek 修改元素
|
||||
List<Cope> copes = new ArrayList<>();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
Cope cope = new Cope();
|
||||
cope.setCode("code"+i);
|
||||
cope.setType("type"+i);
|
||||
cope.setVal("val"+i);
|
||||
copes.add(cope);
|
||||
}
|
||||
System.out.println(copes);
|
||||
Stream<Cope> peek = copes.stream().peek(c -> {
|
||||
if (c.getVal().contains("1")){
|
||||
c.setVal("123");
|
||||
}
|
||||
});
|
||||
List<Cope> collect3 = peek.collect(Collectors.toList());
|
||||
System.out.println(collect3);
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class yes {
|
||||
public static void main(String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("1424587994@163com");
|
||||
list.add("2949451835@qq.com");
|
||||
list.add("15975632@qq.com");
|
||||
Stream<String> stream = list.stream();
|
||||
stream.filter(c -> !c.contains("@163")).forEach(System.out::println);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9501
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: muyu-goods
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 129.211.23.219:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 129.211.23.219:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.muyu.goods.mapper: DEBUG
|
|
@ -0,0 +1,71 @@
|
|||
<?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.goods.mapper.ConfigMapper">
|
||||
|
||||
<resultMap type="com.muyu.goods.domain.Config" id="ConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="versionCode" column="version_code" />
|
||||
<result property="ruleContent" column="rule_content" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConfigVo">
|
||||
select id, version_code, rule_content, remark, rule_id from config
|
||||
</sql>
|
||||
|
||||
<select id="selectConfigList" parameterType="com.muyu.goods.domain.Config" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
<if test="versionCode != null and versionCode != ''"> and version_code = #{versionCode}</if>
|
||||
<if test="ruleContent != null and ruleContent != ''"> and rule_content = #{ruleContent}</if>
|
||||
<if test="ruleId != null "> and rule_id = #{ruleId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectConfigById" parameterType="Long" resultMap="ConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="listConfigEs" resultType="com.muyu.goods.domain.Config">
|
||||
<include refid="selectConfigVo"/>
|
||||
where rule_id = #{ruleId}
|
||||
</select>
|
||||
|
||||
<insert id="insertConfig" parameterType="com.muyu.goods.domain.Config" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="ruleContent != null">rule_content,</if>
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="ruleContent != null">#{ruleContent},</if>
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateConfig" parameterType="com.muyu.goods.domain.Config">
|
||||
update config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="versionCode != null">version_code = #{versionCode},</if>
|
||||
<if test="ruleContent != null">rule_content = #{ruleContent},</if>
|
||||
<if test="ruleId != null">rule_id = #{ruleId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteConfigById" parameterType="Long">
|
||||
delete from config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteConfigByIds" parameterType="String">
|
||||
delete from config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</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">
|
||||
<mapper namespace="com.muyu.goods.mapper.CopeMapper">
|
||||
|
||||
<select id="list" resultType="com.muyu.goods.domain.Cope">
|
||||
select *
|
||||
from cope
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,73 @@
|
|||
<?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.goods.mapper.EditionMapper">
|
||||
|
||||
<resultMap type="com.muyu.goods.domain.Edition" id="EditionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="versionClass" column="version_class" />
|
||||
<result property="name" column="name" />
|
||||
<result property="versionCode" column="version_code" />
|
||||
<result property="editionStatus" column="edition_status" />
|
||||
<result property="ruleStatus" column="rule_status" />
|
||||
<result property="ruleIsTest" column="rule_is_test" />
|
||||
<result property="editionContent" column="edition_content" />
|
||||
<result property="ruleContent" column="rule_content" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEditionVo">
|
||||
select id, rule_id, version_class, name, version_code, edition_status, rule_status, rule_is_test, edition_content, rule_content from edition
|
||||
</sql>
|
||||
|
||||
<select id="selectEditionList" parameterType="com.muyu.goods.domain.Edition" resultMap="EditionResult">
|
||||
<include refid="selectEditionVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectEditionById" parameterType="Long" resultMap="EditionResult">
|
||||
<include refid="selectEditionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEdition" parameterType="com.muyu.goods.domain.Edition" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into edition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">rule_id,</if>
|
||||
<if test="versionClass != null">version_class,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="versionCode != null">version_code,</if>
|
||||
<if test="editionContent != null">edition_content,</if>
|
||||
<if test="ruleContent != null">rule_content,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleId != null">#{ruleId},</if>
|
||||
<if test="versionClass != null">#{versionClass},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="versionCode != null">#{versionCode},</if>
|
||||
<if test="editionContent != null">#{editionContent},</if>
|
||||
<if test="ruleContent != null">#{ruleContent},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEdition" parameterType="com.muyu.goods.domain.Edition">
|
||||
update edition
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="editionContent != null">edition_content = #{editionContent},</if>
|
||||
<if test="ruleContent != null">rule_content = #{ruleContent},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEditionById" parameterType="Long">
|
||||
delete from edition where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEditionByIds" parameterType="String">
|
||||
delete from edition where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,102 @@
|
|||
<?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.goods.mapper.RuleEngineMapper">
|
||||
|
||||
<resultMap type="com.muyu.goods.domain.RuleEngine" id="RuleEngineResult">
|
||||
<result property="ruleId" column="rule_id" />
|
||||
<result property="ruleName" column="rule_name" />
|
||||
<result property="ruleCode" column="rule_code" />
|
||||
<result property="ruleLevel" column="rule_level" />
|
||||
<result property="ruleType" column="rule_type" />
|
||||
<result property="ruleIsActivate" column="rule_is_activate" />
|
||||
<result property="ruleStatus" column="rule_status" />
|
||||
<result property="description" column="description" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRuleEngineVo">
|
||||
select rule_id, rule_name, rule_code, rule_level, rule_type, rule_is_activate, rule_status, description, remark from rule_engine
|
||||
</sql>
|
||||
|
||||
<select id="selectRuleEngineList" parameterType="com.muyu.goods.domain.RuleEngine" resultMap="RuleEngineResult">
|
||||
<include refid="selectRuleEngineVo"/>
|
||||
<where>
|
||||
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
|
||||
<if test="ruleLevel != null and ruleLevel != ''"> and rule_level = #{ruleLevel}</if>
|
||||
<if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</if>
|
||||
<if test="ruleIsActivate != null and ruleIsActivate != ''"> and rule_is_activate = #{ruleIsActivate}</if>
|
||||
<if test="ruleStatus != null and ruleStatus != ''"> and rule_status = #{ruleStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRuleEngineByRuleId" parameterType="Long" resultMap="RuleEngineResult">
|
||||
<include refid="selectRuleEngineVo"/>
|
||||
where rule_id = #{ruleId}
|
||||
</select>
|
||||
<select id="description" resultType="java.lang.String">
|
||||
select description
|
||||
from rule_engine where rule_id = #{ruleId};
|
||||
</select>
|
||||
|
||||
<insert id="insertRuleEngine" parameterType="com.muyu.goods.domain.RuleEngine" useGeneratedKeys="true" keyProperty="ruleId">
|
||||
insert into rule_engine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleName != null">rule_name,</if>
|
||||
<if test="ruleCode != null">rule_code,</if>
|
||||
<if test="ruleLevel != null">rule_level,</if>
|
||||
<if test="ruleType != null">rule_type,</if>
|
||||
<if test="ruleIsActivate != null">rule_is_activate,</if>
|
||||
<if test="ruleStatus != null">rule_status,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ruleName != null">#{ruleName},</if>
|
||||
<if test="ruleCode != null">#{ruleCode},</if>
|
||||
<if test="ruleLevel != null">#{ruleLevel},</if>
|
||||
<if test="ruleType != null">#{ruleType},</if>
|
||||
<if test="ruleIsActivate != null">#{ruleIsActivate},</if>
|
||||
<if test="ruleStatus != null">#{ruleStatus},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRuleEngine" parameterType="com.muyu.goods.domain.RuleEngine">
|
||||
update rule_engine
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="ruleName != null">rule_name = #{ruleName},</if>
|
||||
<if test="ruleCode != null">rule_code = #{ruleCode},</if>
|
||||
<if test="ruleLevel != null">rule_level = #{ruleLevel},</if>
|
||||
<if test="ruleType != null">rule_type = #{ruleType},</if>
|
||||
<if test="ruleIsActivate != null">rule_is_activate = #{ruleIsActivate},</if>
|
||||
<if test="ruleStatus != null">rule_status = #{ruleStatus},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where rule_id = #{ruleId}
|
||||
</update>
|
||||
<update id="updateRuleIsActivate">
|
||||
update rule_engine
|
||||
set rule_is_activate = #{ruleIsActivate}
|
||||
where rule_id = #{ruleId};
|
||||
</update>
|
||||
<update id="updateRuleStatus">
|
||||
update rule_engine
|
||||
set rule_status = #{ruleStatus}
|
||||
where rule_id = #{ruleId};
|
||||
</update>
|
||||
|
||||
<delete id="deleteRuleEngineByRuleId" parameterType="Long">
|
||||
delete from rule_engine where rule_id = #{ruleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRuleEngineByRuleIds" parameterType="String">
|
||||
delete from rule_engine where rule_id in
|
||||
<foreach item="ruleId" collection="array" open="(" separator="," close=")">
|
||||
#{ruleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
package com.bwie.goods.service.impl;
|
||||
|
||||
import com.bwie.common.domain.One;
|
||||
import com.bwie.goods.mapper.GoodsMapper;
|
||||
import com.bwie.goods.service.GoodsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GoodsServiceImpl implements GoodsService {
|
||||
@Autowired
|
||||
private GoodsMapper mapper;
|
||||
@Override
|
||||
public List<One> list() throws Exception {
|
||||
HashMap<String, Map<String, String>> hm = new HashMap<>();
|
||||
Map<String,String> map = new HashMap<>();
|
||||
List<String> listString = new ArrayList<>();
|
||||
List<String> listMap = new ArrayList<>();
|
||||
PreparedStatement pst = null;
|
||||
Connection connection = null;
|
||||
connection = DriverManager.getConnection("jdbc:mysql://129.211.23.219:3306/g63d15?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8","root","Qq4152637");
|
||||
List<One> list = mapper.list();
|
||||
try {
|
||||
pst = connection.prepareCall("select * from one");
|
||||
ResultSetMetaData rsd = pst.executeQuery().getMetaData();
|
||||
for (int i = 0; i < rsd.getColumnCount(); i++) {
|
||||
System.out.println("java类型"+rsd.getColumnClassName(i+1));
|
||||
System.out.println("数据库类型"+rsd.getColumnTypeName(i+1));
|
||||
System.out.println("字段名称"+rsd.getColumnName(i+1));
|
||||
System.out.println("表名"+rsd.getTableName(i+1));
|
||||
System.out.println("数据库名"+rsd.getCatalogName(i+1));
|
||||
listString.add(rsd.getColumnName(i+1));
|
||||
listMap.add(rsd.getColumnClassName(i+1));
|
||||
// System.out.println(""+rsd.getSchemaName(i+1));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println(listString);
|
||||
System.out.println(listMap);
|
||||
for (One one : list) {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.table.TableShow;
|
||||
import com.muyu.system.domain.table.ToTalNum;
|
||||
import com.muyu.system.domain.vo.DeptVO;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
import com.muyu.system.service.SysDeptService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("accredit")
|
||||
@Log4j2
|
||||
public class AccreditController extends BaseController {
|
||||
@Autowired
|
||||
private AccreditService service;
|
||||
//部门信息
|
||||
@Autowired
|
||||
private SysDeptService deptService;
|
||||
@Autowired
|
||||
private SysUserService userService;
|
||||
|
||||
/**
|
||||
* 获取表名
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/tableNameList/{databaseName}")
|
||||
public Result<List<TableList>> tableNameList(@PathVariable String databaseName){
|
||||
List<TableList> list = service.tableNameList(databaseName);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表名
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/tableNameList2")
|
||||
public Result<List<String>> tableNameList2() throws SQLException {
|
||||
List<String> list = service.tableNameList2();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表结构
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@GetMapping("/listSqlJdbc")
|
||||
public Result listSqlJdbc(@RequestBody Connection connection, String tableName) throws SQLException {
|
||||
return service.listSqlJdbc(connection,tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据连接
|
||||
* @param dataAccess
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selJDBCStream")
|
||||
public Result selJDBCStream(@RequestBody DataAccess dataAccess){
|
||||
Integer id = service.selJDBCStream(dataAccess);
|
||||
if (id>0){
|
||||
return success("连接成功");
|
||||
}else{
|
||||
return error("连接失败");
|
||||
}
|
||||
}
|
||||
// 测试
|
||||
@PostMapping("/selJDBCStream2")
|
||||
public Result selJDBCStream2(@RequestBody DataAccess dataAccess){
|
||||
Integer id = service.selJDBCStream2(dataAccess);
|
||||
if (id>0){
|
||||
return success("连接成功");
|
||||
}else{
|
||||
return error("连接失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表详情
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectTableXml/{tableName}")
|
||||
public Result<List<TableVo>> selectTableXml(@PathVariable String tableName){
|
||||
List<TableVo> list = service.selectTableXml(tableName);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listDeptVo")
|
||||
public Result list () {
|
||||
List<DeptVO> depts = deptService.selectDeptListVo();
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listSelectSysUser")
|
||||
public Result<List<SysUserVo>> listSelectSysUser(){
|
||||
List<SysUserVo> list = userService.listSelectSysUser();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表结构
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listListstructure")
|
||||
public Result<List<ListStructure>> listListstructure(){
|
||||
List<ListStructure> list = service.listListstructure();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称查询表框架
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selNameTableList")
|
||||
public Result<TableList> selNameTableList(@RequestParam String databaseName,@RequestParam String name){
|
||||
TableList tableList = service.selNameTableList(databaseName,name);
|
||||
return success(tableList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称获取表结构
|
||||
* @param databaseName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selNameListStructure")
|
||||
public Result<List<ListStructure>> selNameListStructure(@RequestParam String tableName,@RequestParam String databaseName){
|
||||
List<ListStructure> list = service.selNameListStructure(tableName,databaseName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态/添加字典
|
||||
* @param listStructure
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateListStructure")
|
||||
public Result updateListStructure(@RequestBody ListStructure listStructure){
|
||||
Integer id = service.updateListStructure(listStructure);
|
||||
if (id>0){
|
||||
return success("修改完成");
|
||||
}else{
|
||||
return error("修改有异常请检查");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看父表
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectFrimary")
|
||||
public Result<List<FrimaryVo>> selectFrimary(){
|
||||
List<FrimaryVo> list = service.selectFrimary();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
* @param tableName
|
||||
* @param databaseName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listMiddle")
|
||||
public Result<List<Middle>> listMiddle(@RequestParam String tableName , @RequestParam String databaseName){
|
||||
List<Middle> middleList = service.listMiddle(tableName,databaseName);
|
||||
return success(middleList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门2
|
||||
* @param databaseName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listMiddle2")
|
||||
public Result<List<Middle>> listMiddle2(@RequestParam String databaseName){
|
||||
List<Middle> list = service.listMiddle2(databaseName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户
|
||||
* @param tableName
|
||||
* @param databaseName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listUserMiddle")
|
||||
public Result<List<UserMiddle>> listUserMiddle(@RequestParam String tableName ,@RequestParam String databaseName){
|
||||
List<UserMiddle> list = service.listUserMiddle(tableName, databaseName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户2
|
||||
* @param databaseName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listUserMiddle2")
|
||||
public Result<List<UserMiddle>> listUserMiddle2(@RequestParam String databaseName){
|
||||
List<UserMiddle> list = service.listUserMiddle2(databaseName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门授权
|
||||
* @param mid
|
||||
* @param statusId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateMiddle")
|
||||
public Result updateMiddle(@RequestParam Integer mid,@RequestParam String statusId){
|
||||
Integer id = service.updateMiddle(mid,statusId);
|
||||
if (id>0){
|
||||
return success("修改完成");
|
||||
}else{
|
||||
return error("异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权
|
||||
* @param mid
|
||||
* @param statusId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateUserMiddle")
|
||||
public Result updateUserMiddle(@RequestParam Integer mid,@RequestParam String statusId){
|
||||
Integer id = service.updateUserMiddle(mid,statusId);
|
||||
if (id>0){
|
||||
return success("修改完成");
|
||||
}else{
|
||||
return error("异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectShow")
|
||||
public Result<List<TableShow>> selectShow(@RequestParam String tableName){
|
||||
List<TableShow> list = service.selectShow(tableName);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看整体
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selTotalNum")
|
||||
public Result<ToTalNum> selTotalNum() {
|
||||
ToTalNum toTalNum = service.selTotalNum();
|
||||
return success(toTalNum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.system.domain.Library;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.domain.AssetModel;
|
||||
import com.muyu.system.service.IAssetModelService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 资产详情Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
public class AssetModelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAssetModelService assetModelService;
|
||||
|
||||
/**
|
||||
* 查询资产详情列表
|
||||
*/
|
||||
@RequiresPermissions("system:model:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<AssetModel>> list(AssetModel assetModel)
|
||||
{
|
||||
startPage();
|
||||
List<AssetModel> list = assetModelService.selectAssetModelList(assetModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产详情列表
|
||||
*/
|
||||
@RequiresPermissions("system:model:export")
|
||||
@Log(title = "资产详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AssetModel assetModel)
|
||||
{
|
||||
List<AssetModel> list = assetModelService.selectAssetModelList(assetModel);
|
||||
ExcelUtil<AssetModel> util = new ExcelUtil<AssetModel>(AssetModel.class);
|
||||
util.exportExcel(response, list, "资产详情数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资产详情详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:model:query")
|
||||
@GetMapping(value = "/{annotation}")
|
||||
public Result getInfo(@PathVariable("annotation") String annotation)
|
||||
{
|
||||
return success(assetModelService.selectAssetModelByAnnotation(annotation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产详情
|
||||
*/
|
||||
@RequiresPermissions("system:model:add")
|
||||
@Log(title = "资产详情", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModelService.insertAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产详情
|
||||
*/
|
||||
@RequiresPermissions("system:model:edit")
|
||||
@Log(title = "资产详情", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModelService.updateAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产详情
|
||||
*/
|
||||
@RequiresPermissions("system:model:remove")
|
||||
@Log(title = "资产详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{annotations}")
|
||||
public Result remove(@PathVariable String[] annotations)
|
||||
{
|
||||
return toAjax(assetModelService.deleteAssetModelByAnnotations(annotations));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据库的所有表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("library")
|
||||
public Result<List<Library>> library() {
|
||||
List<Library> list = assetModelService.library();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据详情
|
||||
* @param libraryName
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("selectTable/{libraryName}")
|
||||
public Result<List<TableVo>> selectTable(@PathVariable String libraryName){
|
||||
List<TableVo> list = assetModelService.selectTable(libraryName);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import jdk.jfr.StackTrace;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
import com.muyu.system.service.IDataAccessService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 数据接入Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/access")
|
||||
public class DataAccessController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDataAccessService dataAccessService;
|
||||
|
||||
/**
|
||||
* 查询数据接入列表
|
||||
*/
|
||||
@RequiresPermissions("system:access:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<DataAccess>> list(DataAccess dataAccess)
|
||||
{
|
||||
startPage();
|
||||
List<DataAccess> list = dataAccessService.selectDataAccessList(dataAccess);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据接入列表
|
||||
*/
|
||||
@RequiresPermissions("system:access:export")
|
||||
@Log(title = "数据接入", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DataAccess dataAccess)
|
||||
{
|
||||
List<DataAccess> list = dataAccessService.selectDataAccessList(dataAccess);
|
||||
ExcelUtil<DataAccess> util = new ExcelUtil<DataAccess>(DataAccess.class);
|
||||
util.exportExcel(response, list, "数据接入数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据接入详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:access:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(dataAccessService.selectDataAccessById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据接入
|
||||
*/
|
||||
@RequiresPermissions("system:access:add")
|
||||
@Log(title = "数据接入", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody DataAccess dataAccess) throws SQLException {
|
||||
return toAjax(dataAccessService.insertDataAccess(dataAccess));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据接入
|
||||
*/
|
||||
@RequiresPermissions("system:access:edit")
|
||||
@Log(title = "数据接入", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody DataAccess dataAccess)
|
||||
{
|
||||
return toAjax(dataAccessService.updateDataAccess(dataAccess));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据接入
|
||||
*/
|
||||
@RequiresPermissions("system:access:remove")
|
||||
@Log(title = "数据接入", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(dataAccessService.deleteDataAccessByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/oneDataAccess")
|
||||
public Result<DataAccess> oneDataAccess(){
|
||||
DataAccess dataAccess = dataAccessService.oneDataAccess();
|
||||
return success(dataAccess);
|
||||
}
|
||||
/**
|
||||
* 同步
|
||||
* @param dataAccess
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/synchronization")
|
||||
public Result synchronization(@RequestBody DataAccess dataAccess) throws Exception {
|
||||
Integer id = dataAccessService.synchronization(dataAccess);
|
||||
if (id>0){
|
||||
return success("成功同步");
|
||||
}else{
|
||||
return error("同步失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import com.muyu.system.service.DictService;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.DataTruncation;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dicts")
|
||||
public class DictController extends BaseController {
|
||||
@Autowired
|
||||
private DictService service;
|
||||
|
||||
/**
|
||||
* 查看字典
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("listDictType")
|
||||
public Result<List<DictType>> listDictType(){
|
||||
List<DictType> list = service.listDictType();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看字典的值
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selDictData/{dictType}")
|
||||
public Result<List<DictData>> selDictData(@PathVariable String dictType){
|
||||
List<DictData> list = service.selDictData(dictType);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
* 新增字典
|
||||
*/
|
||||
@PostMapping("indexDictType/{dictType}")
|
||||
public Result indexDictType(@PathVariable String dictType){
|
||||
Integer id = service.indexDictType(dictType);
|
||||
if (id>0){
|
||||
return success("字典添加成功");
|
||||
}else{
|
||||
return error("字典添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("selectDictData")
|
||||
public Result<DictData> selectDictData(@RequestBody DictData dictData){
|
||||
DictData dictData1 = service.selectDictData(dictData);
|
||||
return success(dictData1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典字段添加
|
||||
* @param dictData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("indexDictData")
|
||||
public Result indexDictData(@RequestBody DictData dictData){
|
||||
Integer id = service.indexDictData(dictData);
|
||||
if (id>0){
|
||||
return success("成功");
|
||||
}else{
|
||||
return error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典属性
|
||||
* @param dictData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("deleteDictData")
|
||||
public Result deleteDictData(@RequestBody DictData dictData){
|
||||
Integer id = service.deleteDictData(dictData);
|
||||
if (id>0){
|
||||
return success("成功");
|
||||
}else{
|
||||
return error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("deleteDictType")
|
||||
public Result deleteDictType(@RequestParam String dictType){
|
||||
Integer id;
|
||||
Integer i1 = service.deleteDictType(dictType);
|
||||
Integer i2 = service.deleteDictDatas(dictType);
|
||||
if (i1>0&&i2>0){
|
||||
id = 1;
|
||||
}else{
|
||||
id = 0;
|
||||
}
|
||||
if (id>0){
|
||||
return success("成功");
|
||||
}else{
|
||||
return error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详情字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectDictType")
|
||||
public Result<DictType> selectDictType(@RequestParam String dictType){
|
||||
DictType type = service.selectDictType(dictType);
|
||||
List<DictData> list = service.selDictData(dictType);
|
||||
type.setDictDataList(list);
|
||||
return success(type);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.muyu.system.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;
|
||||
|
||||
/**
|
||||
* 资产详情对象 asset_model
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public class AssetModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/** 注释 */
|
||||
@Excel(name = "注释")
|
||||
private String annotation;
|
||||
|
||||
/** 是否主键Y/N */
|
||||
@Excel(name = "是否主键Y/N")
|
||||
private String key;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
private String type;
|
||||
|
||||
/** 映射类型 */
|
||||
@Excel(name = "映射类型")
|
||||
private String mappingType;
|
||||
|
||||
/** 长度 */
|
||||
@Excel(name = "长度")
|
||||
private Long length;
|
||||
|
||||
/** 小数位 */
|
||||
@Excel(name = "小数位")
|
||||
private Long decimalPlace;
|
||||
|
||||
/** 是否为空 */
|
||||
@Excel(name = "是否为空")
|
||||
private String nullNot;
|
||||
|
||||
/** 默认值 */
|
||||
@Excel(name = "默认值")
|
||||
private String defaultValue;
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setAnnotation(String annotation)
|
||||
{
|
||||
this.annotation = annotation;
|
||||
}
|
||||
|
||||
public String getAnnotation()
|
||||
{
|
||||
return annotation;
|
||||
}
|
||||
public void setKey(String key)
|
||||
{
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getKey()
|
||||
{
|
||||
return key;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setMappingType(String mappingType)
|
||||
{
|
||||
this.mappingType = mappingType;
|
||||
}
|
||||
|
||||
public String getMappingType()
|
||||
{
|
||||
return mappingType;
|
||||
}
|
||||
public void setLength(Long length)
|
||||
{
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public Long getLength()
|
||||
{
|
||||
return length;
|
||||
}
|
||||
public void setDecimalPlace(Long decimalPlace)
|
||||
{
|
||||
this.decimalPlace = decimalPlace;
|
||||
}
|
||||
|
||||
public Long getDecimalPlace()
|
||||
{
|
||||
return decimalPlace;
|
||||
}
|
||||
public void setNullNot(String nullNot)
|
||||
{
|
||||
this.nullNot = nullNot;
|
||||
}
|
||||
|
||||
public String getNullNot()
|
||||
{
|
||||
return nullNot;
|
||||
}
|
||||
public void setDefaultValue(String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValue()
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("annotation", getAnnotation())
|
||||
.append("key", getKey())
|
||||
.append("type", getType())
|
||||
.append("mappingType", getMappingType())
|
||||
.append("length", getLength())
|
||||
.append("decimalPlace", getDecimalPlace())
|
||||
.append("nullNot", getNullNot())
|
||||
.append("defaultValue", getDefaultValue())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
package com.muyu.system.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;
|
||||
|
||||
/**
|
||||
* 数据接入对象 data_access
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-25
|
||||
*/
|
||||
public class DataAccess extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 接入源名称 */
|
||||
@Excel(name = "接入源名称")
|
||||
private String name;
|
||||
|
||||
/** 数据来源系统名称 */
|
||||
@Excel(name = "数据来源系统名称")
|
||||
private String systemName;
|
||||
|
||||
/** 数据接入类型 */
|
||||
@Excel(name = "数据接入类型")
|
||||
private String type;
|
||||
|
||||
/** 主机地址 */
|
||||
@Excel(name = "主机地址")
|
||||
private String host;
|
||||
|
||||
/** 端口号 */
|
||||
@Excel(name = "端口号")
|
||||
private String port;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String username;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String password;
|
||||
|
||||
/** 数据库名称 */
|
||||
@Excel(name = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/** 数据连接参数 */
|
||||
@Excel(name = "数据连接参数")
|
||||
private String connectionParam;
|
||||
|
||||
/** 初始连接数量 */
|
||||
@Excel(name = "初始连接数量")
|
||||
private Long initNum;
|
||||
|
||||
/** 最大连接数量 */
|
||||
@Excel(name = "最大连接数量")
|
||||
private Long maxNum;
|
||||
|
||||
/** 最大等待时间 */
|
||||
@Excel(name = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitSize;
|
||||
|
||||
/** 介绍 */
|
||||
@Excel(name = "介绍")
|
||||
private String intor;
|
||||
|
||||
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;
|
||||
}
|
||||
public void setSystemName(String systemName)
|
||||
{
|
||||
this.systemName = systemName;
|
||||
}
|
||||
|
||||
public String getSystemName()
|
||||
{
|
||||
return systemName;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setHost(String host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getHost()
|
||||
{
|
||||
return host;
|
||||
}
|
||||
public void setPort(String port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
public void setDatabaseName(String databaseName)
|
||||
{
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
|
||||
public String getDatabaseName()
|
||||
{
|
||||
return databaseName;
|
||||
}
|
||||
public void setConnectionParam(String connectionParam)
|
||||
{
|
||||
this.connectionParam = connectionParam;
|
||||
}
|
||||
|
||||
public String getConnectionParam()
|
||||
{
|
||||
return connectionParam;
|
||||
}
|
||||
public void setInitNum(Long initNum)
|
||||
{
|
||||
this.initNum = initNum;
|
||||
}
|
||||
|
||||
public Long getInitNum()
|
||||
{
|
||||
return initNum;
|
||||
}
|
||||
public void setMaxNum(Long maxNum)
|
||||
{
|
||||
this.maxNum = maxNum;
|
||||
}
|
||||
|
||||
public Long getMaxNum()
|
||||
{
|
||||
return maxNum;
|
||||
}
|
||||
public void setMaxWaitTime(Long maxWaitTime)
|
||||
{
|
||||
this.maxWaitTime = maxWaitTime;
|
||||
}
|
||||
|
||||
public Long getMaxWaitTime()
|
||||
{
|
||||
return maxWaitTime;
|
||||
}
|
||||
public void setMaxWaitSize(Long maxWaitSize)
|
||||
{
|
||||
this.maxWaitSize = maxWaitSize;
|
||||
}
|
||||
|
||||
public Long getMaxWaitSize()
|
||||
{
|
||||
return maxWaitSize;
|
||||
}
|
||||
public void setIntor(String intor)
|
||||
{
|
||||
this.intor = intor;
|
||||
}
|
||||
|
||||
public String getIntor()
|
||||
{
|
||||
return intor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("systemName", getSystemName())
|
||||
.append("type", getType())
|
||||
.append("host", getHost())
|
||||
.append("port", getPort())
|
||||
.append("username", getUsername())
|
||||
.append("password", getPassword())
|
||||
.append("databaseName", getDatabaseName())
|
||||
.append("connectionParam", getConnectionParam())
|
||||
.append("initNum", getInitNum())
|
||||
.append("maxNum", getMaxNum())
|
||||
.append("maxWaitTime", getMaxWaitTime())
|
||||
.append("maxWaitSize", getMaxWaitSize())
|
||||
.append("intor", getIntor())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DictData {
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private Long dictCode;
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
private String dictLabel;
|
||||
/**
|
||||
* 字典键值
|
||||
*/
|
||||
private String dictValue;
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
/**
|
||||
* 样式属性(其他样式扩展)
|
||||
*/
|
||||
private String cssClass;
|
||||
/**
|
||||
* 表格回显样式
|
||||
*/
|
||||
private String listClass;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Boolean isEdit=false;
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DictType {
|
||||
/**
|
||||
* 字典主键
|
||||
*/
|
||||
private Long dictId;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String dictName;
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private List<DictData> dictDataList;
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Frimary {
|
||||
/**
|
||||
* 对接主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String systemName;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String type;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
public class Library {
|
||||
private String name;
|
||||
|
||||
public Library(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ListStructure {
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String catalogName;
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* java类型
|
||||
*/
|
||||
private String columnLassName;
|
||||
/**
|
||||
* 映射类型
|
||||
*/
|
||||
private String columnTypeName;
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private Integer precisions;
|
||||
/**
|
||||
* 小数
|
||||
*/
|
||||
private Integer scale;
|
||||
/**
|
||||
* 非空
|
||||
*/
|
||||
private Integer isNull;
|
||||
/**
|
||||
* 默认
|
||||
*/
|
||||
private String schemaName;
|
||||
/**
|
||||
* 注解
|
||||
*/
|
||||
private String columnComments;
|
||||
/**
|
||||
* 是否字典
|
||||
*/
|
||||
private String yesOrNo;
|
||||
/**
|
||||
* 对应字典
|
||||
*/
|
||||
private String dictionary;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Middle {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer mid;
|
||||
/**
|
||||
* 接入主键
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 对应数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 对应表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String statusId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 父部门名称
|
||||
*/
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableList {
|
||||
private Integer id;
|
||||
/**
|
||||
* 接入名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 系统名称
|
||||
*/
|
||||
private String systemName;
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
*备注
|
||||
*/
|
||||
private String asas;
|
||||
/**
|
||||
*数据
|
||||
*/
|
||||
private Integer dataTotal;
|
||||
/**
|
||||
*类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
private TableList tableList;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserMiddle {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer mid;
|
||||
/**
|
||||
* 接入主键
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 对应数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 对应表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 用户名主键
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 用户部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
private String phonenumber;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String statusId;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.system.domain.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableParams {
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String databaseName;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.system.domain.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableShow {
|
||||
/**
|
||||
* 属于
|
||||
*/
|
||||
private String keysed;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private Object val;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.system.domain.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ToTalNum {
|
||||
/**
|
||||
* 接入数量
|
||||
*/
|
||||
private Integer switchOns;
|
||||
/**
|
||||
*资产模型
|
||||
*/
|
||||
private Integer assetsNum;
|
||||
/**
|
||||
* 字段模型
|
||||
*/
|
||||
private Integer fieldsNum;
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeptVO {
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 部门状态:0正常,1停用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 父部门名称
|
||||
*/
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer mid;
|
||||
/**
|
||||
* 接入
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private Integer statusId;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.system.domain.TableList;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FrimaryVo {
|
||||
/**
|
||||
* 对接主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 接入名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 系统名称
|
||||
*/
|
||||
private String systemName;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String databaseName;
|
||||
/**
|
||||
* 表数量
|
||||
*/
|
||||
private Integer tableNameNum;
|
||||
/**
|
||||
* 总数数据
|
||||
*/
|
||||
private Integer dataTotal;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 子表
|
||||
*/
|
||||
private List<TableList> tableLists;
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||
import com.muyu.common.core.annotation.Excel.Type;
|
||||
import com.muyu.common.core.annotation.Excels;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.core.xss.Xss;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUserVo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
@Excel(name = "最后登录IP", type = Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
private List<SysRole> roles;
|
||||
|
||||
/**
|
||||
* 角色组
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
/**
|
||||
* 岗位组
|
||||
*/
|
||||
private Long[] postIds;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
private String DeptName;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableVo {
|
||||
/**
|
||||
* 表目录
|
||||
*/
|
||||
private String tableCatalog;
|
||||
/**
|
||||
*表模式
|
||||
*/
|
||||
private String tableSchema;
|
||||
/**
|
||||
*表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
*列名
|
||||
*/
|
||||
private String columnName;
|
||||
/**
|
||||
*序号位置
|
||||
*/
|
||||
private String ordinalPosition;
|
||||
/**
|
||||
*默认值
|
||||
*/
|
||||
private String columnDefault;
|
||||
/**
|
||||
*是否为空
|
||||
*/
|
||||
private String isNullable;
|
||||
/**
|
||||
*类型
|
||||
*/
|
||||
private String dataType;
|
||||
/**
|
||||
*字符最大长度
|
||||
*/
|
||||
private String characterMaximumLength;
|
||||
/**
|
||||
*字符八位长度
|
||||
*/
|
||||
private String characterOctetLength;
|
||||
/**
|
||||
*数值精度
|
||||
*/
|
||||
private String numericPrecision;
|
||||
/**
|
||||
*数值范围
|
||||
*/
|
||||
private String numericScale;
|
||||
/**
|
||||
*精度
|
||||
*/
|
||||
private String datetimePrecision;
|
||||
/**
|
||||
*字符集名称
|
||||
*/
|
||||
private String characterSetName;
|
||||
/**
|
||||
*排序规则名
|
||||
*/
|
||||
private String collationName;
|
||||
/**
|
||||
*映射类型
|
||||
*/
|
||||
private String columnType;
|
||||
/**
|
||||
*列键
|
||||
*/
|
||||
private String columnKey;
|
||||
/**
|
||||
*额外的
|
||||
*/
|
||||
private String extra;
|
||||
/**
|
||||
*特权
|
||||
*/
|
||||
private String privileges;
|
||||
/**
|
||||
*备注
|
||||
*/
|
||||
private String columnComment;
|
||||
/**
|
||||
*表达式
|
||||
*/
|
||||
private String generationExpressio;
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
package com.muyu.system.domain.vo;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.annotation.Excels;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.system.domain.UserMiddle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserVo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
@Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
private List<SysRole> roles;
|
||||
|
||||
/**
|
||||
* 角色组
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
/**
|
||||
* 岗位组
|
||||
*/
|
||||
private Long[] postIds;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
private String DeptName;
|
||||
|
||||
private List<UserMiddle> userMiddleList;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.table.TableParams;
|
||||
import com.muyu.system.domain.table.TableShow;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AccreditMapper {
|
||||
List<TableList> tableNameList(@Param("databaseName") String databaseName);
|
||||
|
||||
|
||||
String database();
|
||||
|
||||
List<TableVo> selectTableXml(@Param("database") String database, @Param("tableName") String tableName);
|
||||
|
||||
List<String> tableNameList2();
|
||||
|
||||
int getNameSelTable(@Param("s") String s);
|
||||
|
||||
void indexTableName(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
|
||||
void insertListStructure(ListStructure listStructure);
|
||||
|
||||
|
||||
List<ListStructure> listListstructure();
|
||||
|
||||
TableList selNameTableList(@Param("databaseName") String databaseName, @Param("name") String name);
|
||||
|
||||
List<ListStructure> selNameListStructure(@Param("tableName") String tableName, @Param("databaseName") String databaseName);
|
||||
|
||||
int selectOneTableList(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
int selectOneSqlJdbc(@Param("databaseName") String databaseName,@Param("s") String s);
|
||||
|
||||
Integer updateListStructure(ListStructure listStructure);
|
||||
|
||||
List<FrimaryVo> selectFrimary();
|
||||
|
||||
Integer selectOneListStructure(ListStructure listStructure);
|
||||
|
||||
void delListStructure(@Param("databaseName") String databaseName);
|
||||
|
||||
void delOneTableList(@Param("databaseName") String databaseName, @Param("s") String s);
|
||||
|
||||
List<Middle> listMiddle(@Param("tableName") String tableName , @Param("databaseName") String databaseName);
|
||||
|
||||
List<UserMiddle> listUserMiddle(@Param("tableName") String tableName , @Param("databaseName") String databaseName);
|
||||
|
||||
List<UserMiddle> listUserMiddle2(@Param("databaseName") String databaseName);
|
||||
|
||||
Integer updateMiddle(@Param("mid") Integer mid, @Param("statusId") String statusId);
|
||||
|
||||
Integer updateUserMiddle(@Param("mid") Integer mid, @Param("statusId") String statusId);
|
||||
|
||||
|
||||
List<Middle> listMiddle2(@Param("databaseName") String databaseName);
|
||||
|
||||
void indexTableShow(@Param("s") String s, @Param("columnClassName") String columnClassName, @Param("val") String val);
|
||||
|
||||
void deleteTableShow(@Param("name") String name);
|
||||
|
||||
List<TableShow> selectShow(@Param("tableName") String tableName);
|
||||
|
||||
Integer selectOneFrimary();
|
||||
|
||||
Integer selectOneTableListNum();
|
||||
|
||||
List<TableList> selectTableList();
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.AssetModel;
|
||||
import com.muyu.system.domain.Library;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 资产详情Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface AssetModelMapper
|
||||
{
|
||||
/**
|
||||
* 查询资产详情
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 资产详情
|
||||
*/
|
||||
public AssetModel selectAssetModelByAnnotation(String annotation);
|
||||
|
||||
/**
|
||||
* 查询资产详情列表
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 资产详情集合
|
||||
*/
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 新增资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 修改资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 删除资产详情
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByAnnotation(String annotation);
|
||||
|
||||
/**
|
||||
* 批量删除资产详情
|
||||
*
|
||||
* @param annotations 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByAnnotations(String[] annotations);
|
||||
|
||||
List<String> library();
|
||||
|
||||
String database();
|
||||
|
||||
List<TableVo> selectTable(@Param("database") String database, @Param("libraryName") String libraryName);
|
||||
|
||||
List<Library> library2();
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
import net.sf.jsqlparser.schema.Database;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 数据接入Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface DataAccessMapper
|
||||
{
|
||||
/**
|
||||
* 查询数据接入
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 数据接入
|
||||
*/
|
||||
public DataAccess selectDataAccessById(Long id);
|
||||
|
||||
/**
|
||||
* 查询数据接入列表
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 数据接入集合
|
||||
*/
|
||||
public List<DataAccess> selectDataAccessList(DataAccess dataAccess);
|
||||
|
||||
/**
|
||||
* 新增数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataAccess(DataAccess dataAccess);
|
||||
|
||||
/**
|
||||
* 修改数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataAccess(DataAccess dataAccess);
|
||||
|
||||
/**
|
||||
* 删除数据接入
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAccessById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除数据接入
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAccessByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
DataAccess oneDataAccess();
|
||||
|
||||
void insertMiddle(@Param("deptId") Long deptId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
Integer oneSelFrimary(DataAccess dataAccess);
|
||||
|
||||
void insertUserMiddle(@Param("userId") Long userId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
Integer selectOneMiddel(@Param("deptId") Long deptId, @Param("id") Long id,@Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
Integer selectOneUserMiddel(@Param("userId") Long userId, @Param("id") Long id, @Param("databaseName") String databaseName, @Param("tableName") String tableName);
|
||||
|
||||
void deleteFrimary(DataAccess dataAccess);
|
||||
|
||||
void indexFrimary(@Param("dataAccess") DataAccess dataAccess, @Param("num") Integer num, @Param("i") Integer i);
|
||||
|
||||
void inserttableList(@Param("dataAccess") DataAccess dataAccess, @Param("tableName") String tableName, @Param("annotation") String annotation, @Param("anInt") int anInt);
|
||||
|
||||
void deleteTableList(DataAccess dataAccess);
|
||||
|
||||
Integer selectAccessMapper(DataAccess dataAccess);
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictMapper {
|
||||
|
||||
List<DictType> listDictType();
|
||||
|
||||
List<DictData> selDictData(@Param("dictType") String dictType);
|
||||
|
||||
Integer indexDictType(@Param("dictType") String dictType);
|
||||
|
||||
Integer indexDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictData(DictData dictData);
|
||||
|
||||
DictData selectDictData(DictData dictData);
|
||||
|
||||
Integer updDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictType(@Param("dictType") String dictType);
|
||||
|
||||
Integer deleteDictDatas(@Param("dictType") String dictType);
|
||||
|
||||
DictType selectDictType(@Param("dictType") String dictType);
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.system.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.domain.vo.DeptVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -128,4 +129,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
|
||||
List<SysDept> listDeptList();
|
||||
|
||||
List<DeptVO> selectDeptListVo();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.system.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -139,4 +140,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
|
||||
List<SysUserVo> listSelectSysUser();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.table.TableShow;
|
||||
import com.muyu.system.domain.table.ToTalNum;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public interface AccreditService {
|
||||
List<TableList> tableNameList(String databaseName);
|
||||
|
||||
List<TableVo> selectTableXml(String tableName);
|
||||
|
||||
List<String> tableNameList2() throws SQLException;
|
||||
|
||||
Result listSqlJdbc(Connection connection,String tableName) throws SQLException;
|
||||
|
||||
List<ListStructure> listListstructure();
|
||||
|
||||
TableList selNameTableList(String databaseName,String name);
|
||||
|
||||
List<ListStructure> selNameListStructure(String tableName,String databaseName);
|
||||
|
||||
Integer updateListStructure(ListStructure listStructure);
|
||||
|
||||
Integer selJDBCStream(DataAccess dataAccess);
|
||||
|
||||
|
||||
List<FrimaryVo> selectFrimary();
|
||||
|
||||
List<Middle> listMiddle(String tableName ,String databaseName);
|
||||
|
||||
List<Middle> listMiddle2(String databaseName);
|
||||
|
||||
List<UserMiddle> listUserMiddle(String tableName ,String databaseName);
|
||||
|
||||
List<UserMiddle> listUserMiddle2(String databaseName);
|
||||
|
||||
Integer updateMiddle(Integer mid, String statusId);
|
||||
|
||||
Integer updateUserMiddle(Integer mid, String statusId);
|
||||
|
||||
List<TableShow> selectShow( String tableName);
|
||||
|
||||
Integer selJDBCStream2(DataAccess dataAccess);
|
||||
|
||||
ToTalNum selTotalNum();
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DictService {
|
||||
List<DictType> listDictType();
|
||||
|
||||
List<DictData> selDictData(String dictType);
|
||||
|
||||
Integer indexDictType(String dictType);
|
||||
|
||||
Integer indexDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictData(DictData dictData);
|
||||
|
||||
DictData selectDictData(DictData dictData);
|
||||
|
||||
Integer deleteDictType(String dictType);
|
||||
|
||||
Integer deleteDictDatas(String dictType);
|
||||
|
||||
DictType selectDictType(String dictType);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.AssetModel;
|
||||
import com.muyu.system.domain.Library;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
|
||||
/**
|
||||
* 资产详情Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface IAssetModelService
|
||||
{
|
||||
/**
|
||||
* 查询资产详情
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 资产详情
|
||||
*/
|
||||
public AssetModel selectAssetModelByAnnotation(String annotation);
|
||||
|
||||
/**
|
||||
* 查询资产详情列表
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 资产详情集合
|
||||
*/
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 新增资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 修改资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAssetModel(AssetModel assetModel);
|
||||
|
||||
/**
|
||||
* 批量删除资产详情
|
||||
*
|
||||
* @param annotations 需要删除的资产详情主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByAnnotations(String[] annotations);
|
||||
|
||||
/**
|
||||
* 删除资产详情信息
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAssetModelByAnnotation(String annotation);
|
||||
|
||||
List<Library> library();
|
||||
|
||||
List<TableVo> selectTable(String libraryName);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
|
||||
/**
|
||||
* 数据接入Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
public interface IDataAccessService
|
||||
{
|
||||
/**
|
||||
* 查询数据接入
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 数据接入
|
||||
*/
|
||||
public DataAccess selectDataAccessById(Long id);
|
||||
|
||||
/**
|
||||
* 查询数据接入列表
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 数据接入集合
|
||||
*/
|
||||
public List<DataAccess> selectDataAccessList(DataAccess dataAccess);
|
||||
|
||||
/**
|
||||
* 新增数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataAccess(DataAccess dataAccess) throws SQLException;
|
||||
|
||||
/**
|
||||
* 修改数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataAccess(DataAccess dataAccess);
|
||||
|
||||
/**
|
||||
* 批量删除数据接入
|
||||
*
|
||||
* @param ids 需要删除的数据接入主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAccessByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除数据接入信息
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAccessById(Long id);
|
||||
|
||||
DataAccess oneDataAccess();
|
||||
|
||||
Integer synchronization(DataAccess dataAccess) throws Exception;
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.system.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.domain.vo.DeptVO;
|
||||
import com.muyu.system.domain.vo.TreeSelect;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -135,4 +136,12 @@ public interface SysDeptService extends IService<SysDept> {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById (Long deptId);
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
List<DeptVO> selectDeptListVo();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.system.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -225,4 +226,6 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @return 结果
|
||||
*/
|
||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
List<SysUserVo> listSelectSysUser();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,303 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.domain.*;
|
||||
import com.muyu.system.domain.table.TableShow;
|
||||
import com.muyu.system.domain.table.ToTalNum;
|
||||
import com.muyu.system.domain.vo.FrimaryVo;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import com.muyu.system.mapper.AccreditMapper;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class AccreditServiceImpl implements AccreditService {
|
||||
@Autowired
|
||||
private AccreditMapper mapper;
|
||||
@Override
|
||||
public List<TableList> tableNameList(String databaseName) {
|
||||
List<TableList> list = mapper.tableNameList(databaseName);
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableVo> selectTableXml(String tableName) {
|
||||
String database = mapper.database();
|
||||
List<TableVo> list = mapper.selectTableXml(database,tableName);
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tableNameList2() throws SQLException {
|
||||
List<String> list = mapper.tableNameList2();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Result listSqlJdbc(Connection connection,String tableName) throws SQLException {
|
||||
try {
|
||||
PreparedStatement pst = connection.prepareCall("select * from " + tableName);
|
||||
ResultSetMetaData rsd = pst.getMetaData();
|
||||
//获取元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
Map<String,String> columnComments =getColumnComments(metaData,tableName);
|
||||
for (int i = 0; i < rsd.getColumnCount(); i++) {
|
||||
System.out.println("java类型"+rsd.getColumnClassName(i+1));
|
||||
System.out.println("数据库类型"+rsd.getColumnTypeName(i+1));
|
||||
System.out.println("字段名称"+rsd.getColumnName(i+1));
|
||||
System.out.println("表名"+rsd.getTableName(i+1));
|
||||
System.out.println("数据库名"+rsd.getCatalogName(i+1));
|
||||
System.out.println("模式名"+rsd.getSchemaName(i+1));
|
||||
System.out.println("列数"+rsd.getColumnCount());
|
||||
System.out.println("列类型"+rsd.getColumnType(i+1));
|
||||
System.out.println("列标签"+rsd.getColumnLabel(i+1));
|
||||
System.out.println("列显示大小"+rsd.getColumnDisplaySize(i+1));
|
||||
System.out.println("精度"+rsd.getPrecision(i+1));
|
||||
System.out.println("规模"+rsd.getScale(i+1));
|
||||
System.out.println("自增"+rsd.isAutoIncrement(i+1));
|
||||
System.out.println("是否为空"+rsd.isNullable(i+1));
|
||||
System.out.println("区分大小写"+rsd.isCaseSensitive(i+1));
|
||||
System.out.println("是否是货币"+rsd.isCurrency(i+1));
|
||||
System.out.println("可搜索"+rsd.isSearchable(i+1));
|
||||
System.out.println("签署"+rsd.isSigned(i+1));
|
||||
System.out.println("绝对可以写"+rsd.isDefinitelyWritable(i+1));
|
||||
System.out.println("只读"+rsd.isReadOnly(i+1));
|
||||
System.out.println("是可写的"+rsd.isWritable(i+1));
|
||||
System.out.println("注解"+columnComments.get(rsd.getColumnName(i+1)));
|
||||
System.out.println("val"+columnComments.keySet());
|
||||
ListStructure listStructure = new ListStructure();
|
||||
//获取数据库名
|
||||
listStructure.setCatalogName(rsd.getCatalogName(i+1));
|
||||
//获取表名
|
||||
listStructure.setTableName(rsd.getTableName(i+1));
|
||||
//获取java类型
|
||||
listStructure.setColumnLassName(rsd.getColumnClassName(i+1));
|
||||
//获取映射类型
|
||||
listStructure.setColumnTypeName(rsd.getColumnTypeName(i+1));
|
||||
//获取字段名称
|
||||
listStructure.setColumnName(rsd.getColumnName(i+1));
|
||||
//获取长度
|
||||
listStructure.setPrecisions(rsd.getPrecision(i+1));
|
||||
//获取小数
|
||||
listStructure.setScale(rsd.getScale(i+1));
|
||||
//获取非空
|
||||
listStructure.setIsNull(rsd.isNullable(i+1));
|
||||
//获取默认
|
||||
listStructure.setSchemaName(rsd.getSchemaName(i+1));
|
||||
//获取注解
|
||||
listStructure.setColumnComments(columnComments.get(rsd.getColumnName(i+1)));
|
||||
mapper.insertListStructure(listStructure);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Result.success("OK");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ListStructure> listListstructure() {
|
||||
return mapper.listListstructure();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableList selNameTableList(String databaseName,String name) {
|
||||
return mapper.selNameTableList(databaseName,name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ListStructure> selNameListStructure(String tableName,String databaseName) {
|
||||
return mapper.selNameListStructure(tableName,databaseName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer updateListStructure(ListStructure listStructure) {
|
||||
//判断是否加入字典
|
||||
if (!listStructure.getYesOrNo().equals("Y")){
|
||||
listStructure.setDictionary(null);
|
||||
}
|
||||
//修改状态
|
||||
Integer i = mapper.updateListStructure(listStructure);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selJDBCStream(DataAccess dataAccess) {
|
||||
Integer id = 0;
|
||||
|
||||
try {
|
||||
//加载数据库驱动
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
//获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?serverTimezone=UTC",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
System.out.println(driver);
|
||||
System.out.println(connection);
|
||||
id = 1;
|
||||
} catch (Exception e) {
|
||||
id = 0;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selJDBCStream2(DataAccess dataAccess) {
|
||||
Integer id = 0;
|
||||
List<String> stringList = new ArrayList<>();
|
||||
// 连接数据
|
||||
// try {
|
||||
// Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
// Driver driver = (Driver) aClass.newInstance();
|
||||
//// //获取数据库连接
|
||||
// Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":" + dataAccess.getPort() + "/" + dataAccess.getDatabaseName() + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8", dataAccess.getUsername(), dataAccess.getPassword());
|
||||
//// //获取数据库名
|
||||
//// //获取数据库的元数据
|
||||
// DatabaseMetaData metaData = connection.getMetaData();
|
||||
// //获取全部表名
|
||||
// Statement statement = connection.createStatement();
|
||||
// ResultSet rst = statement.executeQuery("select TABLE_NAME from INFORMATION_SCHEMA.Tables where table_schema = '" + dataAccess.getDatabaseName() + "'");
|
||||
// mapper.deleteTableShow(dataAccess.getName());
|
||||
// while (rst.next()) {
|
||||
// stringList.add(rst.getString(1));
|
||||
// }
|
||||
// for (String s : stringList) {
|
||||
// // 执行查询
|
||||
// ResultSet rs = statement.executeQuery("select * from " + s);
|
||||
// PreparedStatement pst = connection.prepareCall("select * from " + s);
|
||||
// ResultSetMetaData rsd = pst.getMetaData();
|
||||
// // 获取查询的结果集
|
||||
// ResultSetMetaData md = rs.getMetaData();
|
||||
// System.out.println(md);
|
||||
// int columnCount = md.getColumnCount();
|
||||
// System.out.println(columnCount);
|
||||
// //获取结果集的元数据
|
||||
// //遍历结果集
|
||||
// while (rs.next()) {
|
||||
// for (int i = 1; i <= columnCount; i++) {
|
||||
// //获取列名
|
||||
// String fields = md.getColumnName(i);
|
||||
// System.out.println(fields);
|
||||
// //获取表名
|
||||
// String tableName = md.getTableName(i);
|
||||
// System.out.println(tableName);
|
||||
// //获取字段值
|
||||
// Object val = rs.getObject(i);
|
||||
// System.out.println(val);
|
||||
// //获取java映射字段类型
|
||||
// String columnClassName = md.getColumnClassName(i);
|
||||
// mapper.indexTableShow(dataAccess.getName() + "." + tableName + "." + fields, columnClassName, val.toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// id =1;
|
||||
// } catch (Exception e) {
|
||||
// id = 0;
|
||||
// }
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<FrimaryVo> selectFrimary() {
|
||||
List<FrimaryVo> list = mapper.selectFrimary();
|
||||
for (FrimaryVo frimaryVo : list) {
|
||||
List<TableList> tableLists = mapper.tableNameList(frimaryVo.getDatabaseName());
|
||||
frimaryVo.setTableLists(tableLists);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Middle> listMiddle(String tableName ,String databaseName) {
|
||||
return mapper.listMiddle(tableName,databaseName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Middle> listMiddle2(String databaseName) {
|
||||
return mapper.listMiddle2(databaseName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserMiddle> listUserMiddle(String tableName ,String databaseName) {
|
||||
return mapper.listUserMiddle(tableName,databaseName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserMiddle> listUserMiddle2(String databaseName) {
|
||||
return mapper.listUserMiddle2(databaseName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateMiddle(Integer mid, String statusId) {
|
||||
return mapper.updateMiddle(mid,statusId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateUserMiddle(Integer mid, String statusId) {
|
||||
return mapper.updateUserMiddle(mid,statusId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableShow> selectShow(String tableName) {
|
||||
List<TableShow> showList = mapper.selectShow(tableName);
|
||||
return showList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToTalNum selTotalNum() {
|
||||
Integer fieldsNum = 0;
|
||||
ToTalNum toTalNum = new ToTalNum();
|
||||
Integer switchOns = mapper.selectOneFrimary();
|
||||
Integer assetsNum = mapper.selectOneTableListNum();
|
||||
List<TableList> tableListList = mapper.selectTableList();
|
||||
for (TableList tableList : tableListList) {
|
||||
fieldsNum += tableList.getDataTotal();
|
||||
}
|
||||
toTalNum.setSwitchOns(switchOns);
|
||||
toTalNum.setAssetsNum(assetsNum);
|
||||
toTalNum.setFieldsNum(fieldsNum);
|
||||
return toTalNum;
|
||||
}
|
||||
|
||||
//获取字段注解
|
||||
private Map<String,String> getColumnComments(DatabaseMetaData metaData,String typeName){
|
||||
Map<String,String> columnComents = new HashMap<>();
|
||||
try (ResultSet colums = metaData.getColumns(null,null,typeName,null)){
|
||||
while (colums.next()){
|
||||
String columsName = colums.getString("COLUMN_NAME");
|
||||
String columsComment = colums.getString("REMARKS");
|
||||
columnComents.put(columsName,columsComment);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return columnComents;
|
||||
}
|
||||
|
||||
//获取字段默认值
|
||||
private Map<String,String> getDefault(DatabaseMetaData metaData,String defaultName){
|
||||
Map<String,String> defaults = new HashMap<>();
|
||||
try (ResultSet colums = metaData.getColumns(null,null,defaultName,null)){
|
||||
while (colums.next()){
|
||||
String columsName = colums.getString("COLUMN_NAME");
|
||||
String defaultComment = colums.getString("COLUMN_DEFAULT");
|
||||
defaults.put(columsName,defaultComment);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.system.domain.Library;
|
||||
import com.muyu.system.domain.vo.TableVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.AssetModelMapper;
|
||||
import com.muyu.system.domain.AssetModel;
|
||||
import com.muyu.system.service.IAssetModelService;
|
||||
|
||||
/**
|
||||
* 资产详情Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@Service
|
||||
public class AssetModelServiceImpl implements IAssetModelService
|
||||
{
|
||||
@Autowired
|
||||
private AssetModelMapper assetModelMapper;
|
||||
|
||||
/**
|
||||
* 查询资产详情
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 资产详情
|
||||
*/
|
||||
@Override
|
||||
public AssetModel selectAssetModelByAnnotation(String annotation)
|
||||
{
|
||||
return assetModelMapper.selectAssetModelByAnnotation(annotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资产详情列表
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 资产详情
|
||||
*/
|
||||
@Override
|
||||
public List<AssetModel> selectAssetModelList(AssetModel assetModel)
|
||||
{
|
||||
return assetModelMapper.selectAssetModelList(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAssetModel(AssetModel assetModel)
|
||||
{
|
||||
return assetModelMapper.insertAssetModel(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资产详情
|
||||
*
|
||||
* @param assetModel 资产详情
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAssetModel(AssetModel assetModel)
|
||||
{
|
||||
return assetModelMapper.updateAssetModel(assetModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资产详情
|
||||
*
|
||||
* @param annotations 需要删除的资产详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetModelByAnnotations(String[] annotations)
|
||||
{
|
||||
return assetModelMapper.deleteAssetModelByAnnotations(annotations);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资产详情信息
|
||||
*
|
||||
* @param annotation 资产详情主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAssetModelByAnnotation(String annotation)
|
||||
{
|
||||
return assetModelMapper.deleteAssetModelByAnnotation(annotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Library> library() {
|
||||
List<Library> list2 = assetModelMapper.library2();
|
||||
System.out.println(list2);
|
||||
return list2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TableVo> selectTable(String libraryName) {
|
||||
String database = assetModelMapper.database();
|
||||
List<TableVo> list = assetModelMapper.selectTable(database,libraryName);
|
||||
System.out.println(list);
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,407 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.system.controller.AccreditController;
|
||||
import com.muyu.system.domain.ListStructure;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import com.muyu.system.mapper.AccreditMapper;
|
||||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.mapper.SysUserMapper;
|
||||
import com.muyu.system.service.AccreditService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.DataAccessMapper;
|
||||
import com.muyu.system.domain.DataAccess;
|
||||
import com.muyu.system.service.IDataAccessService;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* 数据接入Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-21
|
||||
*/
|
||||
@Service
|
||||
public class DataAccessServiceImpl implements IDataAccessService
|
||||
{
|
||||
@Autowired
|
||||
private DataAccessMapper dataAccessMapper;
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Autowired
|
||||
private AccreditService accreditService;
|
||||
@Autowired
|
||||
private AccreditMapper accreditMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据接入
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 数据接入
|
||||
*/
|
||||
@Override
|
||||
public DataAccess selectDataAccessById(Long id)
|
||||
{
|
||||
return dataAccessMapper.selectDataAccessById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据接入列表
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 数据接入
|
||||
*/
|
||||
@Override
|
||||
public List<DataAccess> selectDataAccessList(DataAccess dataAccess)
|
||||
{
|
||||
return dataAccessMapper.selectDataAccessList(dataAccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDataAccess(DataAccess dataAccess) throws SQLException {
|
||||
int i = dataAccessMapper.insertDataAccess(dataAccess);
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据接入
|
||||
*
|
||||
* @param dataAccess 数据接入
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDataAccess(DataAccess dataAccess)
|
||||
{
|
||||
return dataAccessMapper.updateDataAccess(dataAccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除数据接入
|
||||
*
|
||||
* @param ids 需要删除的数据接入主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAccessByIds(Long[] ids)
|
||||
{
|
||||
return dataAccessMapper.deleteDataAccessByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据接入信息
|
||||
*
|
||||
* @param id 数据接入主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAccessById(Long id)
|
||||
{
|
||||
return dataAccessMapper.deleteDataAccessById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一位数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public DataAccess oneDataAccess() {
|
||||
return dataAccessMapper.oneDataAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer synchronization(DataAccess dataAccess) throws Exception {
|
||||
Integer id = 0;
|
||||
List<String> stringList = new ArrayList<>();
|
||||
// 连接数据
|
||||
// Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
// Driver driver = (Driver) aClass.newInstance();
|
||||
//// //获取数据库连接
|
||||
// Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
//// //获取数据库名
|
||||
//// //获取数据库的元数据
|
||||
// DatabaseMetaData metaData = connection.getMetaData();
|
||||
// //获取全部表名
|
||||
// Statement statement = connection.createStatement();
|
||||
//开启多线程池
|
||||
// ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(10, 50, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>(10));
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Integer.valueOf(dataAccess.getInitNum().toString()), Integer.valueOf(dataAccess.getMaxNum().toString()), Integer.valueOf(dataAccess.getMaxWaitTime().toString()), TimeUnit.SECONDS, new LinkedBlockingDeque<>(Integer.valueOf(dataAccess.getMaxWaitSize().toString())));
|
||||
|
||||
//第一个 树形表
|
||||
CompletableFuture<Integer> completable1 = CompletableFuture.supplyAsync(() -> {
|
||||
//先清除同数据库叶子表
|
||||
Integer ini = dataAccessMapper.selectAccessMapper(dataAccess);
|
||||
if (ini>0){
|
||||
dataAccessMapper.deleteTableList(dataAccess);
|
||||
}
|
||||
Integer num = 0;
|
||||
Integer i = 0;
|
||||
try {
|
||||
// 连接数据
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
// //获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
// //获取数据库名
|
||||
// //获取数据库的元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
//获取全部表名
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet rst = statement.executeQuery("select TABLE_NAME, TABLE_COMMENT from INFORMATION_SCHEMA.Tables where table_schema = '" + dataAccess.getDatabaseName() + "'");
|
||||
while (rst.next()) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("select count(*) from " + rst.getString(1));
|
||||
ResultSet rls = preparedStatement.executeQuery();
|
||||
while (rls.next()) {
|
||||
int anInt = rls.getInt(1);
|
||||
// 叶子类增加
|
||||
num += anInt;
|
||||
i++;
|
||||
dataAccessMapper.inserttableList(dataAccess, rst.getString(1), rst.getString(2), anInt);
|
||||
System.out.println("表名" + rst.getString(1) + ",注释:" + rst.getString(2) + "数量:" + anInt);
|
||||
}
|
||||
}
|
||||
// 处理树表
|
||||
dataAccessMapper.deleteFrimary(dataAccess);
|
||||
dataAccessMapper.indexFrimary(dataAccess, num, i);
|
||||
rst.close();
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}, threadPoolExecutor);
|
||||
//第二个 部门中间表 用户中间表
|
||||
CompletableFuture<Integer> completable2 = CompletableFuture.supplyAsync(() -> {
|
||||
//获取全部表名
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
// 连接数据
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
// //获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
// //获取数据库名
|
||||
// //获取数据库的元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
//获取全部表名
|
||||
Statement statement = connection.createStatement();
|
||||
rs = statement.executeQuery("SHOW TABLES");
|
||||
//获取所有部门
|
||||
List<SysDept> list = sysDeptMapper.listDeptList();
|
||||
//获取所有用户
|
||||
List<SysUserVo> sysUserVos = sysUserMapper.listSelectSysUser();
|
||||
while (rs.next()) {
|
||||
/**
|
||||
*部门
|
||||
*/
|
||||
for (SysDept sysDept : list) {
|
||||
Integer sysDeptIds = dataAccessMapper.selectOneMiddel(sysDept.getDeptId(), dataAccess.getId(), dataAccess.getDatabaseName(), rs.getString(1));
|
||||
if (sysDeptIds == 0) {
|
||||
//添加中间件
|
||||
dataAccessMapper.insertMiddle(sysDept.getDeptId(), dataAccess.getId(), dataAccess.getDatabaseName(), rs.getString(1));
|
||||
}
|
||||
}
|
||||
//用户
|
||||
for (SysUserVo sysUserVo : sysUserVos) {
|
||||
Integer sysUserVoIds = dataAccessMapper.selectOneUserMiddel(sysUserVo.getUserId(), dataAccess.getId(), dataAccess.getDatabaseName(), rs.getString(1));
|
||||
if (sysUserVoIds == 0) {
|
||||
//添加中间件
|
||||
dataAccessMapper.insertUserMiddle(sysUserVo.getUserId(), dataAccess.getId(), dataAccess.getDatabaseName(), rs.getString(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//获取字段名
|
||||
return 1;
|
||||
}, threadPoolExecutor);
|
||||
//第三个
|
||||
CompletableFuture<Integer> completable3 = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
// 连接数据
|
||||
Class<?> aClass = Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
Driver driver = (Driver) aClass.newInstance();
|
||||
// //获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":"+ dataAccess.getPort() +"/"+ dataAccess.getDatabaseName() +"?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",dataAccess.getUsername(),dataAccess.getPassword());
|
||||
// //获取数据库名
|
||||
// //获取数据库的元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
//获取全部表名
|
||||
Statement statement = connection.createStatement();
|
||||
//获取全部表名
|
||||
ResultSet rs = statement.executeQuery("SHOW TABLES");
|
||||
|
||||
//获取字段名
|
||||
while (rs.next()) {
|
||||
stringList.add(rs.getString(1));
|
||||
}
|
||||
//处理表名
|
||||
for (String s : stringList) {
|
||||
int i1 = accreditMapper.selectOneSqlJdbc(dataAccess.getDatabaseName(), s);
|
||||
if (i1 > 0) {
|
||||
} else {
|
||||
PreparedStatement pst = connection.prepareCall("select * from " + s);
|
||||
ResultSetMetaData rsd = pst.getMetaData();
|
||||
//获取元数据
|
||||
Map<String, String> columnComments = getColumnComments(metaData, s);
|
||||
//添加数据结构
|
||||
for (int i = 0; i < rsd.getColumnCount(); i++) {
|
||||
System.out.println("java类型" + rsd.getColumnClassName(i + 1));
|
||||
System.out.println("数据库类型" + rsd.getColumnTypeName(i + 1));
|
||||
System.out.println("字段名称" + rsd.getColumnName(i + 1));
|
||||
System.out.println("表名" + rsd.getTableName(i + 1));
|
||||
System.out.println("数据库名" + rsd.getCatalogName(i + 1));
|
||||
System.out.println("模式名" + rsd.getSchemaName(i + 1));
|
||||
System.out.println("列数" + rsd.getColumnCount());
|
||||
System.out.println("列类型" + rsd.getColumnType(i + 1));
|
||||
System.out.println("列标签" + rsd.getColumnLabel(i + 1));
|
||||
System.out.println("列显示大小" + rsd.getColumnDisplaySize(i + 1));
|
||||
System.out.println("精度" + rsd.getPrecision(i + 1));
|
||||
System.out.println("规模" + rsd.getScale(i + 1));
|
||||
System.out.println("自增" + rsd.isAutoIncrement(i + 1));
|
||||
System.out.println("是否为空" + rsd.isNullable(i + 1));
|
||||
System.out.println("区分大小写" + rsd.isCaseSensitive(i + 1));
|
||||
System.out.println("是否是货币" + rsd.isCurrency(i + 1));
|
||||
System.out.println("可搜索" + rsd.isSearchable(i + 1));
|
||||
System.out.println("签署" + rsd.isSigned(i + 1));
|
||||
System.out.println("绝对可以写" + rsd.isDefinitelyWritable(i + 1));
|
||||
System.out.println("只读" + rsd.isReadOnly(i + 1));
|
||||
System.out.println("是可写的" + rsd.isWritable(i + 1));
|
||||
System.out.println("注解" + columnComments.get(rsd.getColumnName(i + 1)));
|
||||
ListStructure listStructure = new ListStructure();
|
||||
//获取数据库名
|
||||
listStructure.setCatalogName(rsd.getCatalogName(i + 1));
|
||||
//获取表名
|
||||
listStructure.setTableName(rsd.getTableName(i + 1));
|
||||
|
||||
//获取映射类型
|
||||
listStructure.setColumnTypeName(rsd.getColumnTypeName(i + 1));
|
||||
//获取字段名称
|
||||
listStructure.setColumnName(rsd.getColumnName(i + 1));
|
||||
//获取长度
|
||||
listStructure.setPrecisions(rsd.getPrecision(i + 1));
|
||||
//获取小数
|
||||
listStructure.setScale(rsd.getScale(i + 1));
|
||||
//获取非空
|
||||
listStructure.setIsNull(rsd.isNullable(i + 1));
|
||||
//获取默认
|
||||
listStructure.setSchemaName(rsd.getSchemaName(i + 1));
|
||||
//获取注解
|
||||
listStructure.setColumnComments(columnComments.get(rsd.getColumnName(i + 1)));
|
||||
accreditMapper.insertListStructure(listStructure);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}, threadPoolExecutor);
|
||||
|
||||
CompletableFuture<Integer> completable4 = CompletableFuture.supplyAsync(() -> {
|
||||
// 连接数据
|
||||
try {
|
||||
// //获取数据库连接
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://" + dataAccess.getHost() + ":" + dataAccess.getPort() + "/" + dataAccess.getDatabaseName() + "?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8", dataAccess.getUsername(), dataAccess.getPassword());
|
||||
// //获取数据库名
|
||||
// //获取数据库的元数据
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
//获取全部表名
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet rst = statement.executeQuery("select TABLE_NAME from INFORMATION_SCHEMA.Tables where table_schema = '" + dataAccess.getDatabaseName() + "'");
|
||||
accreditMapper.deleteTableShow(dataAccess.getName());
|
||||
//所有表名
|
||||
ArrayList<String> strings = new ArrayList<>();
|
||||
while (rst.next()) {
|
||||
strings.add(rst.getString(1));
|
||||
System.out.println(rst.getString(1));
|
||||
}
|
||||
System.out.println(strings);
|
||||
for (String string : strings) {
|
||||
// 执行查询
|
||||
ResultSet rs = statement.executeQuery("select * from " + string);
|
||||
// 获取查询的结果集
|
||||
ResultSetMetaData md = rs.getMetaData();
|
||||
System.out.println(md);
|
||||
int columnCount = md.getColumnCount();
|
||||
System.out.println(columnCount);
|
||||
//获取结果集的元数据
|
||||
//遍历结果集
|
||||
while (rs.next()){
|
||||
//遍历每一列
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
// 获取列名
|
||||
String columnName = md.getColumnName(i);
|
||||
System.out.println(columnName);
|
||||
//获取表名
|
||||
String tableName = md.getTableName(i);
|
||||
System.out.println(tableName);
|
||||
//字段值
|
||||
Object val = rs.getObject(i);
|
||||
System.out.println(val);
|
||||
//字段类型
|
||||
String columnClassName = md.getColumnClassName(i);
|
||||
accreditMapper.indexTableShow(dataAccess.getName()+"."+tableName+"."+columnName,columnClassName,val.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}, threadPoolExecutor);
|
||||
|
||||
System.out.println("completable1:"+completable1.join());
|
||||
System.out.println("completable2:"+completable2.join());
|
||||
System.out.println("completable3:"+completable3.join());
|
||||
System.out.println("completable4:"+completable4.join());
|
||||
if (completable1.join()+completable2.join()+completable3.join()+ completable4.join() == 4){
|
||||
id = 1;
|
||||
}else{
|
||||
id = 0;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
//获取字段注解
|
||||
private Map<String,String> getColumnComments(DatabaseMetaData metaData,String typeName){
|
||||
Map<String,String> columnComents = new HashMap<>();
|
||||
try (ResultSet colums = metaData.getColumns(null,null,typeName,null)){
|
||||
while (colums.next()){
|
||||
String columsName = colums.getString("COLUMN_NAME");
|
||||
String columsComment = colums.getString("REMARKS");
|
||||
columnComents.put(columsName,columsComment);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return columnComents;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.muyu.system.domain.DictData;
|
||||
import com.muyu.system.domain.DictType;
|
||||
import com.muyu.system.mapper.DictMapper;
|
||||
import com.muyu.system.service.DictService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DictServiceImpl implements DictService {
|
||||
@Autowired
|
||||
private DictMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<DictType> listDictType() {
|
||||
List<DictType> list = mapper.listDictType();
|
||||
for (DictType dictType : list) {
|
||||
List<DictData> list1 = selDictData(dictType.getDictType());
|
||||
dictType.setDictDataList(list1);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictData> selDictData(String dictType) {
|
||||
return mapper.selDictData(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer indexDictType(String dictType) {
|
||||
Integer id = mapper.indexDictType(dictType);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer indexDictData(DictData dictData) {
|
||||
if (dictData.getDictCode() == 0){
|
||||
return mapper.indexDictData(dictData);
|
||||
}else {
|
||||
return mapper.updDictData(dictData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictData(DictData dictData) {
|
||||
return mapper.deleteDictData(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData selectDictData(DictData dictData) {
|
||||
return mapper.selectDictData(dictData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictType(String dictType) {
|
||||
return mapper.deleteDictType(dictType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictDatas(String dictType) {
|
||||
return mapper.deleteDictDatas(dictType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictType selectDictType(String dictType) {
|
||||
return mapper.selectDictType(dictType);
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.vo.DeptVO;
|
||||
import com.muyu.system.domain.vo.TreeSelect;
|
||||
import com.muyu.system.mapper.SysDeptMapper;
|
||||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
|
@ -279,6 +280,17 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
public int deleteDeptById (Long deptId) {
|
||||
return deptMapper.deleteDeptById(deptId);
|
||||
}
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
* @param dept 部门信息
|
||||
*
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<DeptVO> selectDeptListVo() {
|
||||
return deptMapper.selectDeptListVo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.muyu.common.system.domain.SysUser;
|
|||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import com.muyu.system.domain.vo.SysUserVo;
|
||||
import com.muyu.system.mapper.*;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
|
@ -500,4 +501,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserVo> listSelectSysUser() {
|
||||
return userMapper.listSelectSysUser();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
<?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.system.mapper.AccreditMapper">
|
||||
<insert id="indexTableName">
|
||||
insert into table_name (database_name,table_name)
|
||||
values (,#{databaseName}#{s});
|
||||
</insert>
|
||||
<insert id="insertListStructure">
|
||||
insert into list_structure (catalog_name,table_name,column_lass_name,column_type_name,column_name,precisions,scale,is_null,schema_name,column_comments)
|
||||
values (#{catalogName},#{tableName},#{columnLassName},#{columnTypeName},#{columnName},#{precisions},#{scale},#{isNull},#{schemaName},#{columnComments});
|
||||
</insert>
|
||||
<insert id="indexTableShow">
|
||||
insert into table_show (keysed,type,val)
|
||||
values (#{s},#{columnClassName},#{val});
|
||||
</insert>
|
||||
<update id="updateListStructure">
|
||||
update list_structure
|
||||
set yes_or_no = #{yesOrNo},
|
||||
dictionary = #{dictionary}
|
||||
where catalog_name = #{catalogName} and
|
||||
table_name = #{tableName} and
|
||||
column_lass_name = #{columnLassName} and
|
||||
column_type_name = #{columnTypeName} and
|
||||
column_name = #{columnName} and
|
||||
precisions = #{precisions} and
|
||||
scale = #{scale} and
|
||||
is_null = #{isNull} and
|
||||
schema_name = #{schemaName} and
|
||||
column_comments = #{columnComments}
|
||||
</update>
|
||||
<update id="updateMiddle">
|
||||
update middle
|
||||
set status_id = #{statusId}
|
||||
where mid = #{mid};
|
||||
</update>
|
||||
<update id="updateUserMiddle">
|
||||
update user_maiddle
|
||||
set status_id = #{statusId}
|
||||
where mid = #{mid};
|
||||
</update>
|
||||
<delete id="delListStructure">
|
||||
delete
|
||||
from list_structure
|
||||
where catalog_name = #{databaseName};
|
||||
</delete>
|
||||
<delete id="delOneTableList">
|
||||
delete
|
||||
from tableList
|
||||
where name = #{s} and database_name = #{databaseName};
|
||||
</delete>
|
||||
<delete id="deleteTableShow">
|
||||
delete
|
||||
from table_show
|
||||
where keysed like concat(#{name},"%");
|
||||
</delete>
|
||||
<select id="selectTableXml" resultType="com.muyu.system.domain.vo.TableVo">
|
||||
SELECT *
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = #{database} and table_name = #{tableName};
|
||||
</select>
|
||||
<select id="database" resultType="java.lang.String">
|
||||
select database()
|
||||
</select>
|
||||
<select id="tableNameList2" resultType="java.lang.String">
|
||||
SHOW TABLES
|
||||
</select>
|
||||
<select id="getNameSelTable" resultType="java.lang.Integer">
|
||||
select count(table_name)
|
||||
from table_name where table_name = #{s};
|
||||
</select>
|
||||
<select id="tableNameList" resultType="com.muyu.system.domain.TableList">
|
||||
select *
|
||||
from tableList where databaseName = #{databaseName}
|
||||
</select>
|
||||
<select id="listListstructure" resultType="com.muyu.system.domain.ListStructure">
|
||||
select *
|
||||
from list_structure
|
||||
</select>
|
||||
<select id="selNameTableList" resultType="com.muyu.system.domain.TableList">
|
||||
select *
|
||||
from tableList where name = #{name} and database_name = #{databaseName}
|
||||
</select>
|
||||
<select id="selNameListStructure" resultType="com.muyu.system.domain.ListStructure">
|
||||
select *
|
||||
from list_structure
|
||||
where table_name = #{tableName} and catalog_name = #{databaseName}
|
||||
</select>
|
||||
<select id="selectOneTableList" resultType="java.lang.Integer">
|
||||
select count(name)
|
||||
from tableList where name = #{s} and database_name = #{databaseName};
|
||||
</select>
|
||||
<select id="selectOneSqlJdbc" resultType="java.lang.Integer">
|
||||
select count(table_name)
|
||||
from list_structure where table_name = #{s};
|
||||
</select>
|
||||
<select id="selectFrimary" resultType="com.muyu.system.domain.vo.FrimaryVo">
|
||||
select *
|
||||
from frimary
|
||||
</select>
|
||||
<select id="selectOneListStructure" resultType="java.lang.Integer">
|
||||
select count(table_name)
|
||||
from list_structure where catalog_name = #{catalogName} and table_name = #{tableName} and column_name = #{columnName};
|
||||
</select>
|
||||
<select id="listMiddle" resultType="com.muyu.system.domain.Middle">
|
||||
select m.mid,m.id,m.database_name,m.table_name,m.status_id,d.*
|
||||
from middle m
|
||||
left join sys_dept d on m.dept_id = d.dept_id
|
||||
where database_name = #{databaseName} and table_name = #{tableName};
|
||||
</select>
|
||||
<select id="listUserMiddle" resultType="com.muyu.system.domain.UserMiddle">
|
||||
select u.*,m.mid,m.id,m.database_name,m.table_name,m.status_id,d.dept_name
|
||||
from user_maiddle m left join sys_user u on m.user_id = u.user_id
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where database_name = #{databaseName} and table_name = #{tableName}
|
||||
</select>
|
||||
<select id="listUserMiddle2" resultType="com.muyu.system.domain.UserMiddle">
|
||||
select u.*,m.mid,m.id,m.database_name,m.table_name,m.status_id,d.dept_name
|
||||
from user_maiddle m left join sys_user u on m.user_id = u.user_id
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where database_name = #{databaseName}
|
||||
</select>
|
||||
<select id="listMiddle2" resultType="com.muyu.system.domain.Middle">
|
||||
select m.mid,m.id,m.database_name,m.table_name,m.status_id,d.*
|
||||
from middle m
|
||||
left join sys_dept d on m.dept_id = d.dept_id
|
||||
where database_name = #{databaseName}
|
||||
</select>
|
||||
<select id="selectShow" resultType="com.muyu.system.domain.table.TableShow">
|
||||
select *
|
||||
from table_show where keysed like concat('%',#{tableName},'%')
|
||||
</select>
|
||||
<select id="selectOneFrimary" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from frimary
|
||||
</select>
|
||||
<select id="selectOneTableListNum" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from tableList;
|
||||
</select>
|
||||
<select id="selectTableList" resultType="com.muyu.system.domain.TableList">
|
||||
select *
|
||||
from tableList
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,109 @@
|
|||
<?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.system.mapper.AssetModelMapper">
|
||||
|
||||
<resultMap type="com.muyu.system.domain.AssetModel" id="AssetModelResult">
|
||||
<result property="name" column="name" />
|
||||
<result property="annotation" column="annotation" />
|
||||
<result property="key" column="key" />
|
||||
<result property="type" column="type" />
|
||||
<result property="mappingType" column="mapping_type" />
|
||||
<result property="length" column="length" />
|
||||
<result property="decimalPlace" column="decimal_place" />
|
||||
<result property="nullNot" column="null_not" />
|
||||
<result property="defaultValue" column="default_value" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAssetModelVo">
|
||||
select name, annotation, key, type, mapping_type, length, decimal_place, null_not, default_value from asset_model
|
||||
</sql>
|
||||
|
||||
<select id="selectAssetModelList" parameterType="com.muyu.system.domain.AssetModel" resultMap="AssetModelResult">
|
||||
<include refid="selectAssetModelVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="annotation != null and annotation != ''"> and annotation = #{annotation}</if>
|
||||
<if test="key != null and key != ''"> and key = #{key}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="mappingType != null and mappingType != ''"> and mapping_type = #{mappingType}</if>
|
||||
<if test="length != null "> and length = #{length}</if>
|
||||
<if test="decimalPlace != null "> and decimal_place = #{decimalPlace}</if>
|
||||
<if test="nullNot != null and nullNot != ''"> and null_not = #{nullNot}</if>
|
||||
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAssetModelByAnnotation" parameterType="String" resultMap="AssetModelResult">
|
||||
<include refid="selectAssetModelVo"/>
|
||||
where annotation = #{annotation}
|
||||
</select>
|
||||
|
||||
<select id="database" resultType="java.lang.String">
|
||||
select database()
|
||||
</select>
|
||||
<select id="selectTable" resultType="com.muyu.system.domain.vo.TableVo">
|
||||
SELECT *
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = #{database} and table_name = #{libraryName};
|
||||
</select>
|
||||
<select id="library" resultType="java.lang.String">
|
||||
SHOW TABLES;
|
||||
</select>
|
||||
<select id="library2" resultType="com.muyu.system.domain.Library">
|
||||
SHOW TABLES
|
||||
</select>
|
||||
|
||||
<insert id="insertAssetModel" parameterType="com.muyu.system.domain.AssetModel">
|
||||
insert into asset_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="annotation != null">annotation,</if>
|
||||
<if test="key != null and key != ''">key,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="mappingType != null and mappingType != ''">mapping_type,</if>
|
||||
<if test="length != null">length,</if>
|
||||
<if test="decimalPlace != null">decimal_place,</if>
|
||||
<if test="nullNot != null and nullNot != ''">null_not,</if>
|
||||
<if test="defaultValue != null">default_value,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="annotation != null">#{annotation},</if>
|
||||
<if test="key != null and key != ''">#{key},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="mappingType != null and mappingType != ''">#{mappingType},</if>
|
||||
<if test="length != null">#{length},</if>
|
||||
<if test="decimalPlace != null">#{decimalPlace},</if>
|
||||
<if test="nullNot != null and nullNot != ''">#{nullNot},</if>
|
||||
<if test="defaultValue != null">#{defaultValue},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAssetModel" parameterType="com.muyu.system.domain.AssetModel">
|
||||
update asset_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="key != null and key != ''">key = #{key},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="mappingType != null and mappingType != ''">mapping_type = #{mappingType},</if>
|
||||
<if test="length != null">length = #{length},</if>
|
||||
<if test="decimalPlace != null">decimal_place = #{decimalPlace},</if>
|
||||
<if test="nullNot != null and nullNot != ''">null_not = #{nullNot},</if>
|
||||
<if test="defaultValue != null">default_value = #{defaultValue},</if>
|
||||
</trim>
|
||||
where annotation = #{annotation}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAssetModelByAnnotation" parameterType="String">
|
||||
delete from asset_model where annotation = #{annotation}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAssetModelByAnnotations" parameterType="String">
|
||||
delete from asset_model where annotation in
|
||||
<foreach item="annotation" collection="array" open="(" separator="," close=")">
|
||||
#{annotation}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,161 @@
|
|||
<?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.system.mapper.DataAccessMapper">
|
||||
|
||||
<resultMap type="com.muyu.system.domain.DataAccess" id="DataAccessResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="systemName" column="systemName" />
|
||||
<result property="type" column="type" />
|
||||
<result property="host" column="host" />
|
||||
<result property="port" column="port" />
|
||||
<result property="username" column="username" />
|
||||
<result property="password" column="password" />
|
||||
<result property="databaseName" column="databaseName" />
|
||||
<result property="connectionParam" column="connectionParam" />
|
||||
<result property="initNum" column="initNum" />
|
||||
<result property="maxNum" column="maxNum" />
|
||||
<result property="maxWaitTime" column="maxWaitTime" />
|
||||
<result property="maxWaitSize" column="maxWaitSize" />
|
||||
<result property="intor" column="intor" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDataAccessVo">
|
||||
select id, name, systemName, type, host, port, username, password, databaseName, connectionParam, initNum, maxNum, maxWaitTime, maxWaitSize, intor from data_access
|
||||
</sql>
|
||||
|
||||
<select id="selectDataAccessList" parameterType="com.muyu.system.domain.DataAccess" resultMap="DataAccessResult">
|
||||
<include refid="selectDataAccessVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="systemName != null and systemName != ''"> and systemName like concat('%', #{systemName}, '%')</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="host != null and host != ''"> and host = #{host}</if>
|
||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
||||
<if test="databaseName != null and databaseName != ''"> and databaseName like concat('%', #{databaseName}, '%')</if>
|
||||
<if test="connectionParam != null and connectionParam != ''"> and connectionParam = #{connectionParam}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDataAccessById" parameterType="Long" resultMap="DataAccessResult">
|
||||
<include refid="selectDataAccessVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="oneDataAccess" resultType="com.muyu.system.domain.DataAccess">
|
||||
<include refid="selectDataAccessVo"/>
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
<select id="oneSelFrimary" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from frimary where id = #{id} and databaseName = #{databaseName}
|
||||
</select>
|
||||
<select id="selectOneMiddel" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from middle where dept_id = #{deptId} and id = #{id} and database_name = #{databaseName} and table_name = #{tableName}
|
||||
</select>
|
||||
<select id="selectOneUserMiddel" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from user_maiddle where id = #{id} and user_id = #{userId} and database_name = #{databaseName} and table_name = #{tableName}
|
||||
</select>
|
||||
<select id="selectAccessMapper" resultType="java.lang.Integer">
|
||||
select count(id)
|
||||
from tableList where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDataAccess" parameterType="com.muyu.system.domain.DataAccess" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into data_access
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="systemName != null and systemName != ''">systemName,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="host != null and host != ''">host,</if>
|
||||
<if test="port != null and port != ''">port,</if>
|
||||
<if test="username != null and username != ''">username,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="databaseName != null and databaseName != ''">databaseName,</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">connectionParam,</if>
|
||||
<if test="initNum != null">initNum,</if>
|
||||
<if test="maxNum != null">maxNum,</if>
|
||||
<if test="maxWaitTime != null">maxWaitTime,</if>
|
||||
<if test="maxWaitSize != null">maxWaitSize,</if>
|
||||
<if test="intor != null">intor,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="systemName != null and systemName != ''">#{systemName},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="host != null and host != ''">#{host},</if>
|
||||
<if test="port != null and port != ''">#{port},</if>
|
||||
<if test="username != null and username != ''">#{username},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="databaseName != null and databaseName != ''">#{databaseName},</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">#{connectionParam},</if>
|
||||
<if test="initNum != null">#{initNum},</if>
|
||||
<if test="maxNum != null">#{maxNum},</if>
|
||||
<if test="maxWaitTime != null">#{maxWaitTime},</if>
|
||||
<if test="maxWaitSize != null">#{maxWaitSize},</if>
|
||||
<if test="intor != null">#{intor},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertMiddle">
|
||||
insert into middle (id,dept_id,database_name,table_name,status_id)
|
||||
values (#{id},#{deptId},#{databaseName},#{tableName},'N');
|
||||
</insert>
|
||||
<insert id="insertUserMiddle">
|
||||
insert into user_maiddle (id,user_id,database_name,table_name,status_id)
|
||||
values (#{id},#{userId},#{databaseName},#{tableName},'N');
|
||||
</insert>
|
||||
<insert id="indexFrimary">
|
||||
insert into frimary (id,name,systemName,databaseName,tableNameNum,dataTotal)
|
||||
values (#{dataAccess.id},#{dataAccess.name},#{dataAccess.systemName},#{dataAccess.databaseName},#{i},#{num});
|
||||
</insert>
|
||||
|
||||
<insert id="inserttableList">
|
||||
insert into tablelist (id,name,systemName,databaseName,tableName,asas,dataTotal)
|
||||
values (#{dataAccess.id},#{dataAccess.name},#{dataAccess.systemName},#{dataAccess.databaseName},#{tableName},#{annotation},#{anInt});
|
||||
</insert>
|
||||
|
||||
<update id="updateDataAccess" parameterType="com.muyu.system.domain.DataAccess">
|
||||
update data_access
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="systemName != null and systemName != ''">systemName = #{systemName},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="host != null and host != ''">host = #{host},</if>
|
||||
<if test="port != null and port != ''">port = #{port},</if>
|
||||
<if test="username != null and username != ''">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="databaseName != null and databaseName != ''">databaseName = #{databaseName},</if>
|
||||
<if test="connectionParam != null and connectionParam != ''">connectionParam = #{connectionParam},</if>
|
||||
<if test="initNum != null">initNum = #{initNum},</if>
|
||||
<if test="maxNum != null">maxNum = #{maxNum},</if>
|
||||
<if test="maxWaitTime != null">maxWaitTime = #{maxWaitTime},</if>
|
||||
<if test="maxWaitSize != null">maxWaitSize = #{maxWaitSize},</if>
|
||||
<if test="intor != null">intor = #{intor},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDataAccessById" parameterType="Long">
|
||||
delete from data_access where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDataAccessByIds" parameterType="String">
|
||||
delete from data_access where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteFrimary">
|
||||
delete
|
||||
from frimary
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteTableList">
|
||||
delete
|
||||
from tablelist
|
||||
where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,51 @@
|
|||
<?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.system.mapper.DictMapper">
|
||||
<insert id="indexDictType">
|
||||
insert into dict_type (dict_type)
|
||||
values (#{dictType});
|
||||
</insert>
|
||||
<insert id="indexDictData">
|
||||
insert into dict_data (dict_label,dict_value,dict_type)
|
||||
values (#{dictLabel},#{dictValue},#{dictType});
|
||||
</insert>
|
||||
<update id="updDictData">
|
||||
update dict_data
|
||||
set dict_label = #{dictLabel},dict_value=#{dictValue}
|
||||
where dict_type = #{dictType} and dict_code = #{dictCode};
|
||||
</update>
|
||||
<delete id="deleteDictData">
|
||||
delete
|
||||
from dict_data
|
||||
where dict_label = #{dictLabel} and dict_value = #{dictValue} and dict_type=#{dictType};
|
||||
</delete>
|
||||
<delete id="deleteDictType">
|
||||
delete
|
||||
from dict_type
|
||||
where dict_type = #{dictType};
|
||||
</delete>
|
||||
<delete id="deleteDictDatas">
|
||||
delete
|
||||
from dict_data
|
||||
where dict_type = #{dictType};
|
||||
</delete>
|
||||
|
||||
<select id="listDictType" resultType="com.muyu.system.domain.DictType">
|
||||
select *
|
||||
from dict_type
|
||||
</select>
|
||||
<select id="selDictData" resultType="com.muyu.system.domain.DictData">
|
||||
select *
|
||||
from dict_data where dict_type = #{dictType}
|
||||
</select>
|
||||
<select id="selectDictData" resultType="com.muyu.system.domain.DictData">
|
||||
select *
|
||||
from dict_data where dict_label=#{dictLabel} and dict_value=#{dictValue} and dict_type=#{dictType}
|
||||
</select>
|
||||
<select id="selectDictType" resultType="com.muyu.system.domain.DictType">
|
||||
select *
|
||||
from dict_type where dict_type = #{dictType}
|
||||
</select>
|
||||
</mapper>
|
|
@ -38,6 +38,25 @@
|
|||
from sys_dept d
|
||||
</sql>
|
||||
|
||||
<sql id="selectDeptVo2">
|
||||
select d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.phone,
|
||||
d.email,
|
||||
d.status,
|
||||
d.del_flag,
|
||||
d.create_by,
|
||||
d.create_time,
|
||||
m.mid,
|
||||
m.id,
|
||||
m.status_id
|
||||
from sys_dept d left join middle m on d.dept_id = m.dept_id
|
||||
</sql>
|
||||
|
||||
<select id="selectDeptList" parameterType="com.muyu.common.system.domain.SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where d.del_flag = '0'
|
||||
|
@ -108,6 +127,12 @@
|
|||
<include refid="selectDeptVo"/>
|
||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||
</select>
|
||||
<select id="listDeptList" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
</select>
|
||||
<select id="selectDeptListVo" resultType="com.muyu.system.domain.vo.DeptVO">
|
||||
<include refid="selectDeptVo2"/>
|
||||
</select>
|
||||
|
||||
<insert id="insertDept" parameterType="com.muyu.common.system.domain.SysDept">
|
||||
insert into sys_dept(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue