目录更改
This commit is contained in:
parent
917cb2b2d1
commit
025d1b88a3
|
|
@ -22,8 +22,8 @@ import com.smallchill.core.constant.ConstCurd;
|
||||||
import com.smallchill.core.constant.Cst;
|
import com.smallchill.core.constant.Cst;
|
||||||
import com.smallchill.core.interfaces.ICURD;
|
import com.smallchill.core.interfaces.ICURD;
|
||||||
import com.smallchill.core.plugins.dao.Blade;
|
import com.smallchill.core.plugins.dao.Blade;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.ClassKit;
|
import com.smallchill.core.toolbox.kit.ClassKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public class BaseService<M> implements IService<M>, ConstCurd {
|
public class BaseService<M> implements IService<M>, ConstCurd {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.smallchill.core.aop.AopContext;
|
import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.interfaces.ICURD;
|
import com.smallchill.core.interfaces.ICURD;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
|
|
||||||
public interface IService<M> {
|
public interface IService<M> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ import com.smallchill.core.constant.Cst;
|
||||||
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.LogKit;
|
import com.smallchill.core.toolbox.kit.LogKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beetlsql 自动API封装dao工具
|
* beetlsql 自动API封装dao工具
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.beetl.sql.core.SQLReady;
|
||||||
import com.smallchill.core.aop.AopContext;
|
import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beetlsql Dao工具
|
* beetlsql Dao工具
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.CacheKit;
|
import com.smallchill.core.toolbox.kit.CacheKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked","rawtypes"})
|
@SuppressWarnings({"unchecked","rawtypes"})
|
||||||
public class DbManager {
|
public class DbManager {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
||||||
import org.beetl.sql.core.SQLResult;
|
import org.beetl.sql.core.SQLResult;
|
||||||
import org.beetl.sql.core.db.KeyHolder;
|
import org.beetl.sql.core.db.KeyHolder;
|
||||||
|
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beetlsql MarkDown模式sql管理工具
|
* beetlsql MarkDown模式sql管理工具
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ import org.beetl.sql.core.engine.PageQuery;
|
||||||
import com.smallchill.core.beetl.BeetlTemplate;
|
import com.smallchill.core.beetl.BeetlTemplate;
|
||||||
import com.smallchill.core.interfaces.ILoader;
|
import com.smallchill.core.interfaces.ILoader;
|
||||||
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
import com.smallchill.core.plugins.connection.ConnectionPlugin;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.CacheKit;
|
import com.smallchill.core.toolbox.kit.CacheKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
public class MdManager {
|
public class MdManager {
|
||||||
private static Map<String, MdManager> pool = new ConcurrentHashMap<String, MdManager>();
|
private static Map<String, MdManager> pool = new ConcurrentHashMap<String, MdManager>();
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import com.smallchill.core.plugins.dao.Blade;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.kit.DateKit;
|
import com.smallchill.core.toolbox.kit.DateKit;
|
||||||
import com.smallchill.core.toolbox.support.ImgCompress;
|
|
||||||
import com.smallchill.system.model.Attach;
|
import com.smallchill.system.model.Attach;
|
||||||
|
|
||||||
public class DefaultFileProxyFactory implements IFileProxy {
|
public class DefaultFileProxyFactory implements IFileProxy {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -19,13 +18,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.alibaba.druid.util.Base64;
|
import com.alibaba.druid.util.Base64;
|
||||||
import com.smallchill.core.constant.Cst;
|
import com.smallchill.core.constant.Cst;
|
||||||
import com.smallchill.core.plugins.dao.Blade;
|
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
|
||||||
import com.smallchill.core.toolbox.Func;
|
|
||||||
import com.smallchill.core.toolbox.kit.DateKit;
|
import com.smallchill.core.toolbox.kit.DateKit;
|
||||||
import com.smallchill.core.toolbox.kit.PathKit;
|
import com.smallchill.core.toolbox.kit.PathKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
import com.smallchill.system.model.Attach;
|
|
||||||
|
|
||||||
public class UploadFileUtils {
|
public class UploadFileUtils {
|
||||||
|
|
||||||
|
|
@ -259,14 +254,4 @@ public class UploadFileUtils {
|
||||||
return contentPath.replace(Cst.me().getContextPath(), "");
|
return contentPath.replace(Cst.me().getContextPath(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getFileId(String url, String name) {
|
|
||||||
Attach attach = new Attach();
|
|
||||||
attach.setCreater(Func.toInt(ShiroKit.getUser().getId(), 0));
|
|
||||||
attach.setCreatetime(new Date());
|
|
||||||
attach.setName(name);
|
|
||||||
attach.setStatus(1);
|
|
||||||
attach.setUrl(url);
|
|
||||||
return Blade.create(Attach.class).saveRtStrId(attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import com.smallchill.core.plugins.dao.Md;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.kit.JsonKit;
|
import com.smallchill.core.toolbox.kit.JsonKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
import com.smallchill.core.toolbox.support.SqlKeyword;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title grid工厂基类,封装通用分页方法
|
* @title grid工厂基类,封装通用分页方法
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.smallchill.core.base.controller.BladeController;
|
import com.smallchill.core.base.controller.BladeController;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class EasyGridFactory extends BaseGridFactory{
|
public class EasyGridFactory extends BaseGridFactory{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.smallchill.core.base.controller.BladeController;
|
import com.smallchill.core.base.controller.BladeController;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class JqGridFactory extends BaseGridFactory {
|
public class JqGridFactory extends BaseGridFactory {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.smallchill.core.base.controller.BladeController;
|
import com.smallchill.core.base.controller.BladeController;
|
||||||
import com.smallchill.core.interfaces.IQuery;
|
import com.smallchill.core.interfaces.IQuery;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class LigerGridFactory extends BaseGridFactory {
|
public class LigerGridFactory extends BaseGridFactory {
|
||||||
|
|
|
||||||
|
|
@ -1,108 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com).
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.smallchill.core.toolbox.support;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.smallchill.core.toolbox.Func;
|
|
||||||
|
|
||||||
public class BladePage<T> {
|
|
||||||
|
|
||||||
/** 返回结果集 **/
|
|
||||||
private List<T> rows;
|
|
||||||
|
|
||||||
/** 返回的总页数 **/
|
|
||||||
private long total;
|
|
||||||
|
|
||||||
/** 返回的当前页数 **/
|
|
||||||
private long page;
|
|
||||||
|
|
||||||
/** 每页显示的记录数 **/
|
|
||||||
private long pageSize;
|
|
||||||
|
|
||||||
/** 一共有多少数据 **/
|
|
||||||
private long records;
|
|
||||||
|
|
||||||
/** 当前页起始行号 **/
|
|
||||||
private long rowBegin;
|
|
||||||
|
|
||||||
/** 当前页结束行号 **/
|
|
||||||
private long rowEnd;
|
|
||||||
|
|
||||||
public BladePage(List<T> rows, long page, long pageSize, long records) {
|
|
||||||
setRows(rows);
|
|
||||||
setPage(page);
|
|
||||||
setPageSize(pageSize);
|
|
||||||
setRecords(records);
|
|
||||||
onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onInit() {
|
|
||||||
this.rowBegin = (page - 1) * pageSize + 1;
|
|
||||||
this.rowEnd = page * pageSize;
|
|
||||||
long pages = Func.toLong(records / pageSize, 0);
|
|
||||||
this.total = (records % this.pageSize == 0L) ? pages : (pages + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T> getRows() {
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRows(List<T> rows) {
|
|
||||||
this.rows = rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTotal() {
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(long page) {
|
|
||||||
this.page = page;
|
|
||||||
if (page < 1)
|
|
||||||
this.page = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPageSize() {
|
|
||||||
return pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPageSize(long pageSize) {
|
|
||||||
this.pageSize = pageSize;
|
|
||||||
if (pageSize < 1)
|
|
||||||
this.pageSize = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRecords() {
|
|
||||||
return records;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecords(long records) {
|
|
||||||
this.records = records < 0 ? 0 : records;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRowBegin() {
|
|
||||||
return rowBegin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRowEnd() {
|
|
||||||
return rowEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,98 +0,0 @@
|
||||||
package com.smallchill.core.toolbox.support;
|
|
||||||
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
import com.sun.image.codec.jpeg.JPEGCodec;
|
|
||||||
import com.sun.image.codec.jpeg.JPEGImageEncoder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片压缩处理
|
|
||||||
*
|
|
||||||
* @author 崔素强
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class ImgCompress {
|
|
||||||
private Image img;
|
|
||||||
private String imgPath;
|
|
||||||
private int width;
|
|
||||||
private int height;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数
|
|
||||||
*/
|
|
||||||
public ImgCompress(String path) throws IOException {
|
|
||||||
File file = new File(path);// 读入文件
|
|
||||||
imgPath = path;
|
|
||||||
img = ImageIO.read(file); // 构造Image对象
|
|
||||||
width = img.getWidth(null); // 得到源图宽
|
|
||||||
height = img.getHeight(null); // 得到源图长
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按照宽度还是高度进行压缩
|
|
||||||
*
|
|
||||||
* @param w int 最大宽度
|
|
||||||
* @param h int 最大高度
|
|
||||||
*/
|
|
||||||
public void resizeFix() throws IOException {
|
|
||||||
resizeFix(500, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按照宽度还是高度进行压缩
|
|
||||||
*
|
|
||||||
* @param w int 最大宽度
|
|
||||||
* @param h int 最大高度
|
|
||||||
*/
|
|
||||||
public void resizeFix(int w, int h) throws IOException {
|
|
||||||
if (width / height > w / h) {
|
|
||||||
resizeByWidth(w);
|
|
||||||
} else {
|
|
||||||
resizeByHeight(h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 以宽度为基准,等比例放缩图片
|
|
||||||
*
|
|
||||||
* @param w int 新宽度
|
|
||||||
*/
|
|
||||||
public void resizeByWidth(int w) throws IOException {
|
|
||||||
int h = (int) (height * w / width);
|
|
||||||
resize(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 以高度为基准,等比例缩放图片
|
|
||||||
*
|
|
||||||
* @param h int 新高度
|
|
||||||
*/
|
|
||||||
public void resizeByHeight(int h) throws IOException {
|
|
||||||
int w = (int) (width * h / height);
|
|
||||||
resize(w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 强制压缩/放大图片到固定的大小
|
|
||||||
*
|
|
||||||
* @param w int 新宽度
|
|
||||||
* @param h int 新高度
|
|
||||||
*/
|
|
||||||
public void resize(int w, int h) throws IOException {
|
|
||||||
// SCALE_SMOOTH 的缩略算法 生成缩略图片的平滑度的 优先级比速度高 生成的图片质量比较好 但速度慢
|
|
||||||
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
|
|
||||||
image.getGraphics().drawImage(img, 0, 0, w, h, null); // 绘制缩小后的图
|
|
||||||
File destFile = new File(imgPath);
|
|
||||||
FileOutputStream out = new FileOutputStream(destFile); // 输出到文件流
|
|
||||||
// 可以正常实现bmp、png、gif转jpg
|
|
||||||
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
|
|
||||||
encoder.encode(image); // JPEG编码
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
||||||
package com.smallchill.core.toolbox.support;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.smallchill.core.toolbox.Func;
|
|
||||||
import com.smallchill.core.toolbox.kit.JsonKit;
|
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义常用的 sql关键字
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SqlKeyword {
|
|
||||||
private static final String EQUAL = "_equal";
|
|
||||||
private static final String NOT_EQUAL = "_notequal";
|
|
||||||
private static final String LIKE = "_like";
|
|
||||||
private static final String NOT_LIKE = "_notlike";
|
|
||||||
private static final String GT = "_gt";
|
|
||||||
private static final String LT = "_lt";
|
|
||||||
private static final String DATE_GT = "_dategt";
|
|
||||||
private static final String DATE_LT = "_datelt";
|
|
||||||
private static final String OR = "or_";
|
|
||||||
private static final String AND = "and_";
|
|
||||||
private static final String SECOND = "_2nd";
|
|
||||||
private static final String IS_NULL = "_null";
|
|
||||||
private static final String NOT_NULL = "_notnull";
|
|
||||||
private static HashMap<String, String> keyWord = new HashMap<String, String>();
|
|
||||||
static {
|
|
||||||
keyWord.put(EQUAL, " = ? ");
|
|
||||||
keyWord.put(NOT_EQUAL, " <> ? ");
|
|
||||||
keyWord.put(LIKE, " like ? ");
|
|
||||||
keyWord.put(NOT_LIKE, " not like ? ");
|
|
||||||
keyWord.put(GT, " > ? ");
|
|
||||||
keyWord.put(LT, " < ? ");
|
|
||||||
keyWord.put(DATE_GT, " > ? ");
|
|
||||||
keyWord.put(DATE_LT, " < ? ");
|
|
||||||
keyWord.put(IS_NULL, " is null ");
|
|
||||||
keyWord.put(NOT_NULL, " is not null ");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据前台json格式转化成map进行遍历
|
|
||||||
*
|
|
||||||
* @param w
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static String getWhere(String w) {
|
|
||||||
try {
|
|
||||||
StringBuilder where = new StringBuilder(" where 1=1 ");
|
|
||||||
StringBuilder or = new StringBuilder();
|
|
||||||
StringBuilder and = new StringBuilder();
|
|
||||||
if (StrKit.notBlank(w)) {
|
|
||||||
w = Func.decodeUrl(w);
|
|
||||||
Map<String, String> mm = JsonKit.parse(w, HashMap.class);
|
|
||||||
for (String m : mm.keySet()) {
|
|
||||||
String col = clearKeyWord(m);
|
|
||||||
String k = "";
|
|
||||||
for (String key : keyWord.keySet()) {
|
|
||||||
if (m.indexOf(key) >= 0) {
|
|
||||||
k = key;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StrKit.isBlank(k)) {
|
|
||||||
k = LIKE;
|
|
||||||
}
|
|
||||||
String filter = col + getKeyWord(k, m);
|
|
||||||
if (m.indexOf(OR) == -1) {
|
|
||||||
and.append(" and (" + filter + ")");
|
|
||||||
} else {
|
|
||||||
or.append(" or (" + filter + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
where.append(and.toString()).append(or.toString());
|
|
||||||
}
|
|
||||||
return where.toString();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
return " where 1=1 ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String clearKeyWord(String key) {
|
|
||||||
for (String k : keyWord.keySet()) {
|
|
||||||
key = key.replace(k, "");
|
|
||||||
}
|
|
||||||
key = key.replace(OR, "").replace(AND, "").replace(SECOND, "");
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getKeyWord(String key, String value) {
|
|
||||||
String _keyWord = keyWord.get(key);
|
|
||||||
if (key.equals(DATE_GT) || key.equals(DATE_LT)) {
|
|
||||||
// value = value.replace("T", " ") + ":00";
|
|
||||||
if (Func.isOracle()) {
|
|
||||||
value = "to_date(#{" + value + "},'yyyy-mm-dd hh24:mi:ss')" + (key.equals(DATE_LT) ? "-1" : "");
|
|
||||||
} else if (Func.isMySql() && key.equals(DATE_GT)) {
|
|
||||||
value = "date_sub(#{" + value + "},interval +1 day)";//"'" + value + "'";
|
|
||||||
} else if (Func.isMySql() && key.equals(DATE_LT)) {
|
|
||||||
value = "date_sub(#{" + value + "},interval -1 day)";
|
|
||||||
}
|
|
||||||
return _keyWord.replace("?", value);
|
|
||||||
}
|
|
||||||
if(key.indexOf("like") > 0){
|
|
||||||
return _keyWord.replace("?", " CONCAT(CONCAT('%', #{" + value + "}),'%') ");
|
|
||||||
}
|
|
||||||
return _keyWord.replace("?", "#{" + value + "}");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -26,11 +26,11 @@ import com.smallchill.core.plugins.dao.Md;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
||||||
|
import com.smallchill.core.toolbox.grid.SqlKeyword;
|
||||||
import com.smallchill.core.toolbox.kit.CacheKit;
|
import com.smallchill.core.toolbox.kit.CacheKit;
|
||||||
import com.smallchill.core.toolbox.kit.DateKit;
|
import com.smallchill.core.toolbox.kit.DateKit;
|
||||||
import com.smallchill.core.toolbox.kit.JsonKit;
|
import com.smallchill.core.toolbox.kit.JsonKit;
|
||||||
import com.smallchill.core.toolbox.kit.StrKit;
|
import com.smallchill.core.toolbox.kit.StrKit;
|
||||||
import com.smallchill.core.toolbox.support.SqlKeyword;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/excel")
|
@RequestMapping("/excel")
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.constant.ConstConfig;
|
import com.smallchill.core.constant.ConstConfig;
|
||||||
import com.smallchill.core.meta.MetaIntercept;
|
import com.smallchill.core.meta.MetaIntercept;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
|
|
||||||
public class AttachIntercept extends MetaIntercept {
|
public class AttachIntercept extends MetaIntercept {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ import com.smallchill.core.constant.ConstCache;
|
||||||
import com.smallchill.core.meta.MetaIntercept;
|
import com.smallchill.core.meta.MetaIntercept;
|
||||||
import com.smallchill.core.toolbox.Func;
|
import com.smallchill.core.toolbox.Func;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.CacheKit;
|
import com.smallchill.core.toolbox.kit.CacheKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
|
|
||||||
public class LogIntercept extends MetaIntercept {
|
public class LogIntercept extends MetaIntercept {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ import com.smallchill.core.plugins.dao.Blade;
|
||||||
import com.smallchill.core.shiro.ShiroKit;
|
import com.smallchill.core.shiro.ShiroKit;
|
||||||
import com.smallchill.core.toolbox.Paras;
|
import com.smallchill.core.toolbox.Paras;
|
||||||
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
import com.smallchill.core.toolbox.ajax.AjaxResult;
|
||||||
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
import com.smallchill.core.toolbox.kit.CacheKit;
|
import com.smallchill.core.toolbox.kit.CacheKit;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
|
||||||
import com.smallchill.system.model.Parameter;
|
import com.smallchill.system.model.Parameter;
|
||||||
|
|
||||||
public class ParameterIntercept extends MetaIntercept {
|
public class ParameterIntercept extends MetaIntercept {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import java.util.Map;
|
||||||
import com.smallchill.common.tool.SysCache;
|
import com.smallchill.common.tool.SysCache;
|
||||||
import com.smallchill.core.aop.AopContext;
|
import com.smallchill.core.aop.AopContext;
|
||||||
import com.smallchill.core.meta.PageIntercept;
|
import com.smallchill.core.meta.PageIntercept;
|
||||||
import com.smallchill.core.toolbox.support.BladePage;
|
import com.smallchill.core.toolbox.grid.BladePage;
|
||||||
|
|
||||||
public class UserIntercept extends PageIntercept {
|
public class UserIntercept extends PageIntercept {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user