fix_系统设置_插件管理_搜索失效--bug=1006713 --user=王孝刚 【插件管理】搜索不生效 https://www.tapd.cn/55049933/s/1048283
This commit is contained in:
parent
fddaebdef6
commit
4d71617279
|
@ -27,8 +27,8 @@ public class PluginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public List<PluginDTO> list() {
|
public List<PluginDTO> list(String name) {
|
||||||
return pluginService.list();
|
return pluginService.list(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/get/{id}")
|
||||||
|
|
|
@ -150,30 +150,41 @@ public class PluginService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PluginDTO> list() {
|
public List<PluginDTO> list(String name) {
|
||||||
PluginExample example = new PluginExample();
|
try {
|
||||||
List<Plugin> plugins = pluginMapper.selectByExample(example);
|
PluginExample example = new PluginExample();
|
||||||
Map<String, Boolean> pluginMap = new HashMap<>();
|
if (StringUtils.isNotBlank(name)) {
|
||||||
List<PluginDTO> lists = new LinkedList<>();
|
name = "%" + name + "%";
|
||||||
// 校验插件是否是企业版
|
example.createCriteria().andNameLike(name);
|
||||||
plugins.forEach(item -> {
|
|
||||||
PluginDTO dto = new PluginDTO();
|
|
||||||
BeanUtils.copyBean(dto, item);
|
|
||||||
if (!pluginMap.containsKey(item.getPluginId())) {
|
|
||||||
try {
|
|
||||||
Class<?> clazz = Class.forName(item.getExecEntry());
|
|
||||||
Object instance = clazz.newInstance();
|
|
||||||
dto.setLicense(this.isXpack(Class.forName(item.getExecEntry()), instance));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtil.error(e.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dto.setLicense(pluginMap.get(item.getPluginId()));
|
|
||||||
}
|
}
|
||||||
lists.add(dto);
|
List<Plugin> plugins = pluginMapper.selectByExample(example);
|
||||||
pluginMap.put(item.getPluginId(), dto.getLicense());
|
Map<String, Boolean> pluginMap = new HashMap<>();
|
||||||
});
|
List<PluginDTO> lists = new LinkedList<>();
|
||||||
return lists;
|
if (CollectionUtils.isNotEmpty(plugins)) {
|
||||||
|
// 校验插件是否是企业版
|
||||||
|
plugins.forEach(item -> {
|
||||||
|
PluginDTO dto = new PluginDTO();
|
||||||
|
BeanUtils.copyBean(dto, item);
|
||||||
|
if (!pluginMap.containsKey(item.getPluginId())) {
|
||||||
|
try {
|
||||||
|
Class<?> clazz = Class.forName(item.getExecEntry());
|
||||||
|
Object instance = clazz.newInstance();
|
||||||
|
dto.setLicense(this.isXpack(Class.forName(item.getExecEntry()), instance));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dto.setLicense(pluginMap.get(item.getPluginId()));
|
||||||
|
}
|
||||||
|
lists.add(dto);
|
||||||
|
pluginMap.put(item.getPluginId(), dto.getLicense());
|
||||||
|
});
|
||||||
|
return lists;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin get(String scriptId) {
|
public Plugin get(String scriptId) {
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
<ms-table-header
|
<ms-table-header
|
||||||
:showCreate="false"
|
:showCreate="false"
|
||||||
:create-permission="['SYSTEM_USER:READ+CREATE']"
|
:create-permission="['SYSTEM_USER:READ+CREATE']"
|
||||||
:condition.sync="condition" @search="search"
|
:condition.sync="condition"
|
||||||
:import-tip="$t('test_track.case.import.click_upload')"
|
:import-tip="$t('test_track.case.import.click_upload')"
|
||||||
:tip="$t('commons.search_by_name_or_id')"
|
:tip="$t('commons.search_by_name_or_id')"
|
||||||
:create-tip="$t('user.create')"
|
:create-tip="$t('user.create')"
|
||||||
:title="$t('plugin.title')"
|
:title="$t('plugin.title')"
|
||||||
|
@search="initPlugins"
|
||||||
@import="importJar"
|
@import="importJar"
|
||||||
:show-import="true"/>
|
:show-import="true"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -87,14 +88,15 @@ export default {
|
||||||
this.initPlugins();
|
this.initPlugins();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
search() {
|
|
||||||
|
|
||||||
},
|
|
||||||
importJar() {
|
importJar() {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
initPlugins() {
|
initPlugins() {
|
||||||
let url = "/plugin/list";
|
let url = "/plugin/list";
|
||||||
|
let name = this.condition.name;
|
||||||
|
if (name) {
|
||||||
|
url = "/plugin/list?name=" +name;
|
||||||
|
}
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
this.$get(url, response => {
|
this.$get(url, response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
|
Loading…
Reference in New Issue