提交 246892e5 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ibz-dst,应用]

上级 8672ec1a
...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/dstdatasources\/getdraft$/)).reply((config: any) => { ...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/dstdatasources\/getdraft$/)).reply((config: any) => {
return [status, {}]; return [status, {}];
}); });
// BuildDS
mock.onPost(new RegExp(/^\/dstdatasources\/?([a-zA-Z0-9\-\;]{0,35})\/buildds$/)).reply((config: any) => {
console.groupCollapsed("实体:dstdatasource 方法: BuildDS");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['ds_id'];
const matchArray:any = new RegExp(/^\/dstdatasources\/([a-zA-Z0-9\-\;]{1,35})\/buildds$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.ds_id, tempValue.ds_id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['ds_id'] == tempValue['ds_id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// CheckKey // CheckKey
mock.onPost(new RegExp(/^\/dstdatasources\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => { mock.onPost(new RegExp(/^\/dstdatasources\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:dstdatasource 方法: CheckKey"); console.groupCollapsed("实体:dstdatasource 方法: CheckKey");
......
...@@ -139,6 +139,20 @@ export default class DstDataSourceServiceBase extends EntityService { ...@@ -139,6 +139,20 @@ export default class DstDataSourceServiceBase extends EntityService {
return res; return res;
} }
/**
* BuildDS接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DstDataSourceServiceBase
*/
public async BuildDS(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/dstdatasources/${context.dstdatasource}/buildds`,data,isloading);
return res;
}
/** /**
* CheckKey接口方法 * CheckKey接口方法
* *
......
package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.lite.service.impl.DstDataSourceServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.core.lite.domain.DstDataSource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[数据源] 自定义服务对象
*/
@Slf4j
@Primary
@Service("DstDataSourceExService")
public class DstDataSourceExService extends DstDataSourceServiceImpl {
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
/**
* [BuildDS:buildDS] 行为扩展
* @param et
* @return
*/
@Override
@Transactional
public DstDataSource buildDS(DstDataSource et) {
return super.buildDS(et);
}
}
...@@ -33,6 +33,7 @@ public interface IDstDataSourceService extends IService<DstDataSource> { ...@@ -33,6 +33,7 @@ public interface IDstDataSourceService extends IService<DstDataSource> {
void removeBatch(Collection<String> idList); void removeBatch(Collection<String> idList);
DstDataSource get(String key); DstDataSource get(String key);
DstDataSource getDraft(DstDataSource et); DstDataSource getDraft(DstDataSource et);
DstDataSource buildDS(DstDataSource et);
boolean checkKey(DstDataSource et); boolean checkKey(DstDataSource et);
boolean save(DstDataSource et); boolean save(DstDataSource et);
void saveBatch(List<DstDataSource> list); void saveBatch(List<DstDataSource> list);
......
...@@ -117,6 +117,13 @@ public class DstDataSourceServiceImpl extends ServiceImpl<DstDataSourceMapper, D ...@@ -117,6 +117,13 @@ public class DstDataSourceServiceImpl extends ServiceImpl<DstDataSourceMapper, D
return et; return et;
} }
@Override
@Transactional
public DstDataSource buildDS(DstDataSource et) {
//自定义代码
return et;
}
@Override @Override
public boolean checkKey(DstDataSource et) { public boolean checkKey(DstDataSource et) {
return (!ObjectUtils.isEmpty(et.getDsId())) && (!Objects.isNull(this.getById(et.getDsId()))); return (!ObjectUtils.isEmpty(et.getDsId())) && (!Objects.isNull(this.getById(et.getDsId())));
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
<!--输出实体[DST_DATASOURCE]数据结构 --> <!--输出实体[DST_DATASOURCE]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-dst_datasource-2-5"> <changeSet author="a_A_5d9d78509" id="tab-dst_datasource-3-5">
<createTable tableName="IBZDATASOURCE"> <createTable tableName="IBZDATASOURCE">
<column name="DSID" remarks="" type="VARCHAR(100)"> <column name="DSID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DST_DATASOURCE_DSID"/> <constraints primaryKey="true" primaryKeyName="PK_DST_DATASOURCE_DSID"/>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"delogicname":"数据源", "delogicname":"数据源",
"sysmoudle":{"id":"LITE","name":"lite"}, "sysmoudle":{"id":"LITE","name":"lite"},
"dedataset":[{"id":"Default" , "name":"数据集"}], "dedataset":[{"id":"Default" , "name":"数据集"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }], "deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"BuildDS" , "name":"buildDS" , "type":"USERCUSTOM" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}] "datascope":[{"id":"all","name":"全部数据"}]
} }
, { , {
......
...@@ -114,6 +114,17 @@ public class DstDataSourceResource { ...@@ -114,6 +114,17 @@ public class DstDataSourceResource {
return ResponseEntity.status(HttpStatus.OK).body(dstdatasourceMapping.toDto(dstdatasourceService.getDraft(new DstDataSource()))); return ResponseEntity.status(HttpStatus.OK).body(dstdatasourceMapping.toDto(dstdatasourceService.getDraft(new DstDataSource())));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DstDataSource-BuildDS-all')")
@ApiOperation(value = "buildDS", tags = {"数据源" }, notes = "buildDS")
@RequestMapping(method = RequestMethod.POST, value = "/dstdatasources/{dstdatasource_id}/buildds")
public ResponseEntity<DstDataSourceDTO> buildDS(@PathVariable("dstdatasource_id") String dstdatasource_id, @RequestBody DstDataSourceDTO dstdatasourcedto) {
DstDataSource domain = dstdatasourceMapping.toDomain(dstdatasourcedto);
domain.setDsId(dstdatasource_id);
domain = dstdatasourceService.buildDS(domain);
dstdatasourcedto = dstdatasourceMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dstdatasourcedto);
}
@ApiOperation(value = "检查数据源", tags = {"数据源" }, notes = "检查数据源") @ApiOperation(value = "检查数据源", tags = {"数据源" }, notes = "检查数据源")
@RequestMapping(method = RequestMethod.POST, value = "/dstdatasources/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/dstdatasources/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody DstDataSourceDTO dstdatasourcedto) { public ResponseEntity<Boolean> checkKey(@RequestBody DstDataSourceDTO dstdatasourcedto) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册