补充查询方法

This commit is contained in:
xiejunyu
2022-01-24 16:40:25 +08:00
parent 07078e5780
commit f895354a43
11 changed files with 74 additions and 601 deletions
@@ -1,6 +1,7 @@
package com.jero.modules.document.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.constant.enums.YesOrNo;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
@@ -13,15 +14,9 @@ import com.jero.modules.tag.service.impl.OnlCgformAreaServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Date;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 文档库信息表
* @Author: jero-boot
@@ -164,7 +159,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
OnlCgformArea onlCgformArea = new OnlCgformArea();
onlCgformArea.setIsModel(ModuleEnum.DOCUMENT_LIBRARY.getValue());
//区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(onlCgformArea);
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(String.valueOf(onlCgformArea));
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
@@ -1,31 +1,32 @@
package com.jero.modules.tag.controller;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.service.IOnlCgformAreaService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.service.IOnlCgformAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.jero.common.aspect.annotation.AutoLog;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
/**
* @Description: 区域管理表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-24
* @Version: V1.0
*/
@Api(tags="区域管理表")
@@ -35,7 +36,7 @@ import com.jero.common.aspect.annotation.AutoLog;
public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlCgformAreaService> {
@Autowired
private IOnlCgformAreaService onlCgformAreaService;
List<OnlCgformArea> list;
/**
* 分页列表查询
*
@@ -58,18 +59,17 @@ public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlC
return Result.OK(pageList);
}
/**
/**
* 列表查询
*
* @return
*/
@AutoLog(value = "区域管理表-列表查询")
@ApiOperation(value="区域管理表-列表查询", notes="区域管理表-列表查询")
@ApiOperation(value="区域管理表-列表查询", notes="区域管理表-列表查询")
@GetMapping(value = "/list")
public Result<List<OnlCgformArea>> queryList() {
OnlCgformArea onlCgformArea = new OnlCgformArea();
List<OnlCgformArea> list = onlCgformAreaService.queryList(onlCgformArea);
return Result.OK(list);
public Result<List<OnlCgformArea>> queryList(String isModel,int sort){
list = onlCgformAreaService.queryList(isModel,sort);
return Result.OK(list);
}
/**
@@ -145,27 +145,27 @@ public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlC
return Result.OK(onlCgformArea);
}
/**
* 导出excel
*
* @param request
* @param onlCgformArea
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, OnlCgformArea onlCgformArea) {
return super.exportXls(request, onlCgformArea, OnlCgformArea.class, "区域管理表");
}
/**
* 导出excel
*
* @param request
* @param onlCgformArea
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, OnlCgformArea onlCgformArea) {
return super.exportXls(request, onlCgformArea, OnlCgformArea.class, "区域管理表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, OnlCgformArea.class);
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, OnlCgformArea.class);
}
}
@@ -1,27 +1,24 @@
package com.jero.modules.tag.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 区域管理表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-24
* @Version: V1.0
*/
@Data
@@ -72,9 +69,9 @@ public class OnlCgformArea implements Serializable {
@ApiModelProperty(value = "英文名称")
private java.lang.String enName;
/**所属模块*/
@Excel(name = "所属模块", width = 15)
@ApiModelProperty(value = "所属模块")
/**所属模块(1文档库,0文档拆分)*/
@Excel(name = "所属模块(1文档库,0文档拆分)", width = 15)
@ApiModelProperty(value = "所属模块(1文档库,0文档拆分)")
private java.lang.String isModel;
/**排序号*/
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 区域管理表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-24
* @Version: V1.0
*/
public interface OnlCgformAreaMapper extends BaseMapper<OnlCgformArea> {
@@ -13,4 +13,8 @@
<result column="is_model" property="isModel" />
<result column="sort" property="sort" />
</resultMap>
<!--仅显示文档库,且按排序号正序排列-->
<select id="queryBySort" resultMap="OnlCgformAreaResultMap">
select * from onl_cgform_area order by sort where is_model='1';
</select>
</mapper>
@@ -7,7 +7,7 @@ import java.util.List;
/**
* @Description: 区域管理表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-24
* @Version: V1.0
*/
public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
@@ -57,5 +57,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
*
* @return
*/
List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea);
List<OnlCgformArea> queryList(String isModel);
List<OnlCgformArea> queryList(String isModel, int sort);
}
@@ -1,19 +1,18 @@
package com.jero.modules.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.mapper.OnlCgformAreaMapper;
import com.jero.modules.tag.service.IOnlCgformAreaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
* @Description: 区域管理表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-24
* @Version: V1.0
*/
@Service
@@ -85,12 +84,12 @@ public class OnlCgformAreaServiceImpl extends ServiceImpl<OnlCgformAreaMapper, O
* @return
*/
@Override
public List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea) {
LambdaQueryWrapper<OnlCgformArea> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StringUtils.isNotBlank(onlCgformArea.getIsModel())){
lambdaQueryWrapper.eq(OnlCgformArea::getIsModel,onlCgformArea.getIsModel())
.orderByAsc(OnlCgformArea::getSort);
}
return list(lambdaQueryWrapper);
public List<OnlCgformArea> queryList(String isModel) {
return list();
}
@Override
public List<OnlCgformArea> queryList(String isModel, int sort) {
return null;
}
}
@@ -1,190 +0,0 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('区域管理表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<onl-cgform-area-modal ref="modalForm" @ok="modalFormOk"></onl-cgform-area-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import OnlCgformAreaModal from './modules/OnlCgformAreaModal'
export default {
name: 'OnlCgformAreaList',
mixins:[JeroListMixin, mixinDevice],
components: {
OnlCgformAreaModal
},
data () {
return {
description: '区域管理表管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'展示区域',
align:"center",
dataIndex: 'showArea'
},
{
title:'英文名称',
align:"center",
dataIndex: 'enName'
},
{
title:'所属模块',
align:"center",
dataIndex: 'isModel'
},
{
title:'排序号',
align:"center",
sorter: true,
dataIndex: 'sort'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/tag/onlCgformArea/page",
delete: "/tag/onlCgformArea/delete",
deleteBatch: "/tag/onlCgformArea/deleteBatch",
exportXlsUrl: "/tag/onlCgformArea/exportXls",
importExcelUrl: "tag/onlCgformArea/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'showArea',text:'展示区域',dictCode:''})
fieldList.push({type:'string',value:'enName',text:'英文名称',dictCode:''})
fieldList.push({type:'string',value:'isModel',text:'所属模块',dictCode:''})
fieldList.push({type:'int',value:'sort',text:'排序号',dictCode:''})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
@@ -1,191 +0,0 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form :form="form" slot="detail">
<a-row>
<a-col :span="24">
<a-form-item label="展示区域" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['showArea', validatorRules.showArea]" placeholder="请输入展示区域" :maxLength="120" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['enName', validatorRules.enName]" placeholder="请输入英文名称" :maxLength="120" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="所属模块" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['isModel', validatorRules.isModel]" placeholder="请输入所属模块" :maxLength="120" disabled ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="排序号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number v-decorator="['sort', validatorRules.sort]" placeholder="请输入排序号" style="width: 100%" />
</a-form-item>
</a-col>
<a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
<a-button @click="submitForm"> </a-button>
</a-col>
</a-row>
</a-form>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'OnlCgformAreaForm',
components: {
},
props: {
//流程表单data
formData: {
type: Object,
default: ()=>{},
required: false
},
//表单模式:true流程表单 false普通表单
formBpm: {
type: Boolean,
default: false,
required: false
},
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
showArea: {
rules: [
{ required: true, message: '请输入展示区域!'},
]
},
enName: {
rules: [
{ required: true, message: '请输入英文名称!'},
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
]
},
isModel: {
rules: [
{ required: true, message: '请输入所属模块!'},
]
},
sort: {
rules: [
{ required: true, message: '请输入排序号!'},
{ pattern: /^-?\d+$/, message: '请输入整数!'},
]
},
},
url: {
add: "/tag/onlCgformArea/add",
edit: "/tag/onlCgformArea/edit",
queryById: "/tag/onlCgformArea/queryById"
}
}
},
computed: {
formDisabled(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return false
}
return true
}
return this.disabled
},
showFlowSubmitButton(){
if(this.formBpm===true){
if(this.formData.disabled===false){
return true
}
}
return false
}
},
created () {
//如果是流程中表单,则需要加载流程表单data
this.showFlowData();
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'showArea','enName','isModel','sort'))
})
},
//渲染流程表单数据
showFlowData(){
if(this.formBpm === true){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
submitForm () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
popupCallback(row){
this.form.setFieldsValue(pick(row,'showArea','enName','isModel','sort'))
},
}
}
</script>
@@ -1,60 +0,0 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<onl-cgform-area-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></onl-cgform-area-form>
</j-modal>
</template>
<script>
import OnlCgformAreaForm from './OnlCgformAreaForm'
export default {
name: 'OnlCgformAreaModal',
components: {
OnlCgformAreaForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>
@@ -1,83 +0,0 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
:visible="visible">
<onl-cgform-area-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></onl-cgform-area-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import OnlCgformAreaForm from './OnlCgformAreaForm'
export default {
name: 'OnlCgformAreaModal',
components: {
OnlCgformAreaForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>