mirror of https://gitee.com/xiaonuobase/snowy
加入”关键字“对所有模糊条件进行查询的功能
parent
1297fede62
commit
e3d6540b0d
|
@ -23,9 +23,9 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import ${packageName}.common.annotation.CommonLog;
|
import vip.xiaonuo.common.annotation.CommonLog;
|
||||||
import ${packageName}.common.pojo.CommonResult;
|
import vip.xiaonuo.common.pojo.CommonResult;
|
||||||
import ${packageName}.common.pojo.CommonValidList;
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.entity.${className};
|
import ${packageName}.${moduleName}.modular.${busName}.entity.${className};
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.param.${className}AddParam;
|
import ${packageName}.${moduleName}.modular.${busName}.param.${className}AddParam;
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.param.${className}EditParam;
|
import ${packageName}.${moduleName}.modular.${busName}.param.${className}EditParam;
|
||||||
|
|
|
@ -21,9 +21,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ${packageName}.common.enums.CommonSortOrderEnum;
|
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
||||||
import ${packageName}.common.exception.CommonException;
|
import vip.xiaonuo.common.exception.CommonException;
|
||||||
import ${packageName}.common.page.CommonPageRequest;
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.entity.${className};
|
import ${packageName}.${moduleName}.modular.${busName}.entity.${className};
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.mapper.${className}Mapper;
|
import ${packageName}.${moduleName}.modular.${busName}.mapper.${className}Mapper;
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.param.${className}AddParam;
|
import ${packageName}.${moduleName}.modular.${busName}.param.${className}AddParam;
|
||||||
|
@ -32,6 +32,16 @@ import ${packageName}.${moduleName}.modular.${busName}.param.${className}IdParam
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.param.${className}PageParam;
|
import ${packageName}.${moduleName}.modular.${busName}.param.${className}PageParam;
|
||||||
import ${packageName}.${moduleName}.modular.${busName}.service.${className}Service;
|
import ${packageName}.${moduleName}.modular.${busName}.service.${className}Service;
|
||||||
|
|
||||||
|
<%
|
||||||
|
var searchCount = 0;
|
||||||
|
var searchLikeCount = 0;
|
||||||
|
for(var i = 0; i < configList.~size; i++) {
|
||||||
|
if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }
|
||||||
|
if(!configList[i].needTableId && configList[i].needPage && configList[i].needPageType == "like") {
|
||||||
|
searchLikeCount ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +56,19 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
|
||||||
@Override
|
@Override
|
||||||
public Page<${className}> page(${className}PageParam ${classNameFirstLower}PageParam) {
|
public Page<${className}> page(${className}PageParam ${classNameFirstLower}PageParam) {
|
||||||
QueryWrapper<${className}> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<${className}> queryWrapper = new QueryWrapper<>();
|
||||||
|
<% if (searchLikeCount>0) { %>
|
||||||
|
//关键信息【模糊查询】
|
||||||
|
if (ObjectUtil.isNotEmpty(${classNameFirstLower}PageParam.getSearchKey())) {
|
||||||
|
queryWrapper.and(queryWrapperLike -> {
|
||||||
|
<% for(var i = 0; i < configList.~size; i++) { %>
|
||||||
|
<% if(!configList[i].needTableId && configList[i].needPage && configList[i].needPageType == "like") { %>
|
||||||
|
queryWrapperLike.lambda().or().like(${className}::get${configList[i].fieldNameCamelCaseFirstUpper}, ${classNameFirstLower}PageParam.getSearchKey());
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<% for(var i = 0; i < configList.~size; i++) { %>
|
<% for(var i = 0; i < configList.~size; i++) { %>
|
||||||
<% if(configList[i].needPage) { %>
|
<% if(configList[i].needPage) { %>
|
||||||
<% if(configList[i].effectType == 'datepicker') { %>
|
<% if(configList[i].effectType == 'datepicker') { %>
|
||||||
|
|
|
@ -1,18 +1,32 @@
|
||||||
<template>
|
<template>
|
||||||
<%
|
<%
|
||||||
var searchCount = 0;
|
var searchCount = 0;
|
||||||
|
var searchLikeCount = 0;
|
||||||
|
var searchLike = "";
|
||||||
var row = 0;
|
var row = 0;
|
||||||
|
for(var i = 0; i < configList.~size; i++) {
|
||||||
|
if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }
|
||||||
|
if(!configList[i].needTableId && configList[i].needPage && configList[i].needPageType == "like") {
|
||||||
|
if (searchLikeCount>0)
|
||||||
|
searchLike = searchLike + "、";
|
||||||
|
searchLike += configList[i].fieldRemark;
|
||||||
|
searchLikeCount ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<% for(var i = 0; i < configList.~size; i++) { %>
|
|
||||||
<% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
|
|
||||||
<% } %>
|
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<% if (searchCount > 0) { %>
|
<% if (searchCount > 0) { %>
|
||||||
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
|
<a-form
|
||||||
|
ref="searchFormRef"
|
||||||
|
name="advanced_search"
|
||||||
|
:model="searchFormState"
|
||||||
|
class="ant-advanced-search-form"
|
||||||
|
:label-col="{ style: { width: '100px' } }"
|
||||||
|
>
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<% for(var i = 0; i < configList.~size; i++) { %>
|
<% for(var i = 0; i < configList.~size; i++) { %>
|
||||||
<% if(!configList[i].needTableId && configList[i].needPage) { row ++; %>
|
<% if(!configList[i].needTableId && configList[i].needPage) { row ++; %>
|
||||||
<% if(row <= 3) { %>
|
<% if(row <= 3 && searchLikeCount==0) { %>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<% if(configList[i].effectType == 'input' || configList[i].effectType == 'textarea') { %>
|
<% if(configList[i].effectType == 'input' || configList[i].effectType == 'textarea') { %>
|
||||||
<a-form-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
|
<a-form-item label="${configList[i].fieldRemark}" name="${configList[i].fieldNameCamelCase}">
|
||||||
|
@ -63,6 +77,7 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if(searchLikeCount==0) { %>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<a-button type="primary" @click="table.refresh(true)">查询</a-button>
|
<a-button type="primary" @click="table.refresh(true)">查询</a-button>
|
||||||
<a-button style="margin: 0 8px" @click="reset">重置</a-button>
|
<a-button style="margin: 0 8px" @click="reset">重置</a-button>
|
||||||
|
@ -73,6 +88,25 @@
|
||||||
</a>
|
</a>
|
||||||
<% }%>
|
<% }%>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
<% } %>
|
||||||
|
<% if(searchLikeCount>0) { %>
|
||||||
|
<% if(row%4>1) { //这里是为了让“关键字”输入框和查询按钮能在同一行,更加好看%>
|
||||||
|
<a-col :span="${(4-row%4)*6}" v-show="advanced"></a-col>
|
||||||
|
<% } %>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="关键字" name="searchKey">
|
||||||
|
<a-input v-model:value="searchFormState.searchKey" placeholder="${searchLike}" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="6">
|
||||||
|
<a-button type="primary" @click="table.refresh(true)">查询</a-button>
|
||||||
|
<a-button style="margin: 10 8px" @click="reset">重置</a-button>
|
||||||
|
<a @click="toggleAdvanced" style="margin-left: 8px">
|
||||||
|
{{ advanced ? '收起' : '展开' }}
|
||||||
|
<component :is="advanced ? 'up-outlined' : 'down-outlined'" />
|
||||||
|
</a>
|
||||||
|
</a-col>
|
||||||
|
<% } %>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@ -89,8 +123,9 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
:tool-config="toolConfig"
|
:tool-config="toolConfig"
|
||||||
:row-selection="options.rowSelection"
|
:row-selection="options.rowSelection"
|
||||||
|
:scroll="{ scrollToFirstRowOnChange: true, x: 'max-content' }"
|
||||||
>
|
>
|
||||||
<template #operator class="table-operator">
|
<template #operator>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('${classNameFirstLower}Add')">
|
<a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('${classNameFirstLower}Add')">
|
||||||
<template #icon><plus-outlined /></template>
|
<template #icon><plus-outlined /></template>
|
||||||
|
@ -169,6 +204,7 @@
|
||||||
<% if(!configList[i].needTableId && configList[i].whetherTable) { %>
|
<% if(!configList[i].needTableId && configList[i].whetherTable) { %>
|
||||||
{
|
{
|
||||||
title: '${configList[i].fieldRemark}',
|
title: '${configList[i].fieldRemark}',
|
||||||
|
checked: true,
|
||||||
dataIndex: '${configList[i].fieldNameCamelCase}'<% if(configList[i].whetherRetract) { %>,<% } %>
|
dataIndex: '${configList[i].fieldNameCamelCase}'<% if(configList[i].whetherRetract) { %>,<% } %>
|
||||||
<% if(configList[i].whetherRetract) { %>
|
<% if(configList[i].whetherRetract) { %>
|
||||||
ellipsis: true
|
ellipsis: true
|
||||||
|
@ -183,7 +219,8 @@
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: '150px'
|
width: '150px',
|
||||||
|
fixed: 'right'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const selectedRowKeys = ref([])
|
const selectedRowKeys = ref([])
|
||||||
|
|
Loading…
Reference in New Issue