refactor:去除无用代码

This commit is contained in:
wangjiahao 2021-08-17 14:40:01 +08:00
parent 24ed0baeb2
commit 81a84a54e3
5 changed files with 0 additions and 332 deletions

View File

@ -1,4 +0,0 @@
package io.dataease.base.mapper.ext;
public interface ExtBaseMapper {
}

View File

@ -1,59 +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="io.dataease.base.mapper.ext.ExtBaseMapper">
<sql id="orders">
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
${order.name} ${order.type}
</foreach>
</if>
</sql>
<sql id="condition">
<choose>
<when test='${object}.operator == "like"'>
like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "not like"'>
not like CONCAT('%', #{${object}.value},'%')
</when>
<when test='${object}.operator == "in"'>
in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "not in"'>
not in
<foreach collection="${object}.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test='${object}.operator == "between"'>
between #{${object}.value[0]} and #{${object}.value[1]}
</when>
<when test='${object}.operator == "gt"'>
&gt; #{${object}.value}
</when>
<when test='${object}.operator == "lt"'>
&lt; #{${object}.value}
</when>
<when test='${object}.operator == "ge"'>
&gt;= #{${object}.value}
</when>
<when test='${object}.operator == "le"'>
&lt;= #{${object}.value}
</when>
<when test='${object}.operator == "current user"'>
= '${@io.metersphere.commons.utils.SessionUtils@getUserId()}'
</when>
<otherwise>
= #{${object}.value}
</otherwise>
</choose>
</sql>
</mapper>

View File

@ -1,34 +0,0 @@
package io.dataease.commons.utils;
import io.dataease.commons.exception.DEException;
import io.dataease.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils;
import org.aspectj.util.FileUtil;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.List;
public class FileUtils {
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
public static void createBodyFiles(List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
if (CollectionUtils.isNotEmpty(bodyUploadIds) && CollectionUtils.isNotEmpty(bodyFiles)) {
File testDir = new File(BODY_FILE_DIR);
if (!testDir.exists()) {
testDir.mkdirs();
}
for (int i = 0; i < bodyUploadIds.size(); i++) {
MultipartFile item = bodyFiles.get(i);
File file = new File(BODY_FILE_DIR + "/" + bodyUploadIds.get(i) + "_" + item.getOriginalFilename());
try (InputStream in = item.getInputStream(); OutputStream out = new FileOutputStream(file)) {
file.createNewFile();
FileUtil.copyStream(in, out);
} catch (IOException e) {
LogUtil.error(e);
DEException.throwException(Translator.get("upload_fail"));
}
}
}
}
}

View File

@ -10,7 +10,6 @@
@import '~umy-ui/lib/theme-chalk/index.css';
// 引入样式
@import './deicon/iconfont.css';
// @import '../metersphere/common/css/index.css';
body {

View File

@ -1,234 +0,0 @@
<template>
<div v-loading="result.loading">
<el-form ref="form" :model="form" size="small" :rules="rules" :disabled="show">
<el-form-item :label="$t('ldap.url')" prop="url">
<el-input v-model="form.url" :placeholder="$t('ldap.input_url_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.dn')" prop="dn">
<el-input v-model="form.dn" :placeholder="$t('ldap.input_dn')" />
</el-form-item>
<el-form-item :label="$t('ldap.password')" prop="password">
<el-input
v-model="form.password"
:placeholder="$t('ldap.input_password')"
show-password
auto-complete="new-password"
/>
</el-form-item>
<el-form-item :label="$t('ldap.ou')" prop="ou">
<el-input v-model="form.ou" :placeholder="$t('ldap.input_ou_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.filter')" prop="filter">
<el-input v-model="form.filter" :placeholder="$t('ldap.input_filter_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.mapping')" prop="mapping">
<el-input v-model="form.mapping" :placeholder="$t('ldap.input_mapping_placeholder')" />
</el-form-item>
<el-form-item :label="$t('ldap.open')" prop="open">
<el-checkbox v-model="form.open" />
</el-form-item>
</el-form>
<div>
<el-button type="primary" size="small" :disabled="!show" @click="testConnection">{{ $t('ldap.test_connect') }}
</el-button>
<el-button type="primary" size="small" :disabled="!showLogin || !show" @click="testLogin">
{{ $t('ldap.test_login') }}
</el-button>
<el-button v-if="showEdit" size="small" @click="edit">{{ $t('ldap.edit') }}</el-button>
<el-button v-if="showSave" type="success" size="small" @click="save('form')">{{ $t('commons.save') }}
</el-button>
<el-button v-if="showCancel" type="info" size="small" @click="cancel">{{ $t('commons.cancel') }}</el-button>
</div>
<el-dialog
v-loading="result.loading"
:title="$t('ldap.test_login')"
:visible.sync="loginVisible"
width="30%"
destroy-on-close
@close="close"
>
<el-form ref="loginForm" :model="loginForm" :rules="loginFormRules" label-width="90px">
<el-form-item :label="$t('commons.username')" prop="username">
<el-input v-model="loginForm.username" autocomplete="off" :placeholder="$t('ldap.input_username')" />
</el-form-item>
<el-form-item :label="$t('commons.password')" prop="password">
<el-input
v-model="loginForm.password"
autocomplete="new-password"
:placeholder="$t('ldap.input_password')"
show-password
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="loginVisible = false">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="login('loginForm')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import MsDialogFooter from '@/metersphere/common/components/MsDialogFooter'
// import { listenGoBack, removeGoBackListener } from '@/metersphere/common/js/utils'
export default {
name: 'LdapSetting',
components: {
},
data() {
return {
form: { open: false },
loginForm: {},
result: {},
show: true,
showEdit: true,
showSave: false,
showCancel: false,
showLogin: false,
loginVisible: false,
rules: {
url: { required: true, message: this.$t('ldap.input_url'), trigger: ['change', 'blur'] },
dn: { required: true, message: this.$t('ldap.input_dn'), trigger: ['change', 'blur'] },
password: { required: true, message: this.$t('ldap.input_password'), trigger: ['change', 'blur'] },
ou: { required: true, message: this.$t('ldap.input_ou'), trigger: ['change', 'blur'] },
filter: { required: true, message: this.$t('ldap.input_filter'), trigger: ['change', 'blur'] },
mapping: { required: true, message: this.$t('ldap.input_mapping'), trigger: ['change', 'blur'] }
},
loginFormRules: {
username: { required: true, message: this.$t('ldap.input_username'), trigger: 'blur' },
password: { required: true, message: this.$t('ldap.input_password'), trigger: 'blur' }
}
}
},
created() {
this.init()
},
methods: {
init() {
this.result = this.$get('/system/ldap/info', response => {
this.form = response.data
this.form.open = this.form.open === 'true'
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
})
},
edit() {
this.show = false
this.showEdit = false
this.showSave = true
this.showCancel = true
},
cancel() {
this.showEdit = true
this.showCancel = false
this.showSave = false
this.show = true
this.init()
},
close() {
this.loginVisible = false
},
testConnection() {
if (!this.checkParam()) {
return false
}
this.result = this.$post('/ldap/test/connect', this.form, () => {
this.$success(this.$t('commons.connection_successful'))
this.showLogin = true
}, () => {
this.showLogin = false
})
},
testLogin() {
if (!this.checkParam()) {
return false
}
if (!this.form.ou) {
this.$warning(this.$t('ldap.ou_cannot_be_empty'))
return false
}
if (!this.form.filter) {
this.$warning(this.$t('ldap.filter_cannot_be_empty'))
return false
}
if (!this.form.mapping) {
this.$warning(this.$t('ldap.mapping_cannot_be_empty'))
return false
}
this.loginForm = {}
this.loginVisible = true
},
checkParam() {
if (!this.form.url) {
this.$warning(this.$t('ldap.url_cannot_be_empty'))
return false
}
if (!this.form.dn) {
this.$warning(this.$t('ldap.dn_cannot_be_empty'))
return false
}
if (!this.form.password) {
this.$warning(this.$t('ldap.password_cannot_be_empty'))
return false
}
return true
},
save(form) {
const param = [
{ paramKey: 'ldap.url', paramValue: this.form.url, type: 'text', sort: 1 },
{ paramKey: 'ldap.dn', paramValue: this.form.dn, type: 'text', sort: 2 },
{ paramKey: 'ldap.password', paramValue: this.form.password, type: 'password', sort: 3 },
{ paramKey: 'ldap.ou', paramValue: this.form.ou, type: 'text', sort: 4 },
{ paramKey: 'ldap.filter', paramValue: this.form.filter, type: 'text', sort: 5 },
{ paramKey: 'ldap.mapping', paramValue: this.form.mapping, type: 'text', sort: 6 },
{ paramKey: 'ldap.open', paramValue: this.form.open, type: 'text', sort: 7 }
]
this.$refs[form].validate(valid => {
if (valid) {
this.result = this.$post('/system/save/ldap', param, () => {
this.show = true
this.showEdit = true
this.showSave = false
this.showCancel = false
this.showLogin = false
this.$success(this.$t('commons.save_success'))
this.init()
})
} else {
return false
}
})
},
login(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.result = this.$post('/ldap/test/login', this.loginForm, () => {
this.$success(this.$t('ldap.login_success'))
})
} else {
return false
}
})
}
}
}
</script>
<style scoped>
</style>