分页调整获取where条件,针对时间类型以及包含空格的搜索条件做了调整,加入了alias一列用来当作表的别名

This commit is contained in:
wangxin
2018-03-09 20:59:13 +08:00
parent f1114d209f
commit fd6425772c
6 changed files with 585 additions and 153 deletions

View File

@@ -3,8 +3,9 @@
*/
package com.nis.domain;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@@ -16,8 +17,8 @@ import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nis.util.Configurations;
import com.nis.util.Constants;
import com.nis.util.CookieUtil;
import com.nis.util.StringUtil;
/**
* 分页类
@@ -50,7 +51,7 @@ public class Page<T> {
private String fields;//制定资源的字段
private String where;
private String alias;
private String funcName = "page"; // 设置点击页码调用的js函数名称默认为page在一页有多个分页对象时使用。
private String funcParam = ""; // 函数的附加参数,第三个参数值。
@@ -71,8 +72,20 @@ public class Page<T> {
this(request, response, Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)));
}
public Page(HttpServletRequest request, HttpServletResponse response,String alias){
this(request, response, Integer.valueOf(Configurations.getIntProperty("page.pageSize", 30)),alias);
}
public Page(HttpServletRequest request, HttpServletResponse response, int defaultPageSize,String alias){
this.setAlias(alias);
this.initPage(request, response, defaultPageSize);
}
public Page(HttpServletRequest request, HttpServletResponse response, int defaultPageSize){
this.initPage(request, response, defaultPageSize);
}
private void initPage(HttpServletRequest request, HttpServletResponse response, int defaultPageSize){
try {
// 设置页码参数传递repage参数来记住页码
String no = request.getParameter("pageNo");
@@ -129,7 +142,6 @@ public class Page<T> {
e.printStackTrace();
}
}
/**
*
* @Title: getWhere
@@ -141,14 +153,65 @@ public class Page<T> {
* @throws
* @date 2016年8月17日 上午9:28:21
* @version V1.0
* wx:日期格式的数据用日期格式化函数格式化,带空格的数据加上引号
*/
private String getWhere(HttpServletRequest request) {
String format=Constants.SEARCH_DATEFORMAT;
SimpleDateFormat sdf=new SimpleDateFormat(format);
Map<String, String[]> requestMap = request.getParameterMap();
StringBuilder whereBuilder = new StringBuilder(512);
for(String paramName : request.getParameterMap().keySet()) {
if (paramName.startsWith("search")) {
whereBuilder.append(paramName.substring("search_".length()))
.append("=").append(requestMap.get(paramName)[0]).append(" and ");
if (requestMap.get(paramName)!=null&&paramName.startsWith("search_")&&StringUtils.isNotBlank(requestMap.get(paramName)[0])) {
String clomn=paramName.substring("search_".length());
String value=requestMap.get(paramName)[0].trim();
boolean isDate=false;
try {
sdf.parse(value);
isDate=true;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(clomn.endsWith("_start")){
clomn=clomn.substring(0,clomn.lastIndexOf("_start"));
if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+".");
whereBuilder.append(clomn).append(">=");
if(isDate){
whereBuilder.append("date_format('")
.append(value).append("','%Y-%m-%d %H:%i:%S')");
}else if(value.indexOf(" ")>-1){
whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'");
}else{
whereBuilder.append(requestMap.get(paramName)[0]);
}
whereBuilder.append(" and ");
}else if(clomn.endsWith("_end")){
clomn=clomn.substring(0,clomn.lastIndexOf("_end"));
if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+".");
whereBuilder.append(clomn).append("<=");
if(isDate){
whereBuilder.append("DATE_FORMAT('")
.append(value).append("','%Y-%m-%d %H:%i:%S')");
}else if(value.indexOf(" ")>-1){
whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'");
}else{
whereBuilder.append(requestMap.get(paramName)[0]);
}
whereBuilder.append(" and ");
}else{
if(StringUtils.isNotBlank(alias)) whereBuilder.append(alias.trim()+".");
whereBuilder.append(clomn).append("=");
if(isDate){
whereBuilder.append("date_format('")
.append(value).append("','%Y-%m-%d %H:%i:%S')");
}else if(value.indexOf(" ")>-1){
whereBuilder.append("'").append(requestMap.get(paramName)[0]).append("'");
}else{
whereBuilder.append(requestMap.get(paramName)[0]);
}
whereBuilder.append(" and ");
}
}
}
if (whereBuilder.length() > 0) {
@@ -624,6 +687,22 @@ public class Page<T> {
return getPageSize();
}
/**
* alias
* @return alias
*/
public String getAlias() {
return alias;
}
/**
* @param alias the alias to set
*/
public void setAlias(String alias) {
this.alias = alias;
}
// /**
// * 获取 Spring data JPA 分页对象
// */

View File

@@ -141,11 +141,19 @@ public class BaseCfg<T> extends BaseEntity<T> {
* 区域生效id
*/
protected String areaEffectiveIds ;
/**
* 界面搜索时间条件
*/
protected Date search_create_time_start;
protected Date search_create_time_end;
protected Date search_edit_time_start;
protected Date search_edit_time_end;
protected Date search_audit_time_start;
protected Date search_audit_time_end;
/**
* cfgId
* @return cfgId
*/
public Long getCfgId() {
return cfgId;
}
@@ -538,5 +546,90 @@ public class BaseCfg<T> extends BaseEntity<T> {
public void setMaatTable(String maatTable) {
this.maatTable = maatTable;
}
/**
* search_create_time_start
* @return search_create_time_start
*/
public Date getSearch_create_time_start() {
return search_create_time_start;
}
/**
* @param search_create_time_start the search_create_time_start to set
*/
public void setSearch_create_time_start(Date search_create_time_start) {
this.search_create_time_start = search_create_time_start;
}
/**
* search_create_time_end
* @return search_create_time_end
*/
public Date getSearch_create_time_end() {
return search_create_time_end;
}
/**
* @param search_create_time_end the search_create_time_end to set
*/
public void setSearch_create_time_end(Date search_create_time_end) {
this.search_create_time_end = search_create_time_end;
}
/**
* search_edit_time_start
* @return search_edit_time_start
*/
public Date getSearch_edit_time_start() {
return search_edit_time_start;
}
/**
* @param search_edit_time_start the search_edit_time_start to set
*/
public void setSearch_edit_time_start(Date search_edit_time_start) {
this.search_edit_time_start = search_edit_time_start;
}
/**
* search_edit_time_end
* @return search_edit_time_end
*/
public Date getSearch_edit_time_end() {
return search_edit_time_end;
}
/**
* @param search_edit_time_end the search_edit_time_end to set
*/
public void setSearch_edit_time_end(Date search_edit_time_end) {
this.search_edit_time_end = search_edit_time_end;
}
/**
* search_audit_time_start
* @return search_audit_time_start
*/
public Date getSearch_audit_time_start() {
return search_audit_time_start;
}
/**
* @param search_audit_time_start the search_audit_time_start to set
*/
public void setSearch_audit_time_start(Date search_audit_time_start) {
this.search_audit_time_start = search_audit_time_start;
}
/**
* search_audit_time_end
* @return search_audit_time_end
*/
public Date getSearch_audit_time_end() {
return search_audit_time_end;
}
/**
* @param search_audit_time_end the search_audit_time_end to set
*/
public void setSearch_audit_time_end(Date search_audit_time_end) {
this.search_audit_time_end = search_audit_time_end;
}
}

View File

@@ -61,7 +61,7 @@ public class IpCfgController extends BaseController{
if(!StringUtils.isBlank(tableName)){
logger.info("table name is "+tableName);
ipCfg.setTableName(tableName);
Page<BaseIpCfg> page = ipCfgService.findPage(new Page<BaseIpCfg>(request,response), ipCfg);
Page<BaseIpCfg> page = ipCfgService.findPage(new Page<BaseIpCfg>(request,response,"r"), ipCfg);
model.addAttribute("page", page);
model.addAttribute("action", ipCfg.getAction());
model.addAttribute("tableName", tableName);

View File

@@ -92,13 +92,33 @@
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS
</sql>
<sql id="BaseIpCfg_Column_List_with_id_alias" >
<!-- <sql id="BaseIpCfg_Column_List_with_id_alias" >
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.IP_TYPE as ipType, r.SRC_IP as srcIp, r.SRC_IP_MASK as srcIpMask, r.SRC_PORT as srcPort,
r.SRC_PORT_MASK as srcPortMask ,r.DST_IP as dstIp,r.DST_IP_MASK as dstIpMask, r.DST_PORT as dstPort, r.DST_PORT_MASK as dstPortMask,
r.DIRECTION as direction,r.PROTOCOL as protocol,r.PROTOCOL_ID as protocolId,r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.AREA_EFFECTIVE_IDS AS areaEffectiveIds
</sql> -->
<sql id="BaseIpCfg_Column_List_with_id_alias" >
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc, ${page.alias}.IP_TYPE as ipType, ${page.alias}.SRC_IP as srcIp, ${page.alias}.SRC_IP_MASK as srcIpMask, ${page.alias}.SRC_PORT as srcPort,
${page.alias}.SRC_PORT_MASK as srcPortMask ,${page.alias}.DST_IP as dstIp,${page.alias}.DST_IP_MASK as dstIpMask, ${page.alias}.DST_PORT as dstPort, ${page.alias}.DST_PORT_MASK as dstPortMask,
${page.alias}.DIRECTION as direction,${page.alias}.PROTOCOL as protocol,${page.alias}.PROTOCOL_ID as protocolId,${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
${page.alias}.ATTRIBUTE AS attribute,${page.alias}.LABLE AS lable,${page.alias}.AREA_EFFECTIVE_IDS AS areaEffectiveIds
</when>
<otherwise>
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc, r.IP_TYPE as ipType, r.SRC_IP as srcIp, r.SRC_IP_MASK as srcIpMask, r.SRC_PORT as srcPort,
r.SRC_PORT_MASK as srcPortMask ,r.DST_IP as dstIp,r.DST_IP_MASK as dstIpMask, r.DST_PORT as dstPort, r.DST_PORT_MASK as dstPortMask,
r.DIRECTION as direction,r.PROTOCOL as protocol,r.PROTOCOL_ID as protocolId,r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
r.ATTRIBUTE AS attribute,r.LABLE AS lable,r.AREA_EFFECTIVE_IDS AS areaEffectiveIds
</otherwise>
</choose>
</sql>
<sql id="BaseIpCfg_Column_List" >
CFG_DESC, IP_TYPE, SRC_IP, SRC_IP_MASK, SRC_PORT,
@@ -241,7 +261,13 @@
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
from ${tableName} r
from ${tableName}
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
${page.alias}
</when>
<otherwise> r</otherwise>
</choose>
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
@@ -254,109 +280,212 @@
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIp != null">
AND r.SRC_IP=#{srcIp,jdbcType=VARCHAR}
</if>
<if test="srcIpMask != null">
AND r.SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
</if>
<if test="srcPort != null">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="srcPortMask != null">
AND r.SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
</if>
<if test="dstIp != null">
AND r.DST_IP=#{dstIp,jdbcType=VARCHAR}
</if>
<if test="dstIpMask != null">
AND r.DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
</if>
<if test="dstPort != null">
AND r.DST_PORT=#{dstPort,jdbcType=VARCHAR}
</if>
<if test="dstPortMask != null">
AND r.DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
<if test="cfgId != null and cfgId != ''">
AND ${page.alias}.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND ${page.alias}.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null and ipType != ''">
AND ${page.alias}.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIp != null and srcIp != ''">
AND ${page.alias}.SRC_IP=#{srcIp,jdbcType=VARCHAR}
</if>
<if test="srcIpMask != null and srcIpMask != ''">
AND ${page.alias}.SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
</if>
<if test="srcPort != null and srcPort !=''">
AND ${page.alias}.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="srcPortMask != null and srcPortMask !=''">
AND ${page.alias}.SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
</if>
<if test="dstIp != null and dstIp !=''">
AND ${page.alias}.DST_IP=#{dstIp,jdbcType=VARCHAR}
</if>
<if test="dstIpMask != null and dstIpMask !=''">
AND ${page.alias}.DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
</if>
<if test="dstPort != null and dstPort !=''">
AND ${page.alias}.DST_PORT=#{dstPort,jdbcType=VARCHAR}
</if>
<if test="dstPortMask != null and dstPortMask !=''">
AND ${page.alias}.DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
</if>
<if test="direction != null and direction!= ''">
AND ${page.alias}.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null and protocol!=''">
AND ${page.alias}.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null and protocolId !=''">
AND ${page.alias}.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null and action !=''">
AND ${page.alias}.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null and isValid !=''">
AND ${page.alias}.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null and isValid !=''">
AND ${page.alias}.IS_VALID != -1
</if>
<if test="isAudit != null and isAudit !=''">
AND ${page.alias}.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND ${page.alias}.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND ${page.alias}.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND ${page.alias}.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null and serviceId !=''">
AND ${page.alias}.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null and requestId !=''">
AND ${page.alias}.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null and compileId !=''">
AND ${page.alias}.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null and isAreaEffective !=''">
AND ${page.alias}.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND ${page.alias}.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND ${page.alias}.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND ${page.alias}.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND ${page.alias}.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
</when>
<otherwise>
<if test="cfgId != null and cfgId != ''">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null and ipType != ''">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="srcIp != null and srcIp != ''">
AND r.SRC_IP=#{srcIp,jdbcType=VARCHAR}
</if>
<if test="srcIpMask != null and srcIpMask != ''">
AND r.SRC_IP_MASK=#{srcIpMask,jdbcType=VARCHAR}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="srcPortMask != null and srcPortMask !=''">
AND r.SRC_PORT_MASK=#{srcPortMask,jdbcType=VARCHAR}
</if>
<if test="dstIp != null and dstIp !=''">
AND r.DST_IP=#{dstIp,jdbcType=VARCHAR}
</if>
<if test="dstIpMask != null and dstIpMask !=''">
AND r.DST_IP_MASK=#{dstIpMask,jdbcType=VARCHAR}
</if>
<if test="dstPort != null and dstPort !=''">
AND r.DST_PORT=#{dstPort,jdbcType=VARCHAR}
</if>
<if test="dstPortMask != null and dstPortMask !=''">
AND r.DST_PORT_MASK=#{dstPortMask,jdbcType=VARCHAR}
</if>
<if test="direction != null and direction!= ''">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null and protocol!=''">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null and protocolId !=''">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null and action !=''">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null and isValid !=''">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null and isValid !=''">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null and isAudit !=''">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null and serviceId !=''">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null and requestId !=''">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null and compileId !=''">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null and isAreaEffective !=''">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
</otherwise>
</choose>
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY CFG_ID desc
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>

View File

@@ -20,10 +20,20 @@
</c:otherwise>
</c:choose>
<script>
$(document).ready(function() {
$(document).ready(function() {
//筛选功能初始化
filterActionInit();
});
$("#isAudit").change(function(){
page();
});
});
function reset(){
$("#searchForm").reset();
}
//查询
function page(n,s){
$("#pageNo").val(n);
@@ -37,7 +47,7 @@
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="location='${ctx}/cfg/ip/list?serviceId=${serviceId}&action=${action}&cfgName=${cfgName}&audit=${audit}'"><spring:message code="refresh"></spring:message></button>
<%-- <button type="button" class="btn btn-default" onclick="location='${ctx}/cfg/ip/list?serviceId=${serviceId}&action=${action}&cfgName=${cfgName}&audit=${audit}'"><spring:message code="refresh"></spring:message></button> --%>
<c:if test="${audit==0}">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/cfg/ip/form?serviceId=${serviceId}&action=${action}&cfgName=${cfgName}&audit=${audit}'"><spring:message code="add"></spring:message></button>
@@ -47,59 +57,180 @@
<h3 class="page-title">
<spring:message code="${cfgName}"></spring:message>
<small><spring:message code="date_list"/></small>
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-cogs"></i><spring:message code="date_list"></spring:message>
</div>
<div class="tools">
<!-- <a href="javascript:;" class="collapse" data-original-title=""
title=""> </a> <a href="#portlet-config" data-toggle="modal"
class="config" data-original-title="" title=""> </a> <a
href="javascript:;" class="reload" data-original-title=""
title=""> </a> <a href="javascript:;" class="remove"
data-original-title="" title=""> </a> -->
</div>
</div>
<div class="portlet">
<div class="portlet-body">
<div class="row" >
<form:form id="searchForm" modelAttribute="ipCfg" action="${ctx}/cfg/ip/list?serviceId=${serviceId}&action=${action}&cfgName=${cfgName}&audit=${audit}" method="post" class="form-search">
<input id="audit" name="audit" type="hidden" value="${audit}"/>
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<!-- 筛选按钮展开状态-->
<input id="isFilterAction" name="isFilterAction" type="hidden" value="${ipCfg.isFilterAction }"/>
<!-- 搜索内容与操作按钮栏 -->
<div class="col-md-12">
<spring:message code="state"/> : <form:select path="isAudit" class="selectpicker select2">
<form:option value=""><spring:message code="select"/></form:option>
<form:option value="0"><spring:message code="created"></spring:message></form:option>
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
</form:select>
<spring:message code="request_number"/> :
<form:select path="requestId" class="selectpicker select2" data-live-search="true" data-live-search-placeholder="search">
<form:option value=""><spring:message code="select"/></form:option>
<c:forEach items="${requestInfos}" var="requestInfo" >
<form:option value="${requestInfo.id}"><spring:message code="${requestInfo.requestTitle}"></spring:message></form:option>
</c:forEach>
</form:select>
<button type="button" class="btn btn-default btn-sm" onclick="return page()">
<div class="pull-left">
<c:set var="state"><spring:message code='state'/></c:set>
<form:select path="isAudit" class="selectpicker select2 input-small" title="${state}">
<%-- <form:option value=""><spring:message code="state"/></form:option> --%>
<form:option value="0"><spring:message code="created"></spring:message></form:option>
<form:option value="1"><spring:message code="approved"></spring:message></form:option>
<form:option value="2"><spring:message code="unapproved"></spring:message></form:option>
<form:option value="3"><spring:message code="cancel_approved"></spring:message></form:option>
</form:select>
</div>
<div class="pull-left">
<c:set var="request_number"><spring:message code='request_number'/></c:set>
<form:select path="requestId" class="selectpicker select2 input-small" title="${request_number}" data-live-search="true" data-live-search-placeholder="search">
<c:forEach items="${requestInfos}" var="requestInfo" >
<form:option value="${requestInfo.id}"><spring:message code="${requestInfo.requestTitle}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
<div class="pull-left">
<c:set var="flI18n"><spring:message code='type'/></c:set>
<form:select path="classify" class="selectpicker select2 input-small" title="${flI18n}" data-live-search="true" data-live-search-placeholder="search">
<c:forEach items="${fls}" var="fl" >
<form:option value="${fl.itemCode}"><spring:message code="${fl.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
<div class="pull-left">
<c:set var="attributeI18n"><spring:message code='attribute'/></c:set>
<form:select path="attribute" class="selectpicker select2 input-small" title="${attributeI18n}" data-live-search="true" data-live-search-placeholder="search">
<c:forEach items="${xzs}" var="xz" >
<form:option value="${xz.itemCode}"><spring:message code="${xz.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
<div class="pull-left">
<c:set var="labelI18n"><spring:message code='label'/></c:set>
<form:select path="lable" class="selectpicker select2 input-small" title="${labelI18n}" data-live-search="true" data-live-search-placeholder="search">
<c:forEach items="${lables}" var="lable" >
<form:option value="${lable.itemCode}"><spring:message code="${lable.itemValue}"></spring:message></form:option>
</c:forEach>
</form:select>
</div>
<!-- <div class="pull-right">
<button type="button" class="btn btn-default">
<i class="fa fa-edit"></i> 编辑</button>
<button type="button" class="btn btn-default">
<i class="fa fa-trash"></i> 删除</button>
<button type="button" class="btn btn-default">
<i class="fa fa-download"></i> 导出</button>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i> 审核
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right">
<li><a href="javascript:void(0);" onclick="passOpt()"><i class="fa fa-check"></i> 通过</a></li>
<li><a href="javascript:void(0);" onclick="noPassOpt()"><i class="fa fa-remove"></i> 未通过</a></li>
<li><a href="javascript:void(0);" onclick="cancelPassOpt()"><i class="fa fa-undo"></i> 配置取消</a></li>
</ul>
</div>
<a class="btn btn-icon-only btn-default setfields tooltips"
data-container="body" data-placement="top" data-original-title="自定义列字段" href="javascript:;">
<i class="icon-wrench"></i>
</a>
</div> -->
<%-- <button type="button" class="btn btn-default btn-sm" onclick="return page()">
<i class="fa fa-edit"></i><spring:message code="search"></spring:message>
</button>
<spring:message code="sort"/> :
<select name="orderBy" class="selectpicker select2">
<option value=""><spring:message code="select"/></option>
<option value="createTime asc" <c:if test="${page.orderBy eq 'createTime asc' }">selected</c:if> ><spring:message code="createTime_asc"/></option>
<option value="createTime desc" <c:if test="${page.orderBy eq 'createTime desc' }">selected</c:if> ><spring:message code="createTime_desc"/></option>
<option value="editTime asc" <c:if test="${page.orderBy eq 'editTime asc' }">selected</c:if> ><spring:message code="editTime_asc"/></option>
<option value="editTime desc" <c:if test="${page.orderBy eq 'editTime desc' }">selected</c:if> ><spring:message code="editTime_desc"/></option>
<option value="auditTime asc" <c:if test="${page.orderBy eq 'auditTime asc' }">selected</c:if> ><spring:message code="auditTime_asc"/></option>
<option value="auditTime desc" <c:if test="${page.orderBy eq 'auditTime desc' }">selected</c:if> ><spring:message code="auditTime_desc"/></option>
</select>
</button> --%>
<div class="pull-left">
<c:set var="sortI18n"><spring:message code="sort"/></c:set>
<select name="orderBy" class="selectpicker select2 input-small" title="${sortI18n}">
<option value="${page.alias}.create_time asc" <c:if test="${fn:contains(page.orderBy,'create_time asc') }">selected</c:if> ><spring:message code="createTime_asc"/></option>
<option value="${page.alias}.create_time desc" <c:if test="${fn:contains(page.orderBy , 'create_time desc') }">selected</c:if> ><spring:message code="createTime_desc"/></option>
<option value="${page.alias}.edit_time asc" <c:if test="${fn:contains(page.orderBy , 'edit_time asc') }">selected</c:if> ><spring:message code="editTime_asc"/></option>
<option value="${page.alias}.edit_time desc" <c:if test="${fn:contains(page.orderBy , 'edit_time desc') }">selected</c:if> ><spring:message code="editTime_desc"/></option>
<option value="${page.alias}.audit_time asc" <c:if test="${fn:contains(page.orderBy , 'audit_time asc') }">selected</c:if> ><spring:message code="auditTime_asc"/></option>
<option value="${page.alias}.audit_time desc" <c:if test="${fn:contains(page.orderBy , 'audit_time desc') }">selected</c:if> ><spring:message code="auditTime_desc"/></option>
</select>
</div>
<div class="pull-left">
<button type="button" class="btn btn-default" id="filter-btn"> 筛选 <i class="fa fa-angle-double-down"></i></button>
</div>
<div class="pull-right">
<button class="btn btn-default btn-search" type="button" onclick="return page()"><i class="fa fa-search"></i></button>
</div>
</div>
<!-- 搜索内容与操作按钮栏 -->
<!-- 筛选搜索内容栏默认隐藏-->
<div class="col-md-12 filter-action-select-panle hide" >
<div class="row">
<div class="col-md-6">
<div class="pull-left">
<label><spring:message code="config_time"/></label>
</div>
<div class="pull-left">
<input name="search_create_time_start" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value='${ipCfg.search_create_time_start}' pattern='yyyy-MM-dd HH:mm:ss'/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
<div class="pull-left">
<label>到</label>
</div>
<div class="pull-left">
<input name="search_create_time_end" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value="${ipCfg.search_create_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-6">
<div class="pull-left">
<label><spring:message code="edit_time"/></label>
</div>
<div class="pull-left">
<input name="search_edit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value="${ipCfg.search_edit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
<div class="pull-left">
<label>到</label>
</div>
<div class="pull-left">
<input name="search_edit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value="${ipCfg.search_edit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
<div class="col-md-6">
<div class="pull-left">
<label><spring:message code="audit_time"/></label>
</div>
<div class="pull-left">
<input name="search_audit_time_start" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value="${ipCfg.search_audit_time_start}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
<div class="pull-left">
<label>到</label>
</div>
<div class="pull-left">
<input name="search_audit_time_end" type="text" readonly="readonly" maxlength="20" class="form-control input-small Wdate"
value="<fmt:formatDate value="${ipCfg.search_audit_time_end}" pattern="yyyy-MM-dd HH:mm:ss"/>" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
</div>
</div>
</div>
<h5 class="page-header"></h5>
<div class="row">
<div class="pull-left">
<button type="button" class="btn blue" onclick="return page()"> <i class="fa fa-search"></i> <spring:message code="search"/> </button>
<button type="button" class="btn btn-default" onclick="reset()"> <i class="fa fa-refresh"></i> <spring:message code="reset"/> </button>
</div>
</div>
</div>
<!-- /筛选搜索内容栏 结束-->
</form:form>
</div>
<div class="table-responsive">

View File

@@ -11,7 +11,7 @@ $(document).ready(function() {
</head>
<body>
<div class="page-content">
${message}
<sys:message content="${message}"/>
</div>
</body>
</html>