在 查询配置[总纲](http://report.jeecg.com/2373403)中已有说明, 参数支持配置查询条件,不同数据集,参数名重复,查询区域只有**一**个控件,下面将展示一个例子。 [TOC] ## 效果展示 >因为配置了参数的默认值,所以默认查询2月份的数据 ![](https://img.kancloud.cn/c8/95/c8958e97f6c94b1d52532fff7642c2ad_1371x901.png) >修改`end_time`时间为`2022-02-15`,俩个数据集展示均发生变化 ![](https://img.kancloud.cn/03/d9/03d92cda3519b1a6eebb882dcbeb19dd_1355x902.png) ## 设计步骤 ### 1、创建一个名为`用户注册统计`的数据报表 >主要有四个字段`用户名`、`性别`、`注册时间`、`手机号` ![](https://img.kancloud.cn/1a/8c/1a8ce22c12798281554fa2aa4d94db6a_1154x222.png) #### 1.1 为`用户注册统计`创建第一个SQL数据源 ![](https://img.kancloud.cn/70/d3/70d35f35515e905265d957f5b9df776b_1906x904.png) ``` select username,sex,phone,create_time from user where 1=1 <#if isNotEmpty(begin_date)> and DATE_FORMAT(create_time,'%Y-%m-%d')>= '${begin_date}' </#if> <#if isNotEmpty(end_date)> and DATE_FORMAT(create_time,'%Y-%m-%d')<='${end_date}' </#if> GROUP BY username,create_time ``` #### 1.2 为`用户注册统计`创建第二个SQL数据源 ![](https://img.kancloud.cn/ee/44/ee44672eb4248c81ffeab2abfb446cfa_1916x903.png) ``` select count(1) as value,DATE_FORMAT(create_time,'%Y-%m-%d') as name from user where 1=1 <#if isNotEmpty(begin_date)> and DATE_FORMAT(create_time,'%Y-%m-%d')>= '${begin_date}' </#if> <#if isNotEmpty(end_date)> and DATE_FORMAT(create_time,'%Y-%m-%d')<='${end_date}' </#if> GROUP BY name ``` 参数配置同上,(即使配置其他默认值,只要参数名相同,都会走之前配置好的) #### 3.拖拽字段到设计器页面,并设置数据和样式 ![](https://img.kancloud.cn/86/b2/86b28408bda1de625934c5f38b5c5dbe_1920x904.png) >保存预览 ![](https://img.kancloud.cn/c8/95/c8958e97f6c94b1d52532fff7642c2ad_1371x901.png) *注意: 本例中因为是mysql支持时间和字符串直接比较,所以参数的值加上单引号就直接拼在sql中了,如果自己的数据库不支持时间和字符串比较,请使用对应数据库的内置函数。*