jeecg中列表查询数据关联其他表的显示
1.A表字段:id,name;B表字段:id,name,fid(A表外键),现查询A表和B表的所有数据并且查询条件A,B都有,在前台页面list显示
2.后台方法:
@RequestMapping(params = "datagrid_zh")
public void datagrid_zh(CarRouteEntity ldcHandbookOrder,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(CarRouteEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, ldcHandbookOrder);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
String tiaojian="";
String name=request.getParameter("name");
if(StringUtils.isNotEmpty(name)) {
tiaojian+=" and a.name>= '"+name+"'";
}
String sql="select a.id,a.name,b.name as bname from Aa LEFT JOIN B b on a.id=b.fid where 1=1 "+tiaojian;
List<Map<String, Object>> map=jdbcTemplate.queryForList(sql);
dataGrid.setTotal(map.size());
List<Map<String,Object>> maplist=systemService.findForJdbc(sql +" limit "+(dataGrid.getPage()-1)*dataGrid.getRows()+","+dataGrid.getRows(), null);
dataGrid.setResults(maplist);
TagUtil.datagrid(response, dataGrid);
}
3.前台页面
<t:datagrid name="??" checkbox="true" pagination="true" pageSize="10"
sortOrder="desc"
btnCls="bootstrap btn btn-success btn-xs"
fitColumns="false" title=""
actionUrl="??.do?datagrid_zh"
idField="id" fit="true" queryMode="group">
<t:dgCol title="id" field="id" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="A表名称" field="name" query="true" width="120"></t:dgCol>
<t:dgCol title="B表名称" field="bname" query="true" width="120"></t:dgCol>
</t:datagrid>
4.技术问题联系微信xjt199561
jeecg中列表查询数据关联其他表的显示的更多相关文章
- MySQL 查询某个数据库中所有包含数据记录的表名
MySQL 查询某个数据库中所有包含数据记录的表名 有时根据实际应用需要,需要对数据进行备份. 如果一个数据库中有很多数据表,但是只想备份包含数据记录的那些表数据(空表不做数据备份). 如果通过如下S ...
- Oracle中关于清除数据和释放表空间
一.表的重命名 flashback table test2 to before drop rename to test3;--[to test3]将表重命名 drop table test3 purg ...
- 2019-2-14SQLserver中拼音查询数据
SQLserver中获取文字的全拼音: CREATE function [dbo].[f_GetPinyin](@words nvarchar()) returns varchar() as begi ...
- Oracle 定时查询数据插入新表中(job+存储过程)
create table EGMAS_COUNT_DATA(TIMES date not null, COUNT NUMBER(30) not null, SYSTEM_NAME VARC ...
- sql 从另外一张表查询数据存入本表. (有关联的)
UPDATE friends INNER JOIN users ON friends.friendid=users.userid SET friends.friendname=users.userna ...
- PostgreSQL 导出导入表中指定查询数据
创建一临时表: create table test_view as select * from test where date(to_timestamp(endtime))>='2012-09- ...
- php中模糊查询并关联三个select框
1.在php中我们经常用到下拉框,并相互关联,如果下拉框的option非常多,那么我们就要用到模糊搜索功能,那么怎么做呢? 在此功能中,走了弯路,最好不要关联两个select的id值后select属性 ...
- sqlserver查询数据的所有表名和行数及空间占用量
//查询所有表名 select name from sysobjects where xtype='u' --modify_date指表结构最后更新日期,并非数据最后更新日期SELECT na ...
- sqlserver查询数据的所有表名和行数
//查询所有表明 select name from sysobjects where xtype='u' select * from sys.tables //查询数据库中所有的表名及行数 SELEC ...
随机推荐
- Linux学习笔记记录(六)
- Linux学习笔记记录(二)
- css实现圆角效果
源码: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> & ...
- Python生成随机不重复姓名昵称
姓采用百家姓,名字从常用名字高频字选取两个汉字,再和当前时间戳组合,估计应该是不会重复了,代码如下: # -*- coding:utf-8 -*- import random import time ...
- graph.h
#ifndef _GRAPH_#define _GRAPH_#include<stdio.h>#include<stdlib.h>#include<string.h> ...
- PAT 1135 Is It A Red-Black Tree
There is a kind of balanced binary search tree named red-black tree in the data structure. It has th ...
- 基于XML文档的声明式事务配置
<!-- 配置事务切面 --> <aop:config> <aop:pointcut expression="execution(* com.atguigu.t ...
- java之比较两个日期大小----https://blog.csdn.net/dongfangbaiyun/article/details/51225469
https://blog.csdn.net/dongfangbaiyun/article/details/51225469 java之比较两个日期大小 最近又用到两个日期大小的比较,因此记录在此,方便 ...
- Ubuntu 16.04安装Kdbg替代Insight实现汇编的调试
Insight已经不能使用APT进行安装,且如果使用源码安装时需要修改.所以只能放弃,转投使用Kdbg. 安装: sudo apt-get install kdbg 使用: nasm -f elf64 ...
- 【ora10,4】oracle后台进程介绍:
一.SMON(System MONitor) 系统监控进程: 在数据库启动过程中,SMON排在CKPT进程之后,在Oracle9i中排在第六号的位置: PMON started with p ...