提交 6dc3880d 编写于 作者: sq3536's avatar sq3536

mockdata

上级 9ebf0155
package cn.ibizlab.api.rest.extensions; package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.core.lite.domain.DstComponent; import cn.ibizlab.core.lite.domain.DstComponent;
import cn.ibizlab.core.lite.domain.DstConfig;
import cn.ibizlab.core.lite.domain.DstSystem; import cn.ibizlab.core.lite.domain.DstSystem;
import cn.ibizlab.core.lite.extensions.domain.EntityModel; import cn.ibizlab.core.lite.extensions.domain.EntityModel;
import cn.ibizlab.core.lite.extensions.domain.FieldModel; import cn.ibizlab.core.lite.extensions.domain.FieldModel;
...@@ -9,8 +10,12 @@ import cn.ibizlab.core.lite.extensions.domain.SysModel; ...@@ -9,8 +10,12 @@ import cn.ibizlab.core.lite.extensions.domain.SysModel;
import cn.ibizlab.core.lite.extensions.service.LiteCoreService; import cn.ibizlab.core.lite.extensions.service.LiteCoreService;
import cn.ibizlab.core.lite.extensions.service.LiteModelService; import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.core.lite.service.IDstComponentService; import cn.ibizlab.core.lite.service.IDstComponentService;
import cn.ibizlab.core.lite.service.IDstConfigService;
import cn.ibizlab.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.security.AuthenticationUser;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -23,6 +28,7 @@ import org.springframework.util.StringUtils; ...@@ -23,6 +28,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.sql.Wrapper;
import java.util.Base64; import java.util.Base64;
import java.util.List; import java.util.List;
...@@ -100,4 +106,25 @@ public class LiteCoreResource { ...@@ -100,4 +106,25 @@ public class LiteCoreResource {
return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getSysApp()); return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getSysApp());
} }
@Autowired
private IDstConfigService dstConfigService;
@RequestMapping(method = RequestMethod.GET, value = { "/lite/mockdata/{configType}/{targetType}", "/lite/mockdata/{system}/{configType}/{targetType}","/lite/mockdata/{system}/{configType}/{targetType}/{userId}"})
public ResponseEntity mockdata(@PathVariable(name = "system",required = false) String system,@PathVariable("configType") String configType, @PathVariable("targetType") String targetType,@PathVariable(name = "userId",required = false) String userId) {
LambdaQueryWrapper<DstConfig> wrapper=Wrappers.lambdaQuery();
if(!StringUtils.isEmpty(system))
wrapper.eq(DstConfig::getSystemId,system);
if(!StringUtils.isEmpty(userId))
wrapper.eq(DstConfig::getUserId,userId);
wrapper.eq(DstConfig::getCfgType,configType);
wrapper.eq(DstConfig::getTargetType,targetType);
DstConfig config=dstConfigService.getOne(wrapper,true);
return ResponseEntity.ok(JSON.parse(config.getCfg()));
}
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册