新增功能后 整体进度90%
This commit is contained in:
parent
12d2403f4e
commit
cd70412e5d
|
@ -12,7 +12,7 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
public class Base {
|
public class Base {
|
||||||
@TableId
|
@TableId
|
||||||
@ApiModelProperty(value = "主键")
|
@ApiModelProperty(value = "主键(32)",required = true)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
@ -6,7 +6,7 @@ import lombok.ToString;
|
||||||
public enum CodeMsg {
|
public enum CodeMsg {
|
||||||
SUCCESS(200, "成功"),
|
SUCCESS(200, "成功"),
|
||||||
FAILURE(500, "失败"),
|
FAILURE(500, "失败"),
|
||||||
AUTH_FAILURE(403, "认证失败");
|
AUTH_FAILURE(401, "认证失败");
|
||||||
|
|
||||||
private Integer code;
|
private Integer code;
|
||||||
private String message;
|
private String message;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
--generated always 默认从0开始
|
--generated always 默认从0开始
|
||||||
|
--字典_指标类型
|
||||||
drop table if exists indicator_dic;
|
drop table if exists indicator_dic;
|
||||||
create table indicator_dic (
|
create table indicator_dic (
|
||||||
id int4 not null generated always as identity( minvalue 0 no maxvalue start 0 no cycle),
|
id int4 not null generated always as identity( minvalue 0 no maxvalue start 0 no cycle),
|
||||||
indicator_type varchar(255) not null,
|
indicator_type varchar(128) not null,
|
||||||
parent_id int4,
|
parent_id int4,
|
||||||
create_time timestamp not null,
|
create_time timestamp not null,
|
||||||
update_time timestamp
|
update_time timestamp
|
||||||
|
@ -15,3 +16,72 @@ comment on column indicator_dic.update_time is '修改时间';
|
||||||
insert into indicator_dic(indicator_type,create_time) values ('基础指标',current_timestamp);
|
insert into indicator_dic(indicator_type,create_time) values ('基础指标',current_timestamp);
|
||||||
insert into indicator_dic(indicator_type,create_time) values ('逻辑指标',current_timestamp);
|
insert into indicator_dic(indicator_type,create_time) values ('逻辑指标',current_timestamp);
|
||||||
insert into indicator_dic(indicator_type,create_time) values ('统计指标',current_timestamp);
|
insert into indicator_dic(indicator_type,create_time) values ('统计指标',current_timestamp);
|
||||||
|
--字典_应用类型
|
||||||
|
drop table if exists app_dic;
|
||||||
|
create table app_dic (
|
||||||
|
id int4 not null generated always as identity( minvalue 0 no maxvalue start 0 no cycle),
|
||||||
|
app_type varchar(128) not null,
|
||||||
|
parent_id int4,
|
||||||
|
create_time timestamp not null,
|
||||||
|
update_time timestamp
|
||||||
|
);
|
||||||
|
comment on column app_dic.id is '主键';
|
||||||
|
comment on column app_dic.app_type is '类型';
|
||||||
|
comment on column app_dic.parent_id is '父级ID';
|
||||||
|
comment on column app_dic.create_time is '创建时间';
|
||||||
|
comment on column app_dic.update_time is '修改时间';
|
||||||
|
insert into app_dic(app_type,create_time) values ('态势感知',current_timestamp);
|
||||||
|
insert into app_dic(app_type,create_time) values ('智能战果分析',current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('风险人',0,current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('风险事',0,current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('风险物',0,current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('人',1,current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('事',1,current_timestamp);
|
||||||
|
insert into app_dic(app_type,parent_id,create_time) values ('物',1,current_timestamp);
|
||||||
|
--表_指标
|
||||||
|
drop table if exists p_indicator;
|
||||||
|
create table p_indicator (
|
||||||
|
id int4 not null generated always as identity( minvalue 0 no maxvalue start 0 no cycle),
|
||||||
|
indicator_name varchar(128) not null,
|
||||||
|
indicator_en_name varchar(128) not null,
|
||||||
|
indicator_dic_id int4,
|
||||||
|
scene_id int4,
|
||||||
|
app_dic_p_id int4,
|
||||||
|
app_dic_c_id int4,
|
||||||
|
indicator_code varchar(128),
|
||||||
|
create_time timestamp not null,
|
||||||
|
update_time timestamp
|
||||||
|
);
|
||||||
|
comment on column p_indicator.id is '指标编号';
|
||||||
|
comment on column p_indicator.indicator_name is '指标名称';
|
||||||
|
comment on column p_indicator.indicator_en_name is '指标英文名称';
|
||||||
|
comment on column p_indicator.indicator_dic_id is '指标类型';
|
||||||
|
comment on column p_indicator.scene_id is '关联技能';
|
||||||
|
comment on column p_indicator.app_dic_p_id is '关联应用模块';
|
||||||
|
comment on column p_indicator.app_dic_c_id is '关联功能';
|
||||||
|
comment on column p_indicator.indicator_code is '关联功能';
|
||||||
|
comment on column p_indicator.create_time is '创建时间';
|
||||||
|
comment on column p_indicator.update_time is '修改时间';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--触发器,根据增删改动态增加删除字段
|
||||||
|
create or replace function trigger_function() returns trigger as $$
|
||||||
|
begin
|
||||||
|
-- 判断当前操作类型为 insert、update 还是 delete
|
||||||
|
if (tg_op = 'insert' or tg_op = 'delete') then
|
||||||
|
-- 如果是 insert 或 delete 操作,则删除指定字段
|
||||||
|
execute format('alter table %i drop column column_name', tg_table_name);
|
||||||
|
elsif (tg_op = 'update') then
|
||||||
|
-- 如果是 update 操作,则添加新字段
|
||||||
|
execute format('alter table %i add column new_column_name data_type', tg_table_name);
|
||||||
|
end if;
|
||||||
|
|
||||||
|
return new;
|
||||||
|
end;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
-- 创建 after insert/update/delete 触发器
|
||||||
|
create trigger trigger_name
|
||||||
|
after insert or update or delete on table_name
|
||||||
|
for each row
|
||||||
|
execute procedure trigger_function();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.zbsz.config;
|
package com.zbsz.config;
|
||||||
|
|
||||||
import com.zbsz.filter.TokenInterceptor;
|
import com.zbsz.filter.TokenInterceptor;
|
||||||
import com.zbsz.service.UserService;
|
import com.zbsz.repository.UserService;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
@ -33,7 +33,7 @@ public class Swagger2Config implements WebMvcConfigurer {
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
.apiInfo(new ApiInfoBuilder()
|
.apiInfo(new ApiInfoBuilder()
|
||||||
.title("指标设置 API")
|
.title("指标设置 API")
|
||||||
.description("指标设置 API 说明")
|
.description("指标设置 API 说明,Token认证添加Header参数设置步骤: 文档管理 > 个性化设置 > 开启请求参数缓存,开启动态请求参数 | 设置完需要刷新页面")
|
||||||
.version("V-1.0")
|
.version("V-1.0")
|
||||||
.build())
|
.build())
|
||||||
.select()
|
.select()
|
||||||
|
|
|
@ -4,13 +4,17 @@ import com.common.entity.Scene;
|
||||||
import com.common.entity.dic.IndicatorDic;
|
import com.common.entity.dic.IndicatorDic;
|
||||||
import com.common.entity.dic.AppDic;
|
import com.common.entity.dic.AppDic;
|
||||||
import com.common.info.CodeMsg;
|
import com.common.info.CodeMsg;
|
||||||
|
import com.zbsz.entity.Indicator;
|
||||||
import com.zbsz.info.Result;
|
import com.zbsz.info.Result;
|
||||||
import com.zbsz.service.IndicatorDicService;
|
import com.zbsz.repository.IndicatorDicService;
|
||||||
import com.zbsz.service.AppDicService;
|
import com.zbsz.repository.AppDicService;
|
||||||
import com.zbsz.service.SceneService;
|
import com.zbsz.repository.IndicatorService;
|
||||||
|
import com.zbsz.repository.SceneService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -27,6 +31,41 @@ public class IndicatorController {
|
||||||
private IndicatorDicService indicatorDicService;
|
private IndicatorDicService indicatorDicService;
|
||||||
@Resource
|
@Resource
|
||||||
private AppDicService appDicService;
|
private AppDicService appDicService;
|
||||||
|
@Resource
|
||||||
|
private IndicatorService indicatorService;
|
||||||
|
|
||||||
|
private void setSuccessInfo(Result result){
|
||||||
|
result.setCode(CodeMsg.SUCCESS.getCode());
|
||||||
|
result.setMsg(CodeMsg.SUCCESS.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSuccessFlagInfo(Result result, boolean flag){
|
||||||
|
setSuccessInfo(result);
|
||||||
|
result.setData(flag);
|
||||||
|
result.setTotal(0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSuccessListInfo(Result result, List list){
|
||||||
|
setSuccessInfo(result);
|
||||||
|
result.setData(list);
|
||||||
|
if(list!=null){
|
||||||
|
result.setTotal((long) list.size());
|
||||||
|
}else {
|
||||||
|
result.setTotal(0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFailureInfo(Result result){
|
||||||
|
result.setCode(CodeMsg.FAILURE.getCode());
|
||||||
|
result.setMsg(CodeMsg.FAILURE.getMessage());
|
||||||
|
result.setTotal(0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setFailureEInfo(Result result, Exception e){
|
||||||
|
result.setCode(CodeMsg.FAILURE.getCode());
|
||||||
|
result.setMsg(e.getMessage());
|
||||||
|
result.setTotal(0L);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联场景查询
|
* 关联场景查询
|
||||||
|
@ -34,23 +73,15 @@ public class IndicatorController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取关联场景",notes = "获取关联场景列表信息")
|
@ApiOperation(value = "获取关联场景",notes = "获取关联场景列表信息")
|
||||||
@GetMapping("get_scenes")
|
@GetMapping("get_scenes")
|
||||||
public Result getScenes(@RequestHeader(value = "userId",required = true)String token) {
|
public Result getScenes() {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
try {
|
try {
|
||||||
List<Scene> list = sceneService.list();
|
List<Scene> list = sceneService.list();
|
||||||
result.setCode(CodeMsg.SUCCESS.getCode());
|
setSuccessListInfo(result,list);
|
||||||
result.setMsg(CodeMsg.SUCCESS.getMessage());
|
log.info("-------- 获取关联场景成功 ");
|
||||||
result.setData(list);
|
|
||||||
if(list!=null){
|
|
||||||
result.setTotal((long) list.size());
|
|
||||||
}else {
|
|
||||||
result.setTotal(0L);
|
|
||||||
}
|
|
||||||
log.error("-------- 获取关联场景成功 ");
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("-------- 获取关联场景异常 : "+e.getMessage(),e);
|
log.error("-------- 获取关联场景异常 : "+e.getMessage(),e);
|
||||||
result.setCode(CodeMsg.FAILURE.getCode());
|
setFailureEInfo(result,e);
|
||||||
result.setMsg(e.getMessage());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -61,23 +92,15 @@ public class IndicatorController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取指标类型",notes = "获取指标类型列表信息")
|
@ApiOperation(value = "获取指标类型",notes = "获取指标类型列表信息")
|
||||||
@GetMapping("get_indicator_dic")
|
@GetMapping("get_indicator_dic")
|
||||||
public Result getIndicatorDic(@RequestHeader(value = "userId",required = true)String token) {
|
public Result getIndicatorDic() {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
try {
|
try {
|
||||||
List<IndicatorDic> list = indicatorDicService.list();
|
List<IndicatorDic> list = indicatorDicService.list();
|
||||||
result.setCode(CodeMsg.SUCCESS.getCode());
|
setSuccessListInfo(result,list);
|
||||||
result.setMsg(CodeMsg.SUCCESS.getMessage());
|
log.info("-------- 获取指标类型成功 ");
|
||||||
result.setData(list);
|
|
||||||
if(list!=null){
|
|
||||||
result.setTotal((long) list.size());
|
|
||||||
}else {
|
|
||||||
result.setTotal(0L);
|
|
||||||
}
|
|
||||||
log.error("-------- 获取指标类型成功 ");
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("-------- 获取指标类型异常 : "+e.getMessage(),e);
|
log.error("-------- 获取指标类型异常 : "+e.getMessage(),e);
|
||||||
result.setCode(CodeMsg.FAILURE.getCode());
|
setFailureEInfo(result,e);
|
||||||
result.setMsg(e.getMessage());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -87,28 +110,122 @@ public class IndicatorController {
|
||||||
* @return Result
|
* @return Result
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取关联应用模块类型",notes = "获取关联应用模块类型列表信息")
|
@ApiOperation(value = "获取关联应用模块类型",notes = "获取关联应用模块类型列表信息")
|
||||||
@GetMapping("get_app_dic")
|
@GetMapping("get_app_p_dic")
|
||||||
public Result getModuleDic(@RequestHeader(value = "userId",required = true)String token) {
|
public Result getAppPDic() {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
try {
|
try {
|
||||||
List<AppDic> list = appDicService.list();
|
List<AppDic> list = appDicService.lambdaQuery().isNull(AppDic::getParentId).list();
|
||||||
result.setCode(CodeMsg.SUCCESS.getCode());
|
setSuccessListInfo(result,list);
|
||||||
result.setMsg(CodeMsg.SUCCESS.getMessage());
|
log.info("-------- 获取关联应用模块成功 ");
|
||||||
result.setData(list);
|
|
||||||
if(list!=null){
|
|
||||||
result.setTotal((long) list.size());
|
|
||||||
}else {
|
|
||||||
result.setTotal(0L);
|
|
||||||
}
|
|
||||||
log.error("-------- 获取关联应用模块成功 ");
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("-------- 获取关联应用模块异常 : "+e.getMessage(),e);
|
log.error("-------- 获取关联应用模块异常 : "+e.getMessage(),e);
|
||||||
result.setCode(CodeMsg.FAILURE.getCode());
|
setFailureEInfo(result,e);
|
||||||
result.setMsg(e.getMessage());
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联功能类型查询
|
||||||
|
* @return Result
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取联功能类型",notes = "获取联功能类型列表信息")
|
||||||
|
@ApiImplicitParam(name = "p_id",value = "联应用模块类型 id,Content-Type:application/x-www-form-urlencoded",required = true)
|
||||||
|
@GetMapping("get_app_c_dic")
|
||||||
|
public Result getAppCDic(Long p_id) {
|
||||||
|
Result result = new Result();
|
||||||
|
try {
|
||||||
|
List<AppDic> list = appDicService.lambdaQuery().eq(AppDic::getParentId,p_id).list();
|
||||||
|
setSuccessListInfo(result,list);
|
||||||
|
log.info("-------- 获取联功能成功 ");
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("-------- 获取联功能异常 : "+e.getMessage(),e);
|
||||||
|
setFailureEInfo(result,e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean validEnName(Indicator indicator){
|
||||||
|
List<Indicator> list=indicatorService.lambdaQuery()
|
||||||
|
.eq(Indicator::getSceneId,indicator.getSceneId())
|
||||||
|
.eq(Indicator::getIndicatorDicId,indicator.getIndicatorDicId())
|
||||||
|
.eq(Indicator::getAppDicPId,indicator.getAppDicPId())
|
||||||
|
.eq(Indicator::getAppDicCId,indicator.getAppDicCId())
|
||||||
|
.eq(Indicator::getIndicatorEnName,indicator.getIndicatorEnName())
|
||||||
|
.list();
|
||||||
|
if(list!=null&&list.size()>0){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验指标英文名称
|
||||||
|
* @return Result
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "校验指标英文名称",notes = "true:表示重名,false:表示可以保存")
|
||||||
|
@GetMapping("valid_indicator_en_name")
|
||||||
|
public Result validIndicatorEnName(@RequestBody Indicator indicator) {
|
||||||
|
Result result = new Result();
|
||||||
|
try {
|
||||||
|
boolean flag = validEnName(indicator);
|
||||||
|
setSuccessFlagInfo(result,flag);
|
||||||
|
if(flag){
|
||||||
|
log.error("-------- 指标英文名称重名!!! name :"+indicator.getIndicatorEnName());
|
||||||
|
}else {
|
||||||
|
log.info("-------- 指标英文名称可用,name :"+indicator.getIndicatorEnName());
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("-------- 获取联功能异常 : "+e.getMessage(),e);
|
||||||
|
setFailureEInfo(result,e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存指标
|
||||||
|
* @return Result
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "保存指标",notes = "保存指标")
|
||||||
|
@PostMapping("save_update_indicator")
|
||||||
|
@Transactional
|
||||||
|
public Result saveUpdateIndicator(@RequestBody Indicator indicator) {
|
||||||
|
Result result = new Result();
|
||||||
|
try {
|
||||||
|
//1、校验指标名称会不会重复
|
||||||
|
boolean enNameFlag = validEnName(indicator);
|
||||||
|
if(enNameFlag){
|
||||||
|
setFailureInfo(result);
|
||||||
|
result.setData("指标英文名称重名, name :"+indicator.getIndicatorEnName());
|
||||||
|
log.error("-------- 指标英文名称重名!!! name :"+indicator.getIndicatorEnName());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean flag = indicatorService.save(indicator);
|
||||||
|
if(flag){
|
||||||
|
switch (indicator.getAppDicPId()) {
|
||||||
|
case 1:
|
||||||
|
//动态表
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setSuccessFlagInfo(result,true);
|
||||||
|
log.info("-------- 保存指标成功 ");
|
||||||
|
}else {
|
||||||
|
setFailureInfo(result);
|
||||||
|
log.error("-------- 保存指标异常");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("-------- 保存指标异常 : "+e.getMessage(),e);
|
||||||
|
setFailureEInfo(result,e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.common.info.CodeMsg;
|
||||||
import com.common.entity.User;
|
import com.common.entity.User;
|
||||||
import com.zbsz.info.LoginInfo;
|
import com.zbsz.info.LoginInfo;
|
||||||
import com.zbsz.info.Result;
|
import com.zbsz.info.Result;
|
||||||
import com.zbsz.service.UserService;
|
import com.zbsz.repository.UserService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
|
@ -9,22 +9,26 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
@TableName(value = "p_indicator")
|
@TableName(value = "p_indicator")
|
||||||
public class Indicator extends Base {
|
public class Indicator extends Base {
|
||||||
@TableField("indicator_id")
|
|
||||||
@ApiModelProperty(value = "指标编号")
|
|
||||||
private String indicatorId;
|
|
||||||
@TableField("indicator_name")
|
@TableField("indicator_name")
|
||||||
@ApiModelProperty(value = "指标名称")
|
@ApiModelProperty(value = "指标名称(128)")
|
||||||
private String indicatorName;
|
private String indicatorName;
|
||||||
|
@TableField("indicator_en_name(128)")
|
||||||
|
@ApiModelProperty(value = "指标英文名称",required = true)
|
||||||
|
private String indicatorEnName;
|
||||||
@TableField("indicator_dic_id")
|
@TableField("indicator_dic_id")
|
||||||
@ApiModelProperty(value = "指标类型")
|
@ApiModelProperty(value = "指标类型(32)")
|
||||||
private Integer indicatorDicId;
|
private Integer indicatorDicId;
|
||||||
|
|
||||||
//理论上这个字段应该是字典表
|
//理论上这个字段应该是字典表
|
||||||
@TableField("scene_id")
|
@TableField("scene_id")
|
||||||
@ApiModelProperty(value = "场景类型")
|
@ApiModelProperty(value = "关联技能(32)")
|
||||||
private Integer sceneId;
|
private Integer sceneId;
|
||||||
@TableField("app_dic_id")
|
@TableField("app_dic_p_id")
|
||||||
@ApiModelProperty(value = "应用类型")
|
@ApiModelProperty(value = "关联应用模块(32)")
|
||||||
private Integer appDicId;
|
private Integer appDicPId;
|
||||||
|
@TableField("app_dic_c_id")
|
||||||
|
@ApiModelProperty(value = "关联功能(32)")
|
||||||
|
private Integer appDicCId;
|
||||||
|
@TableField("indicator_code")
|
||||||
|
@ApiModelProperty(value = "代码值(32)")
|
||||||
|
private String indicatorCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package com.zbsz.filter;
|
package com.zbsz.filter;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
||||||
import com.common.entity.User;
|
import com.common.entity.User;
|
||||||
import com.common.info.CodeMsg;
|
import com.common.info.CodeMsg;
|
||||||
import com.zbsz.info.Result;
|
import com.zbsz.info.Result;
|
||||||
import com.zbsz.service.UserService;
|
import com.zbsz.repository.UserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.zbsz.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zbsz.entity.Indicator;
|
||||||
|
|
||||||
|
public interface IndicatorMapper extends BaseMapper<Indicator> {
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.zbsz.service;
|
package com.zbsz.repository;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.common.entity.dic.AppDic;
|
import com.common.entity.dic.AppDic;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.zbsz.service;
|
package com.zbsz.repository;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.common.entity.dic.IndicatorDic;
|
import com.common.entity.dic.IndicatorDic;
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.zbsz.repository;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zbsz.entity.Indicator;
|
||||||
|
import com.zbsz.mapper.IndicatorMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class IndicatorService extends ServiceImpl<IndicatorMapper, Indicator> {
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.zbsz.service;
|
package com.zbsz.repository;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.common.entity.Scene;
|
import com.common.entity.Scene;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.zbsz.service;
|
package com.zbsz.repository;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.common.entity.User;
|
import com.common.entity.User;
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.zbsz.service;
|
||||||
|
|
||||||
|
import com.zbsz.entity.Indicator;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DynamicTableService {
|
||||||
|
@Autowired
|
||||||
|
private DataSource dataSource; // 注入DataSource对象
|
||||||
|
|
||||||
|
private String getTableName(Indicator indicator){
|
||||||
|
String tablename = "indicator_"+indicator.getSceneId()
|
||||||
|
+"_"+indicator.getIndicatorDicId()
|
||||||
|
+"_"+indicator.getAppDicCId()
|
||||||
|
+"_"+indicator.getIndicatorEnName()
|
||||||
|
;
|
||||||
|
return tablename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createTable(){
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
conn = dataSource.getConnection();
|
||||||
|
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
if(conn!=null) conn.close();
|
||||||
|
}catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package com.zbsz;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.common.entity.dic.IndicatorDic;
|
import com.common.entity.dic.IndicatorDic;
|
||||||
import com.zbsz.service.IndicatorDicService;
|
import com.zbsz.repository.IndicatorDicService;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue