[漏洞修复]删除不需要的controller

master
liuqingkun 3 years ago
parent 55dc6dd0e9
commit b9eb6e56ee
  1. 5
      pom.xml
  2. 8
      src/main/java/org/springblade/common/event/ApiLogListener.java
  3. 8
      src/main/java/org/springblade/common/event/ErrorLogListener.java
  4. 8
      src/main/java/org/springblade/common/event/UsualLogListener.java
  5. 97
      src/main/java/org/springblade/modules/auth/endpoint/BladeSocialEndpoint.java
  6. 6
      src/main/java/org/springblade/modules/business/service/impl/ApmConfigServiceImpl.java
  7. 192
      src/main/java/org/springblade/modules/develop/controller/CodeController.java
  8. 128
      src/main/java/org/springblade/modules/develop/controller/DatasourceController.java
  9. 229
      src/main/java/org/springblade/modules/develop/controller/ModelController.java
  10. 137
      src/main/java/org/springblade/modules/develop/controller/ModelPrototypeController.java
  11. 42
      src/main/java/org/springblade/modules/develop/dto/ModelDTO.java
  12. 180
      src/main/java/org/springblade/modules/develop/entity/Code.java
  13. 71
      src/main/java/org/springblade/modules/develop/entity/Datasource.java
  14. 74
      src/main/java/org/springblade/modules/develop/entity/Model.java
  15. 119
      src/main/java/org/springblade/modules/develop/entity/ModelPrototype.java
  16. 29
      src/main/java/org/springblade/modules/develop/mapper/CodeMapper.java
  17. 22
      src/main/java/org/springblade/modules/develop/mapper/CodeMapper.xml
  18. 29
      src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.java
  19. 22
      src/main/java/org/springblade/modules/develop/mapper/DatasourceMapper.xml
  20. 29
      src/main/java/org/springblade/modules/develop/mapper/ModelMapper.java
  21. 27
      src/main/java/org/springblade/modules/develop/mapper/ModelMapper.xml
  22. 29
      src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.java
  23. 35
      src/main/java/org/springblade/modules/develop/mapper/ModelPrototypeMapper.xml
  24. 38
      src/main/java/org/springblade/modules/develop/service/ICodeService.java
  25. 29
      src/main/java/org/springblade/modules/develop/service/IDatasourceService.java
  26. 47
      src/main/java/org/springblade/modules/develop/service/IModelPrototypeService.java
  27. 29
      src/main/java/org/springblade/modules/develop/service/IModelService.java
  28. 40
      src/main/java/org/springblade/modules/develop/service/impl/CodeServiceImpl.java
  29. 33
      src/main/java/org/springblade/modules/develop/service/impl/DatasourceServiceImpl.java
  30. 55
      src/main/java/org/springblade/modules/develop/service/impl/ModelPrototypeServiceImpl.java
  31. 33
      src/main/java/org/springblade/modules/develop/service/impl/ModelServiceImpl.java
  32. 128
      src/main/java/org/springblade/modules/resource/controller/AttachController.java
  33. 152
      src/main/java/org/springblade/modules/resource/controller/OssController.java
  34. 153
      src/main/java/org/springblade/modules/resource/controller/SmsController.java
  35. 188
      src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
  36. 179
      src/main/java/org/springblade/modules/resource/endpoint/SmsEndpoint.java
  37. 12
      src/main/java/org/springblade/modules/system/controller/DeptController.java
  38. 108
      src/main/java/org/springblade/modules/system/controller/ParamController.java
  39. 150
      src/main/java/org/springblade/modules/system/controller/PostController.java
  40. 99
      src/main/java/org/springblade/modules/system/controller/SearchController.java
  41. 233
      src/main/java/org/springblade/modules/system/controller/TenantController.java
  42. 134
      src/main/java/org/springblade/modules/system/controller/TenantPackageController.java
  43. 137
      src/main/java/org/springblade/modules/system/controller/TopMenuController.java
  44. 50
      src/main/resources/application.yml
  45. BIN
      src/main/resources/static/images/icon.png

@ -119,11 +119,6 @@
<groupId>org.springblade</groupId>
<artifactId>blade-starter-report</artifactId>
</dependency>
<!-- 工作流 -->
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-flowable</artifactId>
</dependency>
<!-- 验证码 -->
<dependency>
<groupId>com.github.whvcse</groupId>

@ -51,10 +51,10 @@ public class ApiLogListener {
@Order
@EventListener(ApiLogEvent.class)
public void saveApiLog(ApiLogEvent event) {
Map<String, Object> source = (Map<String, Object>) event.getSource();
LogApi logApi = (LogApi) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logApi, bladeProperties, serverInfo);
logService.saveApiLog(logApi);
// Map<String, Object> source = (Map<String, Object>) event.getSource();
// LogApi logApi = (LogApi) source.get(EventConstant.EVENT_LOG);
// LogAbstractUtil.addOtherInfoToLog(logApi, bladeProperties, serverInfo);
// logService.saveApiLog(logApi);
}
}

@ -49,9 +49,9 @@ public class ErrorLogListener {
@Order
@EventListener(ErrorLogEvent.class)
public void saveErrorLog(ErrorLogEvent event) {
Map<String, Object> source = (Map<String, Object>) event.getSource();
LogError logError = (LogError) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logError, bladeProperties, serverInfo);
logService.saveErrorLog(logError);
// Map<String, Object> source = (Map<String, Object>) event.getSource();
// LogError logError = (LogError) source.get(EventConstant.EVENT_LOG);
// LogAbstractUtil.addOtherInfoToLog(logError, bladeProperties, serverInfo);
// logService.saveErrorLog(logError);
}
}

@ -49,10 +49,10 @@ public class UsualLogListener {
@Order
@EventListener(UsualLogEvent.class)
public void saveUsualLog(UsualLogEvent event) {
Map<String, Object> source = (Map<String, Object>) event.getSource();
LogUsual logUsual = (LogUsual) source.get(EventConstant.EVENT_LOG);
LogAbstractUtil.addOtherInfoToLog(logUsual, bladeProperties, serverInfo);
logService.saveUsualLog(logUsual);
// Map<String, Object> source = (Map<String, Object>) event.getSource();
// LogUsual logUsual = (LogUsual) source.get(EventConstant.EVENT_LOG);
// LogAbstractUtil.addOtherInfoToLog(logUsual, bladeProperties, serverInfo);
// logService.saveUsualLog(logUsual);
}
}

@ -1,97 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.auth.endpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhyd.oauth.model.AuthCallback;
import me.zhyd.oauth.model.AuthToken;
import me.zhyd.oauth.request.AuthRequest;
import me.zhyd.oauth.utils.AuthStateUtils;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.social.props.SocialProperties;
import org.springblade.core.social.utils.SocialUtil;
import org.springblade.core.tenant.annotation.NonDS;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 第三方登陆端点
*
* @author Chill
*/
@NonDS
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_AUTH_NAME)
@ConditionalOnProperty(value = "social.enabled", havingValue = "true")
@Api(value = "第三方登陆", tags = "第三方登陆端点")
public class BladeSocialEndpoint {
private final SocialProperties socialProperties;
/**
* 授权完毕跳转
*/
@ApiOperation(value = "授权完毕跳转")
@RequestMapping("/oauth/render/{source}")
public void renderAuth(@PathVariable("source") String source, HttpServletResponse response) throws IOException {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
response.sendRedirect(authorizeUrl);
}
/**
* 获取认证信息
*/
@ApiOperation(value = "获取认证信息")
@RequestMapping("/oauth/callback/{source}")
public Object login(@PathVariable("source") String source, AuthCallback callback) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.login(callback);
}
/**
* 撤销授权
*/
@ApiOperation(value = "撤销授权")
@RequestMapping("/oauth/revoke/{source}/{token}")
public Object revokeAuth(@PathVariable("source") String source, @PathVariable("token") String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.revoke(AuthToken.builder().accessToken(token).build());
}
/**
* 续期accessToken
*/
@ApiOperation(value = "续期令牌")
@RequestMapping("/oauth/refresh/{source}")
public Object refreshAuth(@PathVariable("source") String source, String token) {
AuthRequest authRequest = SocialUtil.getAuthRequest(source, socialProperties);
return authRequest.refresh(AuthToken.builder().refreshToken(token).build());
}
}

@ -230,7 +230,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig
Map<String, ApmConfig> alreadyConfMap = new HashMap<>();
if (Func.isNotEmpty(alreadyConfList)) {
for (ApmConfig config : alreadyConfList) {
String key = config.getProject() + config.getApmDay() + config.getPeriod() + config.getTimeFrame();
String key = config.getProject() + DateUtil.format(config.getApmDay(), DateUtil.PATTERN_DATE) + config.getPeriod() + config.getTimeFrame();
if (alreadyConfMap.containsKey(key)) {
continue;
}
@ -259,9 +259,11 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig
// 若此次修改的放号有对应的放号记录, 且已被人预约, 验证放号数量与预约数量
if (alreadyConfCountMap.containsKey(key) && config.getNumberNum() < alreadyConfCountMap.get(key)) {
return "保存失败, 放号数量不能低于已预约的数量";
}
if (alreadyConfCountMap.containsKey(key)) {
alreadyConfCountMap.remove(key);
}
}
// 若已预约map不为空, 证明此次修改没有覆盖到全部的时间段, 且该时间段已被人预约, 放号失败

@ -1,192 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.develop.support.BladeCodeGenerator;
import org.springblade.modules.develop.entity.Code;
import org.springblade.modules.develop.entity.Datasource;
import org.springblade.modules.develop.entity.Model;
import org.springblade.modules.develop.entity.ModelPrototype;
import org.springblade.modules.develop.service.ICodeService;
import org.springblade.modules.develop.service.IDatasourceService;
import org.springblade.modules.develop.service.IModelPrototypeService;
import org.springblade.modules.develop.service.IModelService;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 控制器
*
* @author Chill
*/
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/code")
@Api(value = "代码生成", tags = "代码生成")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public class CodeController extends BladeController {
private final ICodeService codeService;
private final IDatasourceService datasourceService;
private final IModelService modelService;
private final IModelPrototypeService modelPrototypeService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入code")
public R<Code> detail(Code code) {
Code detail = codeService.getOne(Condition.getQueryWrapper(code));
return R.data(detail);
}
/**
* 分页
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "codeName", value = "模块名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "tableName", value = "表名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "modelName", value = "实体名", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入code")
public R<IPage<Code>> list(@ApiIgnore @RequestParam Map<String, Object> code, Query query) {
IPage<Code> pages = codeService.page(Condition.getPage(query), Condition.getQueryWrapper(code, Code.class));
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增或修改", notes = "传入code")
public R submit(@Valid @RequestBody Code code) {
return R.status(codeService.submit(code));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(codeService.removeByIds(Func.toLongList(ids)));
}
/**
* 复制
*/
@PostMapping("/copy")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "复制", notes = "传入id")
public R copy(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
Code code = codeService.getById(id);
code.setId(null);
code.setCodeName(code.getCodeName() + "-copy");
return R.status(codeService.save(code));
}
/**
* 代码生成
*/
@PostMapping("/gen-code")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "代码生成", notes = "传入ids")
public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
Collection<Code> codes = codeService.listByIds(Func.toLongList(ids));
codes.forEach(code -> {
BladeCodeGenerator generator = new BladeCodeGenerator();
// 设置基础模型
Model model = modelService.getById(code.getModelId());
generator.setModelCode(model.getModelCode());
generator.setModelClass(model.getModelClass());
// 设置模型集合
List<ModelPrototype> prototypes = modelPrototypeService.prototypeList(model.getId());
generator.setModel(JsonUtil.readMap(JsonUtil.toJson(model)));
generator.setPrototypes(JsonUtil.readListMap(JsonUtil.toJson(prototypes)));
if (StringUtil.isNotBlank(code.getSubModelId())) {
Model subModel = modelService.getById(Func.toLong(code.getSubModelId()));
List<ModelPrototype> subPrototypes = modelPrototypeService.prototypeList(subModel.getId());
generator.setSubModel(JsonUtil.readMap(JsonUtil.toJson(subModel)));
generator.setSubPrototypes(JsonUtil.readListMap(JsonUtil.toJson(subPrototypes)));
}
// 设置数据源
Datasource datasource = datasourceService.getById(model.getDatasourceId());
generator.setDriverName(datasource.getDriverClass());
generator.setUrl(datasource.getUrl());
generator.setUsername(datasource.getUsername());
generator.setPassword(datasource.getPassword());
// 设置基础配置
generator.setCodeStyle(code.getCodeStyle());
generator.setCodeName(code.getCodeName());
generator.setServiceName(code.getServiceName());
generator.setPackageName(code.getPackageName());
generator.setPackageDir(code.getApiPath());
generator.setPackageWebDir(code.getWebPath());
generator.setTablePrefix(Func.toStrArray(code.getTablePrefix()));
generator.setIncludeTables(Func.toStrArray(code.getTableName()));
// 设置模版信息
generator.setTemplateType(code.getTemplateType());
generator.setAuthor(code.getAuthor());
generator.setSubModelId(code.getSubModelId());
generator.setSubFkId(code.getSubFkId());
generator.setTreeId(code.getTreeId());
generator.setTreePid(code.getTreePid());
generator.setTreeName(code.getTreeName());
// 设置是否继承基础业务字段
generator.setHasSuperEntity(code.getBaseMode() == 2);
// 设置是否开启包装器模式
generator.setHasWrapper(code.getWrapMode() == 2);
// 设置是否开启远程调用模式
generator.setHasFeign(code.getFeignMode() == 2);
// 设置控制器服务名前缀
generator.setHasServiceName(Boolean.TRUE);
// 启动代码生成
generator.run();
});
return R.success("代码生成成功");
}
}

@ -1,128 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.develop.entity.Datasource;
import org.springblade.modules.develop.service.IDatasourceService;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 数据源配置表 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/datasource")
@Api(value = "数据源配置表", tags = "数据源配置表接口")
public class DatasourceController extends BladeController {
private final IDatasourceService datasourceService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入datasource")
public R<Datasource> detail(Datasource datasource) {
Datasource detail = datasourceService.getOne(Condition.getQueryWrapper(datasource));
return R.data(detail);
}
/**
* 分页 数据源配置表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入datasource")
public R<IPage<Datasource>> list(Datasource datasource, Query query) {
IPage<Datasource> pages = datasourceService.page(Condition.getPage(query), Condition.getQueryWrapper(datasource));
return R.data(pages);
}
/**
* 新增 数据源配置表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入datasource")
public R save(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.save(datasource));
}
/**
* 修改 数据源配置表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入datasource")
public R update(@Valid @RequestBody Datasource datasource) {
return R.status(datasourceService.updateById(datasource));
}
/**
* 新增或修改 数据源配置表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入datasource")
public R submit(@Valid @RequestBody Datasource datasource) {
datasource.setUrl(datasource.getUrl().replace("&amp;", "&"));
return R.status(datasourceService.saveOrUpdate(datasource));
}
/**
* 删除 数据源配置表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(datasourceService.deleteLogic(Func.toLongList(ids)));
}
/**
* 数据源列表
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "下拉数据源", notes = "查询列表")
public R<List<Datasource>> select() {
List<Datasource> list = datasourceService.list();
return R.data(list);
}
}

@ -1,229 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.develop.entity.Datasource;
import org.springblade.modules.develop.entity.Model;
import org.springblade.modules.develop.entity.ModelPrototype;
import org.springblade.modules.develop.service.IDatasourceService;
import org.springblade.modules.develop.service.IModelPrototypeService;
import org.springblade.modules.develop.service.IModelService;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 数据模型表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/model")
@Api(value = "数据模型表", tags = "数据模型表接口")
public class ModelController extends BladeController {
private final IModelService modelService;
private final IModelPrototypeService modelPrototypeService;
private final IDatasourceService datasourceService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入model")
public R<Model> detail(Model model) {
Model detail = modelService.getOne(Condition.getQueryWrapper(model));
return R.data(detail);
}
/**
* 分页 数据模型表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入model")
public R<IPage<Model>> list(Model model, Query query) {
IPage<Model> pages = modelService.page(Condition.getPage(query), Condition.getQueryWrapper(model));
return R.data(pages);
}
/**
* 新增 数据模型表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增", notes = "传入model")
public R save(@Valid @RequestBody Model model) {
return R.status(modelService.save(model));
}
/**
* 修改 数据模型表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "修改", notes = "传入model")
public R update(@Valid @RequestBody Model model) {
return R.status(modelService.updateById(model));
}
/**
* 新增或修改 数据模型表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增或修改", notes = "传入model")
public R submit(@Valid @RequestBody Model model) {
return R.status(modelService.saveOrUpdate(model));
}
/**
* 删除 数据模型表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(modelService.deleteLogic(Func.toLongList(ids)));
}
/**
* 模型列表
*/
@GetMapping("/select")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "模型列表", notes = "模型列表")
public R<List<Model>> select() {
List<Model> list = modelService.list();
list.forEach(model -> model.setModelName(model.getModelTable() + StringPool.COLON + StringPool.SPACE + model.getModelName()));
return R.data(list);
}
/**
* 获取物理表列表
*/
@GetMapping("/table-list")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "物理表列表", notes = "传入datasourceId")
public R<List<TableInfo>> tableList(Long datasourceId) {
Datasource datasource = datasourceService.getById(datasourceId);
ConfigBuilder config = getConfigBuilder(datasource);
List<TableInfo> tableInfoList = config.getTableInfoList().stream()
.filter(tableInfo -> !StringUtil.startsWithIgnoreCase(tableInfo.getName(), "ACT_"))
.map(tableInfo -> tableInfo.setComment(tableInfo.getName() + StringPool.COLON + tableInfo.getComment()))
.collect(Collectors.toList());
return R.data(tableInfoList);
}
/**
* 获取物理表信息
*/
@GetMapping("/table-info")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "物理表信息", notes = "传入model信息")
public R<TableInfo> tableInfo(Long modelId, String tableName, Long datasourceId) {
if (StringUtil.isBlank(tableName)) {
Model model = modelService.getById(modelId);
tableName = model.getModelTable();
}
TableInfo tableInfo = getTableInfo(tableName, datasourceId);
return R.data(tableInfo);
}
/**
* 获取字段信息
*/
@GetMapping("/model-prototype")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "物理表字段信息", notes = "传入modelId与datasourceId")
public R modelPrototype(Long modelId, Long datasourceId) {
List<ModelPrototype> modelPrototypeList = modelPrototypeService.list(Wrappers.<ModelPrototype>query().lambda().eq(ModelPrototype::getModelId, modelId));
if (modelPrototypeList.size() > 0) {
return R.data(modelPrototypeList);
}
Model model = modelService.getById(modelId);
String tableName = model.getModelTable();
TableInfo tableInfo = getTableInfo(tableName, datasourceId);
if (tableInfo != null) {
return R.data(tableInfo.getFields());
} else {
return R.fail("未获得相关表信息");
}
}
/**
* 获取表信息
*
* @param tableName 表名
* @param datasourceId 数据源主键
*/
private TableInfo getTableInfo(String tableName, Long datasourceId) {
Datasource datasource = datasourceService.getById(datasourceId);
ConfigBuilder config = getConfigBuilder(datasource);
List<TableInfo> tableInfoList = config.getTableInfoList();
TableInfo tableInfo = null;
Iterator<TableInfo> iterator = tableInfoList.stream().filter(table -> table.getName().equals(tableName)).collect(Collectors.toList()).iterator();
if (iterator.hasNext()) {
tableInfo = iterator.next();
tableInfo.setEntityName(tableInfo.getEntityName().replace(StringUtil.firstCharToUpper(tableName.split(StringPool.UNDERSCORE)[0]), StringPool.EMPTY));
}
return tableInfo;
}
/**
* 获取表配置信息
*
* @param datasource 数据源信息
*/
private ConfigBuilder getConfigBuilder(Datasource datasource) {
StrategyConfig strategyConfig = new StrategyConfig.Builder()
.entityBuilder()
.naming(NamingStrategy.underline_to_camel)
.columnNaming(NamingStrategy.underline_to_camel).build();
DataSourceConfig datasourceConfig = new DataSourceConfig.Builder(
datasource.getUrl(), datasource.getUsername(), datasource.getPassword()
).build();
return new ConfigBuilder(null, datasourceConfig, strategyConfig, null, null, null);
}
}

@ -1,137 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.modules.develop.entity.ModelPrototype;
import org.springblade.modules.develop.service.IModelPrototypeService;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* 数据原型表 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_DEVELOP_NAME + "/model-prototype")
@Api(value = "数据原型表", tags = "数据原型表接口")
public class ModelPrototypeController extends BladeController {
private final IModelPrototypeService modelPrototypeService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入modelPrototype")
public R<ModelPrototype> detail(ModelPrototype modelPrototype) {
ModelPrototype detail = modelPrototypeService.getOne(Condition.getQueryWrapper(modelPrototype));
return R.data(detail);
}
/**
* 分页 数据原型表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入modelPrototype")
public R<IPage<ModelPrototype>> list(ModelPrototype modelPrototype, Query query) {
IPage<ModelPrototype> pages = modelPrototypeService.page(Condition.getPage(query), Condition.getQueryWrapper(modelPrototype));
return R.data(pages);
}
/**
* 新增 数据原型表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入modelPrototype")
public R save(@Valid @RequestBody ModelPrototype modelPrototype) {
return R.status(modelPrototypeService.save(modelPrototype));
}
/**
* 修改 数据原型表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入modelPrototype")
public R update(@Valid @RequestBody ModelPrototype modelPrototype) {
return R.status(modelPrototypeService.updateById(modelPrototype));
}
/**
* 新增或修改 数据原型表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入modelPrototype")
public R submit(@Valid @RequestBody ModelPrototype modelPrototype) {
return R.status(modelPrototypeService.saveOrUpdate(modelPrototype));
}
/**
* 批量新增或修改 数据原型表
*/
@PostMapping("/submit-list")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "批量新增或修改", notes = "传入modelPrototype集合")
public R submitList(@Valid @RequestBody List<ModelPrototype> modelPrototypes) {
return R.status(modelPrototypeService.submitList(modelPrototypes));
}
/**
* 删除 数据原型表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(modelPrototypeService.deleteLogic(Func.toLongList(ids)));
}
/**
* 数据原型列表
*/
@GetMapping("/select")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "数据原型列表", notes = "数据原型列表")
public R<List<ModelPrototype>> select(@ApiParam(value = "数据模型Id", required = true) @RequestParam Long modelId) {
List<ModelPrototype> list = modelPrototypeService.list(Wrappers.<ModelPrototype>query().lambda().eq(ModelPrototype::getModelId, modelId));
list.forEach(prototype -> prototype.setComment(prototype.getJdbcName() + StringPool.COLON + StringPool.SPACE + prototype.getComment()));
return R.data(list);
}
}

@ -1,42 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.develop.entity.Model;
import org.springblade.modules.develop.entity.ModelPrototype;
import java.util.List;
/**
* 代码模型DTO
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ModelDTO extends Model {
private static final long serialVersionUID = 1L;
/**
* 代码建模原型
*/
private List<ModelPrototype> prototypes;
}

@ -1,180 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("blade_code")
@ApiModel(value = "Code对象", description = "Code对象")
public class Code implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 数据模型主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "数据模型主键")
private Long modelId;
/**
* 模块名称
*/
@ApiModelProperty(value = "服务名称")
private String serviceName;
/**
* 模块名称
*/
@ApiModelProperty(value = "模块名称")
private String codeName;
/**
* 表名
*/
@ApiModelProperty(value = "表名")
private String tableName;
/**
* 实体名
*/
@ApiModelProperty(value = "表前缀")
private String tablePrefix;
/**
* 主键名
*/
@ApiModelProperty(value = "主键名")
private String pkName;
/**
* 后端包名
*/
@ApiModelProperty(value = "后端包名")
private String packageName;
/**
* 模版类型
*/
@ApiModelProperty(value = "模版类型")
private String templateType;
/**
* 作者信息
*/
@ApiModelProperty(value = "作者信息")
private String author;
/**
* 子表模型主键
*/
@ApiModelProperty(value = "子表模型主键")
private String subModelId;
/**
* 子表绑定外键
*/
@ApiModelProperty(value = "子表绑定外键")
private String subFkId;
/**
* 树主键字段
*/
@ApiModelProperty(value = "树主键字段")
private String treeId;
/**
* 树父主键字段
*/
@ApiModelProperty(value = "树父主键字段")
private String treePid;
/**
* 树名称字段
*/
@ApiModelProperty(value = "树名称字段")
private String treeName;
/**
* 基础业务模式
*/
@ApiModelProperty(value = "基础业务模式")
private Integer baseMode;
/**
* 包装器模式
*/
@ApiModelProperty(value = "包装器模式")
private Integer wrapMode;
/**
* 远程调用模式
*/
@ApiModelProperty(value = "远程调用模式")
private Integer feignMode;
/**
* 代码风格
*/
@ApiModelProperty(value = "代码风格")
private String codeStyle;
/**
* 后端路径
*/
@ApiModelProperty(value = "后端路径")
private String apiPath;
/**
* 前端路径
*/
@ApiModelProperty(value = "前端路径")
private String webPath;
/**
* 是否已删除
*/
@TableLogic
@ApiModelProperty(value = "是否已删除")
private Integer isDeleted;
}

@ -1,71 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 数据源配置表实体类
*
* @author Chill
*/
@Data
@TableName("blade_datasource")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Datasource对象", description = "数据源配置表")
public class Datasource extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
private String name;
/**
* 驱动类
*/
@ApiModelProperty(value = "驱动类")
private String driverClass;
/**
* 连接地址
*/
@ApiModelProperty(value = "连接地址")
private String url;
/**
* 用户名
*/
@ApiModelProperty(value = "用户名")
private String username;
/**
* 密码
*/
@ApiModelProperty(value = "密码")
private String password;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
}

@ -1,74 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 数据模型表实体类
*
* @author Chill
*/
@Data
@TableName("blade_model")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Model对象", description = "数据模型表")
public class Model extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 数据源主键
*/
@ApiModelProperty(value = "数据源主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long datasourceId;
/**
* 模型名称
*/
@ApiModelProperty(value = "模型名称")
private String modelName;
/**
* 模型编号
*/
@ApiModelProperty(value = "模型编号")
private String modelCode;
/**
* 物理表名
*/
@ApiModelProperty(value = "物理表名")
private String modelTable;
/**
* 模型类名
*/
@ApiModelProperty(value = "模型类名")
private String modelClass;
/**
* 模型备注
*/
@ApiModelProperty(value = "模型备注")
private String modelRemark;
}

@ -1,119 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* 数据原型表实体类
*
* @author Chill
*/
@Data
@TableName("blade_model_prototype")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ModelPrototype对象", description = "数据原型表")
public class ModelPrototype extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 模型主键
*/
@ApiModelProperty(value = "模型主键")
@JsonSerialize(using = ToStringSerializer.class)
private Long modelId;
/**
* 物理列名
*/
@ApiModelProperty(value = "物理列名")
private String jdbcName;
/**
* 物理类型
*/
@ApiModelProperty(value = "物理类型")
private String jdbcType;
/**
* 实体列名
*/
@ApiModelProperty(value = "实体列名")
private String propertyName;
/**
* 实体类型
*/
@ApiModelProperty(value = "实体类型")
private String propertyType;
/**
* 实体类型引用
*/
@ApiModelProperty(value = "实体类型引用")
private String propertyEntity;
/**
* 注释说明
*/
@ApiModelProperty(value = "注释说明")
private String comment;
/**
* 列表显示
*/
@ApiModelProperty(value = "列表显示")
private Integer isList;
/**
* 表单显示
*/
@ApiModelProperty(value = "表单显示")
private Integer isForm;
/**
* 独占一行
*/
@ApiModelProperty(value = "独占一行")
private Integer isRow;
/**
* 组件类型
*/
@ApiModelProperty(value = "组件类型")
private String componentType;
/**
* 字典编码
*/
@ApiModelProperty(value = "字典编码")
private String dictCode;
/**
* 是否必填
*/
@ApiModelProperty(value = "是否必填")
private Integer isRequired;
/**
* 查询配置
*/
@ApiModelProperty(value = "查询配置")
private Integer isQuery;
/**
* 查询类型
*/
@ApiModelProperty(value = "查询类型")
private String queryType;
}

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.modules.develop.entity.Code;
/**
* Mapper 接口
*
* @author Chill
*/
public interface CodeMapper extends BaseMapper<Code> {
}

@ -1,22 +0,0 @@
<?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="org.springblade.modules.develop.mapper.CodeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="codeResultMap" type="org.springblade.modules.develop.entity.Code">
<id column="id" property="id"/>
<result column="datasource_id" property="datasourceId"/>
<result column="service_name" property="serviceName"/>
<result column="code_name" property="codeName"/>
<result column="table_name" property="tableName"/>
<result column="pk_name" property="pkName"/>
<result column="base_mode" property="baseMode"/>
<result column="wrap_mode" property="wrapMode"/>
<result column="table_prefix" property="tablePrefix"/>
<result column="package_name" property="packageName"/>
<result column="api_path" property="apiPath"/>
<result column="web_path" property="webPath"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>
</mapper>

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.modules.develop.entity.Datasource;
/**
* 数据源配置表 Mapper 接口
*
* @author Chill
*/
public interface DatasourceMapper extends BaseMapper<Datasource> {
}

@ -1,22 +0,0 @@
<?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="org.springblade.modules.develop.mapper.DatasourceMapper">
<!-- 通用查询映射结果 -->
<resultMap id="datasourceResultMap" type="org.springblade.modules.develop.entity.Datasource">
<result column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="driver_class" property="driverClass"/>
<result column="url" property="url"/>
<result column="username" property="username"/>
<result column="password" property="password"/>
<result column="remark" property="remark"/>
</resultMap>
</mapper>

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.modules.develop.entity.Model;
/**
* 数据模型表 Mapper 接口
*
* @author Chill
*/
public interface ModelMapper extends BaseMapper<Model> {
}

@ -1,27 +0,0 @@
<?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="org.springblade.modules.develop.mapper.ModelMapper">
<!-- 通用查询映射结果 -->
<resultMap id="modelResultMap" type="org.springblade.modules.develop.entity.Model">
<id column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="datasource_id" property="datasourceId"/>
<result column="model_name" property="modelName"/>
<result column="model_code" property="modelCode"/>
<result column="model_table" property="modelTable"/>
<result column="model_class" property="modelClass"/>
<result column="model_remark" property="modelRemark"/>
</resultMap>
<select id="selectModelPage" resultMap="modelResultMap">
select * from blade_model where is_deleted = 0
</select>
</mapper>

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.modules.develop.entity.ModelPrototype;
/**
* 数据原型表 Mapper 接口
*
* @author Chill
*/
public interface ModelPrototypeMapper extends BaseMapper<ModelPrototype> {
}

@ -1,35 +0,0 @@
<?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="org.springblade.modules.develop.mapper.ModelPrototypeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="modelPrototypeResultMap" type="org.springblade.modules.develop.entity.ModelPrototype">
<id column="id" property="id"/>
<result column="create_user" property="createUser"/>
<result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime"/>
<result column="status" property="status"/>
<result column="is_deleted" property="isDeleted"/>
<result column="jdbc_name" property="jdbcName"/>
<result column="jdbc_type" property="jdbcType"/>
<result column="comment" property="comment"/>
<result column="property_type" property="propertyType"/>
<result column="property_entity" property="propertyEntity"/>
<result column="property_name" property="propertyName"/>
<result column="is_form" property="isForm"/>
<result column="is_row" property="isRow"/>
<result column="component_type" property="componentType"/>
<result column="dict_code" property="dictCode"/>
<result column="is_required" property="isRequired"/>
<result column="is_list" property="isList"/>
<result column="is_query" property="isQuery"/>
<result column="query_type" property="queryType"/>
</resultMap>
<select id="selectModelPrototypePage" resultMap="modelPrototypeResultMap">
select * from blade_model_prototype where is_deleted = 0
</select>
</mapper>

@ -1,38 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.develop.entity.Code;
/**
* 服务类
*
* @author Chill
*/
public interface ICodeService extends IService<Code> {
/**
* 提交
*
* @param code
* @return
*/
boolean submit(Code code);
}

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.develop.entity.Datasource;
/**
* 数据源配置表 服务类
*
* @author Chill
*/
public interface IDatasourceService extends BaseService<Datasource> {
}

@ -1,47 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.develop.entity.ModelPrototype;
import java.util.List;
/**
* 数据原型表 服务类
*
* @author Chill
*/
public interface IModelPrototypeService extends BaseService<ModelPrototype> {
/**
* 批量提交
*
* @param modelPrototypes 原型集合
* @return boolean
*/
boolean submitList(List<ModelPrototype> modelPrototypes);
/**
* 原型列表
*
* @param modelId 模型ID
* @return List<ModelPrototype>
*/
List<ModelPrototype> prototypeList(Long modelId);
}

@ -1,29 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.develop.entity.Model;
/**
* 数据模型表 服务类
*
* @author Chill
*/
public interface IModelService extends BaseService<Model> {
}

@ -1,40 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.modules.develop.entity.Code;
import org.springblade.modules.develop.mapper.CodeMapper;
import org.springblade.modules.develop.service.ICodeService;
import org.springframework.stereotype.Service;
/**
* 服务实现类
*
* @author Chill
*/
@Service
public class CodeServiceImpl extends ServiceImpl<CodeMapper, Code> implements ICodeService {
@Override
public boolean submit(Code code) {
code.setIsDeleted(BladeConstant.DB_NOT_DELETED);
return saveOrUpdate(code);
}
}

@ -1,33 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service.impl;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.develop.entity.Datasource;
import org.springblade.modules.develop.mapper.DatasourceMapper;
import org.springblade.modules.develop.service.IDatasourceService;
import org.springframework.stereotype.Service;
/**
* 数据源配置表 服务实现类
*
* @author Chill
*/
@Service
public class DatasourceServiceImpl extends BaseServiceImpl<DatasourceMapper, Datasource> implements IDatasourceService {
}

@ -1,55 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.develop.entity.ModelPrototype;
import org.springblade.modules.develop.mapper.ModelPrototypeMapper;
import org.springblade.modules.develop.service.IModelPrototypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 数据原型表 服务实现类
*
* @author Chill
*/
@Service
public class ModelPrototypeServiceImpl extends BaseServiceImpl<ModelPrototypeMapper, ModelPrototype> implements IModelPrototypeService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean submitList(List<ModelPrototype> modelPrototypes) {
modelPrototypes.forEach(modelPrototype -> {
if (modelPrototype.getId() == null) {
this.save(modelPrototype);
} else {
this.updateById(modelPrototype);
}
});
return true;
}
@Override
public List<ModelPrototype> prototypeList(Long modelId) {
return this.list(Wrappers.<ModelPrototype>lambdaQuery().eq(ModelPrototype::getModelId, modelId));
}
}

@ -1,33 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.develop.service.impl;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.develop.entity.Model;
import org.springblade.modules.develop.mapper.ModelMapper;
import org.springblade.modules.develop.service.IModelService;
import org.springframework.stereotype.Service;
/**
* 数据模型表 服务实现类
*
* @author Chill
*/
@Service
public class ModelServiceImpl extends BaseServiceImpl<ModelMapper, Model> implements IModelService {
}

@ -1,128 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.resource.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.resource.entity.Attach;
import org.springblade.modules.resource.service.IAttachService;
import org.springblade.modules.resource.vo.AttachVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* 附件表 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_RESOURCE_NAME + "/attach")
@Api(value = "附件", tags = "附件")
public class AttachController extends BladeController {
private final IAttachService attachService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入attach")
public R<Attach> detail(Attach attach) {
Attach detail = attachService.getOne(Condition.getQueryWrapper(attach));
return R.data(detail);
}
/**
* 分页 附件表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入attach")
public R<IPage<Attach>> list(Attach attach, Query query) {
IPage<Attach> pages = attachService.page(Condition.getPage(query), Condition.getQueryWrapper(attach));
return R.data(pages);
}
/**
* 自定义分页 附件表
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入attach")
public R<IPage<AttachVO>> page(AttachVO attach, Query query) {
IPage<AttachVO> pages = attachService.selectAttachPage(Condition.getPage(query), attach);
return R.data(pages);
}
/**
* 新增 附件表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入attach")
public R save(@Valid @RequestBody Attach attach) {
return R.status(attachService.save(attach));
}
/**
* 修改 附件表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入attach")
public R update(@Valid @RequestBody Attach attach) {
return R.status(attachService.updateById(attach));
}
/**
* 新增或修改 附件表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入attach")
public R submit(@Valid @RequestBody Attach attach) {
return R.status(attachService.saveOrUpdate(attach));
}
/**
* 删除 附件表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(attachService.deleteLogic(Func.toLongList(ids)));
}
}

@ -1,152 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.resource.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.resource.entity.Oss;
import org.springblade.modules.resource.service.IOssService;
import org.springblade.modules.resource.vo.OssVO;
import org.springblade.modules.resource.wrapper.OssWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE;
/**
* 控制器
*
* @author BladeX
*/
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_RESOURCE_NAME + "/oss")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@Api(value = "对象存储接口", tags = "对象存储接口")
public class OssController extends BladeController {
private final IOssService ossService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入oss")
public R<OssVO> detail(Oss oss) {
Oss detail = ossService.getOne(Condition.getQueryWrapper(oss));
return R.data(OssWrapper.build().entityVO(detail));
}
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入oss")
public R<IPage<OssVO>> list(Oss oss, Query query) {
IPage<Oss> pages = ossService.page(Condition.getPage(query), Condition.getQueryWrapper(oss));
return R.data(OssWrapper.build().pageVO(pages));
}
/**
* 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入oss")
public R<IPage<OssVO>> page(OssVO oss, Query query) {
IPage<OssVO> pages = ossService.selectOssPage(Condition.getPage(query), oss);
return R.data(pages);
}
/**
* 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入oss")
public R save(@Valid @RequestBody Oss oss) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(ossService.save(oss));
}
/**
* 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入oss")
public R update(@Valid @RequestBody Oss oss) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(ossService.updateById(oss));
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入oss")
public R submit(@Valid @RequestBody Oss oss) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(ossService.submit(oss));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(ossService.deleteLogic(Func.toLongList(ids)));
}
/**
* 启用
*/
@PostMapping("/enable")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "配置启用", notes = "传入id")
public R enable(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(ossService.enable(id));
}
}

@ -1,153 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.resource.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.resource.entity.Sms;
import org.springblade.modules.resource.service.ISmsService;
import org.springblade.modules.resource.vo.SmsVO;
import org.springblade.modules.resource.wrapper.SmsWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE;
/**
* 短信配置表 控制器
*
* @author BladeX
*/
@NonDS
@ApiIgnore
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_RESOURCE_NAME + "/sms")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
@Api(value = "短信配置表", tags = "短信配置表接口")
public class SmsController extends BladeController {
private final ISmsService smsService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入sms")
public R<SmsVO> detail(Sms sms) {
Sms detail = smsService.getOne(Condition.getQueryWrapper(sms));
return R.data(SmsWrapper.build().entityVO(detail));
}
/**
* 分页 短信配置表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入sms")
public R<IPage<SmsVO>> list(Sms sms, Query query) {
IPage<Sms> pages = smsService.page(Condition.getPage(query), Condition.getQueryWrapper(sms));
return R.data(SmsWrapper.build().pageVO(pages));
}
/**
* 自定义分页 短信配置表
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入sms")
public R<IPage<SmsVO>> page(SmsVO sms, Query query) {
IPage<SmsVO> pages = smsService.selectSmsPage(Condition.getPage(query), sms);
return R.data(pages);
}
/**
* 新增 短信配置表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入sms")
public R save(@Valid @RequestBody Sms sms) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(smsService.save(sms));
}
/**
* 修改 短信配置表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入sms")
public R update(@Valid @RequestBody Sms sms) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(smsService.updateById(sms));
}
/**
* 新增或修改 短信配置表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入sms")
public R submit(@Valid @RequestBody Sms sms) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(smsService.submit(sms));
}
/**
* 删除 短信配置表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(smsService.deleteLogic(Func.toLongList(ids)));
}
/**
* 启用
*/
@PostMapping("/enable")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "配置启用", notes = "传入id")
public R enable(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
CacheUtil.clear(RESOURCE_CACHE);
return R.status(smsService.enable(id));
}
}

@ -54,91 +54,6 @@ public class OssEndpoint {
*/
private final OssBuilder ossBuilder;
/**
* 附件表服务
*/
private final IAttachService attachService;
/**
* 创建存储桶
*
* @param bucketName 存储桶名称
* @return Bucket
*/
@SneakyThrows
@PostMapping("/make-bucket")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R makeBucket(@RequestParam String bucketName) {
ossBuilder.template().makeBucket(bucketName);
return R.success("创建成功");
}
/**
* 创建存储桶
*
* @param bucketName 存储桶名称
* @return R
*/
@SneakyThrows
@PostMapping("/remove-bucket")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R removeBucket(@RequestParam String bucketName) {
ossBuilder.template().removeBucket(bucketName);
return R.success("删除成功");
}
/**
* 拷贝文件
*
* @param fileName 存储桶对象名称
* @param destBucketName 目标存储桶名称
* @param destFileName 目标存储桶对象名称
* @return R
*/
@SneakyThrows
@PostMapping("/copy-file")
public R copyFile(@RequestParam String fileName, @RequestParam String destBucketName, String destFileName) {
ossBuilder.template().copyFile(fileName, destBucketName, destFileName);
return R.success("操作成功");
}
/**
* 获取文件信息
*
* @param fileName 存储桶对象名称
* @return InputStream
*/
@SneakyThrows
@GetMapping("/stat-file")
public R<OssFile> statFile(@RequestParam String fileName) {
return R.data(ossBuilder.template().statFile(fileName));
}
/**
* 获取文件相对路径
*
* @param fileName 存储桶对象名称
* @return String
*/
@SneakyThrows
@GetMapping("/file-path")
public R<String> filePath(@RequestParam String fileName) {
return R.data(ossBuilder.template().filePath(fileName));
}
/**
* 获取文件外链
*
* @param fileName 存储桶对象名称
* @return String
*/
@SneakyThrows
@GetMapping("/file-link")
public R<String> fileLink(@RequestParam String fileName) {
return R.data(ossBuilder.template().fileLink(fileName));
}
/**
* 上传文件
*
@ -148,105 +63,16 @@ public class OssEndpoint {
@SneakyThrows
@PostMapping("/put-file")
public R<BladeFile> putFile(@RequestParam MultipartFile file) {
// 由于部署到服务器会被上传可执行文件, 故此处添加图片格式限制 png, jpeg
String suffix = StringUtils.substringAfterLast(file.getOriginalFilename(), ".");
if (!"png".equals(suffix) && !"jpeg".equals(suffix)) {
return R.fail("上传失败, 文件格式错误!");
}
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
String domain = StringUtils.substringBeforeLast(bladeFile.getDomain(), "/");
bladeFile.setLink(bladeFile.getLink().replace(domain, BusinessConstant.STRING_EMPTY));
return R.data(bladeFile);
}
/**
* 上传文件
*
* @param fileName 存储桶对象名称
* @param file 文件
* @return ObjectStat
*/
@SneakyThrows
@PostMapping("/put-file-by-name")
public R<BladeFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) {
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
return R.data(bladeFile);
}
/**
* 上传文件并保存至附件表
*
* @param file 文件
* @return ObjectStat
*/
@SneakyThrows
@PostMapping("/put-file-attach")
public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
String fileName = file.getOriginalFilename();
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
bladeFile.setAttachId(attachId);
return R.data(bladeFile);
}
/**
* 上传文件并保存至附件表
*
* @param fileName 存储桶对象名称
* @param file 文件
* @return ObjectStat
*/
@SneakyThrows
@PostMapping("/put-file-attach-by-name")
public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
bladeFile.setAttachId(attachId);
return R.data(bladeFile);
}
/**
* 构建附件表
*
* @param fileName 文件名
* @param fileSize 文件大小
* @param bladeFile 对象存储文件
* @return attachId
*/
private Long buildAttach(String fileName, Long fileSize, BladeFile bladeFile) {
String fileExtension = FileUtil.getFileExtension(fileName);
Attach attach = new Attach();
attach.setDomainUrl(bladeFile.getDomain());
attach.setLink(bladeFile.getLink());
attach.setName(bladeFile.getName());
attach.setOriginalName(bladeFile.getOriginalName());
attach.setAttachSize(fileSize);
attach.setExtension(fileExtension);
attachService.save(attach);
return attach.getId();
}
/**
* 删除文件
*
* @param fileName 存储桶对象名称
* @return R
*/
@SneakyThrows
@PostMapping("/remove-file")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R removeFile(@RequestParam String fileName) {
ossBuilder.template().removeFile(fileName);
return R.success("操作成功");
}
/**
* 批量删除文件
*
* @param fileNames 存储桶对象名称集合
* @return R
*/
@SneakyThrows
@PostMapping("/remove-files")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R removeFiles(@RequestParam String fileNames) {
ossBuilder.template().removeFiles(Func.toStrList(fileNames));
return R.success("操作成功");
}
}

@ -1,179 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.resource.endpoint;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.sms.model.SmsCode;
import org.springblade.core.sms.model.SmsData;
import org.springblade.core.sms.model.SmsResponse;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.resource.builder.sms.SmsBuilder;
import org.springblade.modules.resource.utils.SmsUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import static org.springblade.modules.resource.utils.SmsUtil.*;
/**
* 短信服务端点
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_RESOURCE_NAME + "/sms/endpoint")
@Api(value = "短信服务端点", tags = "短信服务端点")
public class SmsEndpoint {
/**
* 短信服务构建类
*/
private final SmsBuilder smsBuilder;
//================================= 短信服务校验 =================================
/**
* 短信验证码发送
*
* @param phone 手机号
*/
@SneakyThrows
@PostMapping("/send-validate")
public R sendValidate(@RequestParam String phone) {
Map<String, String> params = SmsUtil.getValidateParams();
SmsCode smsCode = smsBuilder.template().sendValidate(new SmsData(params).setKey(PARAM_KEY), phone);
return smsCode.isSuccess() ? R.data(smsCode, SEND_SUCCESS) : R.fail(SEND_FAIL);
}
/**
* 校验短信
*
* @param smsCode 短信校验信息
*/
@SneakyThrows
@PostMapping("/validate-message")
public R validateMessage(SmsCode smsCode) {
boolean validate = smsBuilder.template().validateMessage(smsCode);
return validate ? R.success(VALIDATE_SUCCESS) : R.fail(VALIDATE_FAIL);
}
//========== 通用短信自定义发送(支持自定义params参数传递, 推荐用于测试, 不推荐用于生产环境) ==========
/**
* 发送信息
*
* @param code 资源编号
* @param params 自定义短信参数
* @param phones 手机号集合
*/
@SneakyThrows
@PostMapping("/send-message")
public R sendMessage(@RequestParam String code, @RequestParam String params, @RequestParam String phones) {
SmsData smsData = new SmsData(JsonUtil.readMap(params, String.class, String.class));
return send(code, smsData, phones);
}
//========== 指定短信服务发送(可根据各种场景自定拓展定制, 损失灵活性增加安全性, 推荐用于生产环境) ==========
/**
* 短信通知
*
* @param phones 手机号集合
*/
@SneakyThrows
@PostMapping("/send-notice")
public R sendNotice(@RequestParam String phones) {
Map<String, String> params = new HashMap<>(3);
params.put("title", "通知标题");
params.put("content", "通知内容");
params.put("date", "通知时间");
SmsData smsData = new SmsData(params);
return send(smsData, phones);
}
/**
* 订单通知
*
* @param phones 手机号集合
*/
@SneakyThrows
@PostMapping("/send-order")
public R sendOrder(@RequestParam String phones) {
Map<String, String> params = new HashMap<>(3);
params.put("orderNo", "订单编号");
params.put("packageNo", "快递单号");
params.put("user", "收件人");
SmsData smsData = new SmsData(params);
return send(smsData, phones);
}
/**
* 会议通知
*
* @param phones 手机号集合
*/
@SneakyThrows
@PostMapping("/send-meeting")
public R sendMeeting(@RequestParam String phones) {
Map<String, String> params = new HashMap<>(2);
params.put("roomId", "会议室");
params.put("topic", "会议主题");
params.put("date", "会议时间");
SmsData smsData = new SmsData(params);
return send(smsData, phones);
}
//================================= 通用短信发送接口 =================================
/**
* 通用短信发送接口
*
* @param smsData 短信内容
* @param phones 手机号列表
* @return 是否发送成功
*/
private R send(SmsData smsData, String phones) {
SmsResponse response = smsBuilder.template().sendMessage(smsData, Func.toStrList(phones));
return response.isSuccess() ? R.success(SEND_SUCCESS) : R.fail(SEND_FAIL);
}
/**
* 通用短信发送接口
*
* @param code 资源编号
* @param smsData 短信内容
* @param phones 手机号列表
* @return 是否发送成功
*/
private R send(String code, SmsData smsData, String phones) {
SmsResponse response = smsBuilder.template(code).sendMessage(smsData, Func.toStrList(phones));
return response.isSuccess() ? R.success(SEND_SUCCESS) : R.fail(SEND_FAIL);
}
}

@ -175,16 +175,4 @@ public class DeptController extends BladeController {
return R.data(list);
}
/**
* 列表-医院
*/
@PreAuth("")
@GetMapping("/list-hospital")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "列表-医院", notes = "列表-医院")
public R<List<DeptVO>> listHospital() {
List<Dept> list = deptService.list(Wrappers.<Dept>lambdaQuery().eq(Dept::getDeptCategory, BusinessConstant.DEPT_CATEGORY_HOSPITAL));
return R.data(DeptWrapper.build().listNodeVO(list));
}
}

@ -1,108 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.Param;
import org.springblade.modules.system.service.IParamService;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.Map;
import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE;
/**
* 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/param")
@Api(value = "参数管理", tags = "参数管理")
public class ParamController extends BladeController {
private final IParamService paramService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入param")
public R<Param> detail(Param param) {
Param detail = paramService.getOne(Condition.getQueryWrapper(param));
return R.data(detail);
}
/**
* 分页
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "paramName", value = "参数名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "paramKey", value = "参数键名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "paramValue", value = "参数键值", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入param")
public R<IPage<Param>> list(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<Param> pages = paramService.page(Condition.getPage(query), Condition.getQueryWrapper(param, Param.class));
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增或修改", notes = "传入param")
public R submit(@Valid @RequestBody Param param) {
CacheUtil.clear(PARAM_CACHE);
CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
return R.status(paramService.saveOrUpdate(param));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(PARAM_CACHE);
CacheUtil.clear(PARAM_CACHE, Boolean.FALSE);
return R.status(paramService.deleteLogic(Func.toLongList(ids)));
}
}

@ -1,150 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.Post;
import org.springblade.modules.system.service.IPostService;
import org.springblade.modules.system.vo.PostVO;
import org.springblade.modules.system.wrapper.PostWrapper;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
/**
* 岗位表 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/post")
@Api(value = "岗位", tags = "岗位")
public class PostController extends BladeController {
private final IPostService postService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入post")
public R<PostVO> detail(Post post) {
Post detail = postService.getOne(Condition.getQueryWrapper(post));
return R.data(PostWrapper.build().entityVO(detail));
}
/**
* 分页 岗位表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入post")
public R<IPage<PostVO>> list(Post post, Query query) {
IPage<Post> pages = postService.page(Condition.getPage(query), Condition.getQueryWrapper(post));
return R.data(PostWrapper.build().pageVO(pages));
}
/**
* 自定义分页 岗位表
*/
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "分页", notes = "传入post")
public R<IPage<PostVO>> page(PostVO post, Query query) {
IPage<PostVO> pages = postService.selectPostPage(Condition.getPage(query), post);
return R.data(pages);
}
/**
* 新增 岗位表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入post")
public R save(@Valid @RequestBody Post post) {
CacheUtil.clear(SYS_CACHE);
return R.status(postService.save(post));
}
/**
* 修改 岗位表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入post")
public R update(@Valid @RequestBody Post post) {
CacheUtil.clear(SYS_CACHE);
return R.status(postService.updateById(post));
}
/**
* 新增或修改 岗位表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入post")
public R submit(@Valid @RequestBody Post post) {
CacheUtil.clear(SYS_CACHE);
return R.status(postService.saveOrUpdate(post));
}
/**
* 删除 岗位表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(SYS_CACHE);
return R.status(postService.deleteLogic(Func.toLongList(ids)));
}
/**
* 下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "下拉数据源", notes = "传入post")
public R<List<Post>> select(String tenantId, BladeUser bladeUser) {
List<Post> list = postService.list(Wrappers.<Post>query().lambda().eq(Post::getTenantId, Func.toStrWithEmpty(tenantId, bladeUser.getTenantId())));
return R.data(list);
}
}

@ -1,99 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.Post;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IPostService;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.vo.DeptVO;
import org.springblade.modules.system.vo.PostVO;
import org.springblade.modules.system.vo.RoleVO;
import org.springblade.modules.system.wrapper.PostWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 查询控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/search")
@Api(value = "查询", tags = "查询")
public class SearchController {
private final IRoleService roleService;
private final IDeptService deptService;
private final IPostService postService;
/**
* 角色信息查询
*/
@GetMapping("/role")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "角色信息查询", notes = "传入roleName或者parentId")
public R<List<RoleVO>> roleSearch(String roleName, Long parentId) {
return R.data(roleService.search(roleName, parentId));
}
/**
* 部门信息查询
*/
@GetMapping("/dept")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "部门信息查询", notes = "传入deptName或者parentId")
public R<List<DeptVO>> deptSearch(String deptName, Long parentId) {
return R.data(deptService.search(deptName, parentId));
}
/**
* 岗位信息查询
*/
@GetMapping("/post")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "岗位信息查询", notes = "传入postName")
public R<IPage<PostVO>> postSearch(String postName, Query query) {
LambdaQueryWrapper<Post> queryWrapper = Wrappers.<Post>query().lambda();
if (Func.isNotBlank(postName)) {
queryWrapper.like(Post::getPostName, postName);
}
IPage<Post> pages = postService.page(Condition.getPage(query), queryWrapper);
return R.data(PostWrapper.build().pageVO(pages));
}
}

@ -1,233 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.Tenant;
import org.springblade.modules.system.entity.TenantPackage;
import org.springblade.modules.system.service.ITenantPackageService;
import org.springblade.modules.system.service.ITenantService;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static org.springblade.common.cache.SysCache.TENANT_PACKAGE_ID;
import static org.springblade.common.cache.SysCache.TENANT_TENANT_ID;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
import static org.springblade.core.tenant.constant.TenantBaseConstant.TENANT_DATASOURCE_CACHE;
import static org.springblade.core.tenant.constant.TenantBaseConstant.TENANT_DATASOURCE_EXIST_KEY;
/**
* 控制器
*
* @author Chill
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/tenant")
@Api(value = "租户管理", tags = "租户管理")
public class TenantController extends BladeController {
private final ITenantService tenantService;
private final ITenantPackageService tenantPackageService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<Tenant> detail(Tenant tenant) {
Tenant detail = tenantService.getOne(Condition.getQueryWrapper(tenant));
return R.data(detail);
}
/**
* 分页
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantId", value = "参数名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "tenantName", value = "角色别名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "contactNumber", value = "联系电话", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<IPage<Tenant>> list(@ApiIgnore @RequestParam Map<String, Object> tenant, Query query, BladeUser bladeUser) {
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant, Tenant.class);
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), (!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Tenant::getTenantId, bladeUser.getTenantId()) : queryWrapper);
return R.data(pages);
}
/**
* 下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "下拉数据源", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<List<Tenant>> select(Tenant tenant, BladeUser bladeUser) {
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant);
List<Tenant> list = tenantService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Tenant::getTenantId, bladeUser.getTenantId()) : queryWrapper);
return R.data(list);
}
/**
* 自定义分页
*/
@GetMapping("/page")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "分页", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<IPage<Tenant>> page(Tenant tenant, Query query) {
IPage<Tenant> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant);
return R.data(pages);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增或修改", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public R submit(@Valid @RequestBody Tenant tenant) {
return R.status(tenantService.submitTenant(tenant));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.removeTenant(Func.toLongList(ids)));
}
/**
* 授权配置
*/
@PostMapping("/setting")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "授权配置", notes = "传入ids,accountNumber,expireTime")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public R setting(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @ApiParam(value = "账号额度") Integer accountNumber, @ApiParam(value = "过期时间") Date expireTime) {
return R.status(tenantService.setting(accountNumber, expireTime, ids));
}
/**
* 数据源配置
*/
@PostMapping("datasource")
@ApiOperationSupport(order = 8)
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "数据源配置", notes = "传入datasource_id")
public R datasource(@ApiParam(value = "租户ID", required = true) @RequestParam String tenantId, @ApiParam(value = "数据源ID", required = true) @RequestParam Long datasourceId) {
CacheUtil.evict(TENANT_DATASOURCE_CACHE, TENANT_DATASOURCE_EXIST_KEY, tenantId, Boolean.FALSE);
return R.status(tenantService.update(Wrappers.<Tenant>update().lambda().set(Tenant::getDatasourceId, datasourceId).eq(Tenant::getTenantId, tenantId)));
}
/**
* 根据名称查询列表
*
* @param name 租户名称
*/
@GetMapping("/find-by-name")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "详情", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<List<Tenant>> findByName(String name) {
List<Tenant> list = tenantService.list(Wrappers.<Tenant>query().lambda().like(Tenant::getTenantName, name));
return R.data(list);
}
/**
* 根据域名查询信息
*
* @param domain 域名
*/
@GetMapping("/info")
@ApiOperationSupport(order = 10)
@ApiOperation(value = "配置信息", notes = "传入domain")
public R<Kv> info(String domain) {
Tenant tenant = tenantService.getOne(Wrappers.<Tenant>query().lambda().eq(Tenant::getDomainUrl, domain));
Kv kv = Kv.create();
if (tenant != null) {
kv.set("tenantId", tenant.getTenantId())
.set("domain", tenant.getDomainUrl())
.set("backgroundUrl", tenant.getBackgroundUrl());
}
return R.data(kv);
}
/**
* 根据租户ID查询产品包详情
*
* @param tenantId 租户ID
*/
@GetMapping("/package-detail")
@ApiOperationSupport(order = 11)
@ApiOperation(value = "产品包详情", notes = "传入tenantId")
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
public R<TenantPackage> packageDetail(Long tenantId) {
Tenant tenant = tenantService.getById(tenantId);
return R.data(tenantPackageService.getById(tenant.getPackageId()));
}
/**
* 产品包配置
*/
@PostMapping("/package-setting")
@ApiOperationSupport(order = 12)
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "产品包配置", notes = "传入packageId")
public R packageSetting(@ApiParam(value = "租户ID", required = true) @RequestParam String tenantId, @ApiParam(value = "产品包ID") Long packageId) {
CacheUtil.evict(SYS_CACHE, TENANT_TENANT_ID, tenantId, Boolean.FALSE);
CacheUtil.evict(SYS_CACHE, TENANT_PACKAGE_ID, tenantId, Boolean.FALSE);
return R.status(tenantService.update(Wrappers.<Tenant>update().lambda().set(Tenant::getPackageId, packageId).eq(Tenant::getTenantId, tenantId)));
}
}

@ -1,134 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.TenantPackage;
import org.springblade.modules.system.service.ITenantPackageService;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
/**
* 租户产品表 控制器
*
* @author BladeX
*/
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/tenant-package")
@Api(value = "租户产品表", tags = "租户产品表接口")
public class TenantPackageController extends BladeController {
private final ITenantPackageService tenantPackageService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入tenantPackage")
public R<TenantPackage> detail(TenantPackage tenantPackage) {
TenantPackage detail = tenantPackageService.getOne(Condition.getQueryWrapper(tenantPackage));
return R.data(detail);
}
/**
* 分页 租户产品表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入tenantPackage")
public R<IPage<TenantPackage>> list(TenantPackage tenantPackage, Query query) {
IPage<TenantPackage> pages = tenantPackageService.page(Condition.getPage(query), Condition.getQueryWrapper(tenantPackage));
return R.data(pages);
}
/**
* 新增 租户产品表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "新增", notes = "传入tenantPackage")
public R save(@Valid @RequestBody TenantPackage tenantPackage) {
return R.status(tenantPackageService.save(tenantPackage));
}
/**
* 修改 租户产品表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "修改", notes = "传入tenantPackage")
public R update(@Valid @RequestBody TenantPackage tenantPackage) {
return R.status(tenantPackageService.updateById(tenantPackage));
}
/**
* 新增或修改 租户产品表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "新增或修改", notes = "传入tenantPackage")
public R submit(@Valid @RequestBody TenantPackage tenantPackage) {
CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
return R.status(tenantPackageService.saveOrUpdate(tenantPackage));
}
/**
* 删除 租户产品表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
return R.status(tenantPackageService.deleteLogic(Func.toLongList(ids)));
}
/**
* 下拉数据源
*/
@GetMapping("/select")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "下拉数据源", notes = "传入tenant")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R<List<TenantPackage>> select(TenantPackage tenantPackage) {
return R.data(tenantPackageService.list(Condition.getQueryWrapper(tenantPackage)));
}
}

@ -1,137 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package org.springblade.modules.system.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.system.entity.TopMenu;
import org.springblade.modules.system.service.ITopMenuService;
import org.springblade.modules.system.vo.GrantVO;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import static org.springblade.core.cache.constant.CacheConstant.MENU_CACHE;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
/**
* 顶部菜单表 控制器
*
* @author BladeX
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/topmenu")
@Api(value = "顶部菜单表", tags = "顶部菜单")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class TopMenuController extends BladeController {
private final ITopMenuService topMenuService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入topMenu")
public R<TopMenu> detail(TopMenu topMenu) {
TopMenu detail = topMenuService.getOne(Condition.getQueryWrapper(topMenu));
return R.data(detail);
}
/**
* 分页 顶部菜单表
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入topMenu")
public R<IPage<TopMenu>> list(TopMenu topMenu, Query query) {
IPage<TopMenu> pages = topMenuService.page(Condition.getPage(query), Condition.getQueryWrapper(topMenu).lambda().orderByAsc(TopMenu::getSort));
return R.data(pages);
}
/**
* 新增 顶部菜单表
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入topMenu")
public R save(@Valid @RequestBody TopMenu topMenu) {
return R.status(topMenuService.save(topMenu));
}
/**
* 修改 顶部菜单表
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入topMenu")
public R update(@Valid @RequestBody TopMenu topMenu) {
return R.status(topMenuService.updateById(topMenu));
}
/**
* 新增或修改 顶部菜单表
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入topMenu")
public R submit(@Valid @RequestBody TopMenu topMenu) {
return R.status(topMenuService.saveOrUpdate(topMenu));
}
/**
* 删除 顶部菜单表
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(topMenuService.deleteLogic(Func.toLongList(ids)));
}
/**
* 设置顶部菜单
*/
@PostMapping("/grant")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "顶部菜单配置", notes = "传入topMenuId集合以及menuId集合")
public R grant(@RequestBody GrantVO grantVO) {
CacheUtil.clear(SYS_CACHE);
CacheUtil.clear(MENU_CACHE);
CacheUtil.clear(MENU_CACHE, Boolean.FALSE);
boolean temp = topMenuService.grant(grantVO.getTopMenuIds(), grantVO.getMenuIds());
return R.status(temp);
}
}

@ -120,6 +120,8 @@ blade:
token:
#是否有状态
state: false
# 令牌签名
sign-key: QdscgsASDFQWERZXZCVHYGTNBJIOLKMUPabc123defghijkmalnopteqrstzuvwxhgrzy345
#redis序列化方式
redis:
serializer-type: protostuff
@ -141,49 +143,19 @@ blade:
big-num-to-string: true
#支持text文本请求,与报文加密同时开启
support-text-plain: false
#xss配置
# xss:
# enabled: true
# skip-url:
# - /blade-chat/weixin
# - /blade-desk/notice/submit
#安全框架配置
secure:
#接口放行
skip-url:
- /blade-test/**
- /blade-business/**
- /blade-system/**
# #授权认证配置
# auth:
# - method: ALL
# pattern: /blade-chat/weixin/**
# expression: "hasAuth()"
# - method: POST
# pattern: /blade-desk/dashboard/upload
# expression: "hasTimeAuth(9, 17)"
# - method: POST
# pattern: /blade-desk/dashboard/submit
# expression: "hasAnyRole('administrator', 'admin', 'user')"
# #基础认证配置
# basic:
# - method: ALL
# pattern: /blade-desk/dashboard/info
# username: "blade"
# password: "blade"
# #动态签名认证配置
# sign:
# - method: ALL
# pattern: /blade-desk/dashboard/sign
# crypto: "sha1"
# #多终端认证配置
# client:
# - client-id: sword
# path-patterns:
# - /blade-sword/**
# - client-id: saber
# path-patterns:
# - /blade-saber/**
- /blade-system/dept-hospital/list-hospital
- /blade-business/article/detail-publish
- /blade-business/blacklist/user-blacklist
- /blade-business/apm-config/already-config-day
- /blade-business/apm-config/detail-for-apm
- /blade-business/apm-record/save
- /blade-business/apm-record/page
- /blade-business/apm-record/cancel
- /blade-business/common-api/get-system-datetime
#多租户配置
tenant:
#多租户增强

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Loading…
Cancel
Save