新增复制模块方法
This commit is contained in:
parent
27e3e5354d
commit
9d9ca6f137
@ -1,5 +1,6 @@
|
||||
package io.gisbi.application.module.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -49,6 +50,35 @@ public class ModuleController {
|
||||
return ResponseResult.successData(moduleService.createModule(module));
|
||||
}
|
||||
|
||||
// 复制模块
|
||||
@PostMapping("/copy/{id}")
|
||||
public ResponseResult copy(@PathVariable String id) {
|
||||
LambdaQueryWrapper<Module> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Module::getId, id);
|
||||
Map<String, Object> moduleMap = moduleService.getMap(wrapper);
|
||||
|
||||
if (moduleMap == null || moduleMap.isEmpty()) {
|
||||
return ResponseResult.error("模块不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
Module module = BeanUtil.toBean(moduleMap, Module.class);
|
||||
module.setId(null);
|
||||
module.setCreateTime(LocalDateTime.now());
|
||||
module.setCreateBy(AuthUtils.getUser().getUserId().toString());
|
||||
|
||||
boolean result = moduleService.createModule(module);
|
||||
if (result) {
|
||||
return ResponseResult.success("模块复制成功");
|
||||
} else {
|
||||
return ResponseResult.error("模块复制失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.error("复制模块失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 修改模块
|
||||
@PostMapping("/update")
|
||||
public ResponseResult update(@RequestBody Module module) {
|
||||
|
@ -34,7 +34,7 @@ import java.util.Map;
|
||||
@RequestMapping("/staticResource")
|
||||
public class StaticResourceServer implements StaticResourceApi {
|
||||
|
||||
@Value("${gisbi.path.static-resource:/opt/gisbi2.0/data/static-resource/}")
|
||||
@Value("${gisbi.path.static-resource:E:/opt/gisbi2.0/data/static-resource/}")
|
||||
private String staticDir;
|
||||
|
||||
@Override
|
||||
|
@ -36,9 +36,9 @@ logging:
|
||||
file:
|
||||
path: /opt/gisbi2.0/logs
|
||||
# sql日志生产环境注释掉
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
#mybatis-plus:
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
quartz:
|
||||
enabled: true
|
||||
|
Loading…
Reference in New Issue
Block a user