Merge branch 'master' of http://222.71.165.188:3000/yunxi/jigangSCM2
commit
2c1310fdbd
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,241 @@
|
||||
package jnpf.util;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import jnpf.database.model.superQuery.SuperJsonModel;
|
||||
import jnpf.database.model.superQuery.SuperQueryJsonModel;
|
||||
import jnpf.emnus.SearchMethodEnum;
|
||||
import jnpf.model.QueryModel;
|
||||
import jnpf.model.visualJson.FieLdsModel;
|
||||
import jnpf.model.visualJson.config.ConfigModel;
|
||||
import jnpf.util.visiual.JnpfKeyConsts;
|
||||
import lombok.Data;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QueryUtil2 {
|
||||
|
||||
/**
|
||||
* 运算符
|
||||
*/
|
||||
private SearchMethodEnum symbol;
|
||||
/**
|
||||
* 逻辑拼接符号
|
||||
*/
|
||||
private boolean and;
|
||||
/**
|
||||
* 组件标识
|
||||
*/
|
||||
private String jnpfKey;
|
||||
/**
|
||||
* 字段key
|
||||
*/
|
||||
private String vModel;
|
||||
/**
|
||||
* 自定义的值
|
||||
*/
|
||||
private Object fieldValue;
|
||||
/**
|
||||
* 自定义的值2
|
||||
*/
|
||||
private Object fieldValueTwo;
|
||||
|
||||
/**
|
||||
* 数据库类型
|
||||
*/
|
||||
private String dbType;
|
||||
|
||||
private List<String> dataList = new ArrayList<>();
|
||||
|
||||
//搜索逻辑
|
||||
public <T> QueryWrapper<T> queryList(QueryModel queryModel) {
|
||||
QueryWrapper<T> queryWrapper = queryModel.getObj();
|
||||
Class entity = queryModel.getEntity();
|
||||
dbType = queryModel.getDbType();
|
||||
String queryJson = queryModel.getQueryJson();
|
||||
List<SuperJsonModel> superJsonModelList = JsonUtil.getJsonToList(queryJson, SuperJsonModel.class);
|
||||
for (SuperJsonModel superJsonModel : superJsonModelList) {
|
||||
String matchLogic = superJsonModel.getMatchLogic();
|
||||
Boolean authorizeLogic = superJsonModel.getAuthorizeLogic();
|
||||
boolean isAddMatchLogic = SearchMethodEnum.And.getSymbol().equalsIgnoreCase(matchLogic);
|
||||
List<SuperQueryJsonModel> conditionList = superJsonModel.getConditionList();
|
||||
if (conditionList.size() == 0) continue;
|
||||
queryWrapper.and(gw -> {
|
||||
if (authorizeLogic) {
|
||||
gw.and(tw -> {
|
||||
queryWrapperList(entity, tw, conditionList, isAddMatchLogic);
|
||||
});
|
||||
} else {
|
||||
gw.or(tw -> {
|
||||
queryWrapperList(entity, tw, conditionList, isAddMatchLogic);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private <T> void queryWrapperList(Class entity, QueryWrapper<T> tw, List<SuperQueryJsonModel> conditionList, boolean isAddMatchLogic) {
|
||||
for (SuperQueryJsonModel superQueryJsonModel : conditionList) {
|
||||
String logic = superQueryJsonModel.getLogic();
|
||||
and = SearchMethodEnum.And.getSymbol().equalsIgnoreCase(logic);
|
||||
List<FieLdsModel> queryList = superQueryJsonModel.getGroups();
|
||||
queryWrapper(entity, tw, queryList, isAddMatchLogic);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void queryWrapper(Class entity, QueryWrapper<T> tw, List<FieLdsModel> queryListAll, boolean isAnd) {
|
||||
if (isAnd) {
|
||||
tw.and(qw -> {
|
||||
query(entity, qw, queryListAll);
|
||||
});
|
||||
} else {
|
||||
tw.or(qw -> {
|
||||
query(entity, qw, queryListAll);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void query(Class entity, QueryWrapper<T> qw, List<FieLdsModel> queryListAll) {
|
||||
for (FieLdsModel fieLdsModel : queryListAll) {
|
||||
List<FieLdsModel> queryList = new ArrayList() {{
|
||||
add(fieLdsModel);
|
||||
}};
|
||||
if (and) {
|
||||
qw.and(ew -> {
|
||||
fieldsModel(ew, queryList, entity);
|
||||
});
|
||||
} else {
|
||||
qw.or(ew -> {
|
||||
fieldsModel(ew, queryList, entity);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fieldsModel(QueryWrapper wrapper, List<FieLdsModel> queryList, Class entity) {
|
||||
for (FieLdsModel fieLdsModel : queryList) {
|
||||
ConfigModel config = fieLdsModel.getConfig();
|
||||
jnpfKey = config.getJnpfKey();
|
||||
symbol = SearchMethodEnum.getSearchMethod(fieLdsModel.getSymbol());
|
||||
vModel = "a." + fieLdsModel.getVModel();
|
||||
if (!and) {
|
||||
wrapper.or();
|
||||
}
|
||||
try {
|
||||
Field declaredField = entity.getDeclaredField(vModel);
|
||||
declaredField.setAccessible(true);
|
||||
vModel = declaredField.getAnnotation(TableField.class).value();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
fieldValue = fieLdsModel.getFieldValueOne();
|
||||
fieldValueTwo = fieLdsModel.getFieldValueTwo();
|
||||
dataList = fieLdsModel.getDataList();
|
||||
if(JnpfKeyConsts.DateSelect.contains(fieLdsModel.getConfig().getJnpfKey())){
|
||||
if(ObjectUtils.isNotEmpty(fieLdsModel.getFieldValueOne())){
|
||||
fieldValue = new Date(Long.valueOf(fieLdsModel.getFieldValueOne().toString()));
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(fieLdsModel.getFieldValueTwo())){
|
||||
fieldValueTwo = new Date(Long.valueOf(fieLdsModel.getFieldValueTwo().toString()));
|
||||
}
|
||||
}
|
||||
getSymbolWrapper(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
private void getNullWrapper(QueryWrapper<?> wrapper) {
|
||||
if (!and) {
|
||||
wrapper.or(t -> t.isNull(vModel));
|
||||
} else {
|
||||
wrapper.and(t -> t.isNull(vModel));
|
||||
}
|
||||
}
|
||||
|
||||
private void getNotNullWrapper(QueryWrapper<?> wrapper) {
|
||||
if (!and) {
|
||||
wrapper.or(t -> t.isNotNull(vModel));
|
||||
} else {
|
||||
wrapper.and(t -> t.isNotNull(vModel));
|
||||
}
|
||||
}
|
||||
|
||||
private void getInWrapper(QueryWrapper<?> wrapper) {
|
||||
if (!and) {
|
||||
wrapper.or(qw -> {
|
||||
for (String id : dataList) {
|
||||
switch (symbol) {
|
||||
case Included:
|
||||
qw.or().like(vModel, id);
|
||||
break;
|
||||
default:
|
||||
qw.notLike(vModel, id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wrapper.and(qw -> {
|
||||
for (String id : dataList) {
|
||||
switch (symbol) {
|
||||
case Included:
|
||||
qw.or().like(vModel, id);
|
||||
break;
|
||||
default:
|
||||
qw.notLike(vModel, id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void getSymbolWrapper(QueryWrapper<?> wrapper) {
|
||||
switch (symbol) {
|
||||
case IsNull:
|
||||
getNullWrapper(wrapper);
|
||||
break;
|
||||
case IsNotNull:
|
||||
getNotNullWrapper(wrapper);
|
||||
break;
|
||||
case Equal:
|
||||
wrapper.eq(vModel, fieldValue);
|
||||
break;
|
||||
case NotEqual:
|
||||
wrapper.ne(vModel, fieldValue);
|
||||
break;
|
||||
case GreaterThan:
|
||||
wrapper.gt(vModel, fieldValue);
|
||||
break;
|
||||
case LessThan:
|
||||
wrapper.lt(vModel, fieldValue);
|
||||
break;
|
||||
case GreaterThanOrEqual:
|
||||
wrapper.ge(vModel, fieldValue);
|
||||
break;
|
||||
case LessThanOrEqual:
|
||||
wrapper.le(vModel, fieldValue);
|
||||
break;
|
||||
case Like:
|
||||
wrapper.like(vModel, fieldValue);
|
||||
break;
|
||||
case NotLike:
|
||||
wrapper.notLike(vModel, fieldValue);
|
||||
break;
|
||||
case Included:
|
||||
case NotIncluded:
|
||||
getInWrapper(wrapper);
|
||||
break;
|
||||
case Between:
|
||||
wrapper.between(vModel, fieldValue, fieldValueTwo);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,176 +1,174 @@
|
||||
<template>
|
||||
<el-dialog title="详情"
|
||||
:close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||
width="1000px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
|
||||
<template v-if="!loading">
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="联系人头像"
|
||||
prop="logo" >
|
||||
<JnpfUploadImg v-model="dataForm.logo"
|
||||
disabled
|
||||
detailed :fileSize="10" sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0" >
|
||||
</JnpfUploadImg>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="联系人类型"
|
||||
prop="contactsType" >
|
||||
<p>{{ dataForm.contactsType }} </p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="关联客户"
|
||||
prop="subjectBasicId" >
|
||||
<p>{{dataForm.subjectBasicId}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="姓名"
|
||||
prop="name" >
|
||||
<p>{{dataForm.name}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="职务"
|
||||
prop="position" >
|
||||
<p>{{dataForm.position}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="公司"
|
||||
prop="companyName" >
|
||||
<p>{{dataForm.companyName}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="手机"
|
||||
prop="mobile" >
|
||||
<p>{{dataForm.mobile}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="电话"
|
||||
prop="phone" >
|
||||
<p>{{dataForm.phone}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="邮箱"
|
||||
prop="emaile" >
|
||||
<p>{{dataForm.emaile}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="地址"
|
||||
prop="address" >
|
||||
<p>{{dataForm.address}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="是否星标"
|
||||
prop="markColor" >
|
||||
<p>{{dataForm.markColor}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<jnpf-form-tip-item label="附件"
|
||||
prop="annex" >
|
||||
<JnpfUploadFile v-model="dataForm.annex"
|
||||
disabled
|
||||
detailed :fileSize="10" sizeUnit="MB" :limit="9" pathType="defaultPath" :isAccount="0" buttonText="点击上传" >
|
||||
</JnpfUploadFile>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
<el-dialog title="详情" :close-on-click-modal="false" append-to-body :visible.sync="visible"
|
||||
class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1000px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="联系人头像" prop="logo">
|
||||
<JnpfUploadImg v-model="dataForm.logo" disabled detailed :fileSize="10" sizeUnit="MB" :limit="1"
|
||||
pathType="defaultPath" :isAccount="0">
|
||||
</JnpfUploadImg>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="联系人类型" prop="contactsType">
|
||||
<p>{{ dataForm.contactsType }} </p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="关联客户" prop="subjectBasicId">
|
||||
<p>{{dataForm.subjectBasicId}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="姓名" prop="name">
|
||||
<p>{{dataForm.name}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="职务" prop="position">
|
||||
<p>{{dataForm.position}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="公司" prop="companyName">
|
||||
<p>{{dataForm.companyName}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="手机" prop="mobile">
|
||||
<p>{{dataForm.mobile}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="电话" prop="phone">
|
||||
<p>{{dataForm.phone}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="邮箱" prop="emaile">
|
||||
<p>{{dataForm.emaile}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="地址" prop="address">
|
||||
<p>{{dataForm.address}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="是否星标" prop="markColor">
|
||||
<p>{{dataForm.markColor}}</p>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="附件" prop="annex">
|
||||
<JnpfUploadFile v-model="dataForm.annex" disabled detailed :fileSize="10" sizeUnit="MB" :limit="9"
|
||||
pathType="defaultPath" :isAccount="0" buttonText="点击上传">
|
||||
</JnpfUploadFile>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
</span>
|
||||
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import request from '@/utils/request'
|
||||
|
||||
import { getConfigData } from '@/api/onlineDev/visualDev'
|
||||
import jnpf from '@/utils/jnpf'
|
||||
import Detail from '@/views/basic/dynamicModel/list/detail'
|
||||
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||
export default {
|
||||
components: { Detail},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
detailVisible: false,
|
||||
loading: false,
|
||||
import {
|
||||
getConfigData
|
||||
} from '@/api/onlineDev/visualDev'
|
||||
import jnpf from '@/utils/jnpf'
|
||||
import Detail from '@/views/basic/dynamicModel/list/detail'
|
||||
import {
|
||||
thousandsFormat
|
||||
} from "@/components/Generator/utils/index"
|
||||
export default {
|
||||
components: {
|
||||
Detail
|
||||
},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
detailVisible: false,
|
||||
loading: false,
|
||||
|
||||
dataForm: {
|
||||
id :'',
|
||||
logo : [],
|
||||
contactsType : "2",
|
||||
subjectBasicId : "",
|
||||
name : '',
|
||||
position : '',
|
||||
companyName : '',
|
||||
mobile : '',
|
||||
phone : '',
|
||||
emaile : '',
|
||||
address : '',
|
||||
markColor : 0,
|
||||
annex : [],
|
||||
},
|
||||
contactsTypeOptions:[{"fullName":"默认","id":"1"},{"fullName":"联系人","id":"2"}],
|
||||
contactsTypeProps:{"label":"fullName","value":"id" },
|
||||
|
||||
}
|
||||
dataForm: {
|
||||
id: '',
|
||||
logo: [],
|
||||
contactsType: "2",
|
||||
subjectBasicId: "",
|
||||
name: '',
|
||||
position: '',
|
||||
companyName: '',
|
||||
mobile: '',
|
||||
phone: '',
|
||||
emaile: '',
|
||||
address: '',
|
||||
markColor: 0,
|
||||
annex: [],
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
|
||||
contactsTypeOptions: [{
|
||||
"fullName": "默认",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "联系人",
|
||||
"id": "2"
|
||||
}],
|
||||
contactsTypeProps: {
|
||||
"label": "fullName",
|
||||
"value": "id"
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
toDetail(defaultValue, modelId) {
|
||||
if (!defaultValue) return
|
||||
getConfigData(modelId).then(res => {
|
||||
if (!res.data || !res.data.formData) return
|
||||
let formData = JSON.parse(res.data.formData)
|
||||
formData.popupType = 'general'
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(formData, modelId, defaultValue)
|
||||
})
|
||||
})
|
||||
},
|
||||
dataInfo(dataAll){
|
||||
let _dataAll =dataAll
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
if(this.dataForm.id){
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/scm/Contacts/detail/'+this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
toDetail(defaultValue, modelId) {
|
||||
if (!defaultValue) return
|
||||
getConfigData(modelId).then(res => {
|
||||
if (!res.data || !res.data.formData) return
|
||||
let formData = JSON.parse(res.data.formData)
|
||||
formData.popupType = 'general'
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(formData, modelId, defaultValue)
|
||||
})
|
||||
})
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
|
||||
init(id) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/scm/Contacts/detail/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue